title: PLSQL archiving LONG datatype, error:
body: <p>Im using Oracle 11g, attempting to move anything older than 90days to the History table using PL/SQL..BUT i have one of the columns using datatype of LONG. So i have found the SQL that i thought should work but it gives errors:</p>
  
  <pre><code>    BEGIN
  FOR ROW IN
         (SELECT  MESSSAGE_KEY,
            DISTRIBUTION_ID,
            MESSAGE,
            SYSTEM_NAME,
            MESSAGE_TYPE,
            MESSAGE_NAME,
            MESSAGE_STATUS,
            LATEST_INBOUND,
            CREATETS,
            MODIFYTS,
            CREATEUSERID,
            MODIFYUSERID,
            CREATEPROGID,
            MODIFYPROGID,
            LOCKID,
            ENTITY_KEY,
            ENTITY_NAME,
            ENTITY_VALUE
          FROM    NWCG_INBOUND_MESSAGE
          WHERE   TO_CHAR (createts, 'YYYYMMDD') &gt;= TO_CHAR ((sysdate-90), 'YYYYMMDD')
      )
      LOOP
      INSERT INTO NWCG_INBOUND_MESSAGE_H
      VALUES (    
                  ROW.MESSSAGE_KEY,
            ROW.DISTRIBUTION_ID,
            ROW.MESSAGE,
            ROW.SYSTEM_NAME,
            ROW.MESSAGE_TYPE,
            ROW.MESSAGE_NAME,
            ROW.MESSAGE_STATUS,
            ROW.LATEST_INBOUND,
            ROW.CREATETS,
            ROW.MODIFYTS,
            ROW.CREATEUSERID,
            ROW.MODIFYUSERID,
            ROW.CREATEPROGID,
            ROW.MODIFYPROGID,
            ROW.LOCKID,
            ROW.ENTITY_KEY,
            ROW.ENTITY_NAME,
            ROW.ENTITY_VALUE
             );
  END LOOP;
  END;
  </code></pre>
  
  <p>This is the error i am getting:</p>
  
  <pre><code>Error report:
  ORA-06502: PL/SQL: numeric or value error
  ORA-06512: at line 2
  06502. 00000 -  "PL/SQL: numeric or value error%s"
  *Cause:    
  *Action:
  </code></pre>
  
  <p>From my research it looks like this error has been about a lot, but i cant find any of peoples solutions to work.... any ideas?</p>