Home » SQL & PL/SQL » SQL & PL/SQL » Exception Occured: ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-222
Exception Occured: ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-222 [message #462898] Mon, 28 June 2010 10:02 Go to next message
archana485
Messages: 22
Registered: June 2010
Junior Member
Hi,

I have a stored procedure that reads records from the db and writes into a file and FTP's the file to a remote server.
The following is the proc that creates the file

the CMD_STRING is a CLOB variable

PROCEDURE Processfileid (file_id_in IN VARCHAR2,
                         noofrec    IN PLS_INTEGER)
IS
  CURSOR RECORD IS
    SELECT cmd_string
    FROM   &schema..&batchfileentry
    WHERE  file_id = file_id_in;
  limit_in PLS_INTEGER DEFAULT 10000;
  TYPE record_tt
    IS TABLE OF RECORD%ROWTYPE INDEX BY PLS_INTEGER;
  l_record RECORD_TT;
  fileid   utl_file.file_type;
BEGIN
  dbms_lob.Createtemporary(l_record, true);

  fileid := utl_file.Fopen (mdsp.filecreationdirectory, file_id_in, 'W');

  utl_file.Putf (fileid, mdsp.codeoffcs
                         ||mdsp.codeoffgs, mdsp.padding);

  OPEN eptrecord;

  LOOP
      FETCH RECORD BULK COLLECT INTO l_record LIMIT limit_in;

      FOR indx IN 1 .. l_record.COUNT LOOP
          utl_file.Put_line(fileid, L_record(indx).cmd_string);
      END LOOP;

      EXIT WHEN RECORD%notfound;
  END LOOP;

  CLOSE RECORD;

  utl_file.Fclose (fileid);
EXCEPTION
  WHEN OTHERS THEN
             IF utl_file.Is_open(fileid) THEN
               utl_file.Fclose (fileid);
             END IF;

             IF RECORD%isopen THEN
               CLOSE RECORD;
             END IF;

             RAISE;
END processfileid;  



I am getting the following exception when this is invoked:

Exception Occured: ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275
ORA-06512: at "SYS.DBMS_LOB", line 517

I need to initialise the LOB locator but i am not able to figure out how to do it. Please help !

** Please format yourself in the future

[Updated on: Mon, 28 June 2010 10:16] by Moderator

Report message to a moderator

Re: Exception Occured: ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA [message #462905 is a reply to message #462898] Mon, 28 June 2010 10:23 Go to previous message
Michel Cadot
Messages: 68770
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Use SQL*Plus and copy and paste your session including the procedure creation.
We don't know where the error occurs.

I don't know how it could work (or even compile) with a parameter of dbms_lob.createtemporary declared as "TABLE OF RECORD%ROWTYPE INDEX BY PLS_INTEGER" when it should be a lob locator.

Regards
Michel
Previous Topic: Deleting multiple records based on conditions
Next Topic: General performance of a LIKE statement
Goto Forum:
  


Current Time: Thu Sep 04 14:27:34 CDT 2025