Help with "ORA-06511: PL/SQL: cursor already open"

I've tried numerous variations on this piece of code and I always get the same result. I'm sure this is painfully obvious to an experienced PL/SQL person.
Any help will be appreciated!
Thank You!
1 DECLARE
2 CURSOR EMP_CURSOR IS SELECT last_name from employees;
3 current_last_name varchar2(25);
4 BEGIN
5 IF EMP_CURSOR%ISOPEN
6 THEN
7 dbms_output.put_line ('cursor is already open');
8 close EMP_CURSOR;
9 END IF;
10 dbms_output.put_line ('opening cursor');
11 OPEN EMP_CURSOR;
12 FOR item in EMP_CURSOR LOOP
13 FETCH EMP_CURSOR INTO current_last_name;
14 EXIT WHEN EMP_CURSOR%NOTFOUND;
15 dbms_output.put_line (item.last_name);
16 END LOOP;
17 CLOSE EMP_CURSOR;
18* END;
19 /
DECLARE
ERROR at line 1:
ORA-06511: PL/SQL: cursor already open
ORA-06512: at line 2
ORA-06512: at line 12

Mathieu,
Log in as anotherSchema and grant select on 'IDsTable' to the current user.
SQL> r
  1  create or replace function f1(theID varchar2) return mytype pipelined is
  2  out varchar2(30);
  3  cursor myCursor (x varchar2) is select * from scott.emp where job=x;
  4  begin
  5  for rec in myCursor(theID) loop
  6  pipe row(rec.ename);
  7  end loop;
  8  return;
  9* end;
Warning: Function created with compilation errors.
SQL> show errors
Errors for FUNCTION F1:
LINE/COL ERROR
3/33     PL/SQL: SQL Statement ignored
3/53     PL/SQL: ORA-00942: table or view does not exist
6/1      PL/SQL: Statement ignored
6/10     PLS-00364: loop index variable 'REC' use is invalid
SQL> connect scott
Enter password: *****
Connected.
SQL> grant select on emp to testuser;
Grant succeeded.
SQL> connect testuser
Enter password: ****
Connected.
SQL> create or replace function f1(theID varchar2) return mytype pipelined is
  2  out varchar2(30);
  3  cursor myCursor (x varchar2) is select * from scott.emp where job=x;
  4  begin
  5  for rec in myCursor(theID) loop
  6  pipe row(rec.ename);
  7  end loop;
  8  return;
  9  end;
10  /
Function created.
SQL> disconnect
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.3.0 - Production
SQL>

Similar Messages

  • Error while executing Procedure - ORA-06511: PL/SQL: cursor already open

    I have successfully compiled the following procedure but when I execute it, following error occurs, please adv.
    Thanks and Regards,
    Luqman
    create or replace
    procedure TESTKIBOR
    (contno in varchar)
    AS
    BEGIN
    DECLARE cursor c1 is
    SELECT * FROM KIBOR_SCHEDULE
    WHERE CN=contno;
    begin
    OPEN C1;
    FOR line IN c1 LOOP
    update kibor_schedule
    set lincome=line.Lincome,
    expo=line.eXPO,
    pport=line.pPORT
    where cn=line.cn
    and rno=line.rno;
    END LOOP;
    COMMIT;
    close c1;
    END;
    END TESTKIBOR;
    ERROR at line 1:
    ORA-06511: PL/SQL: cursor already open
    ORA-06512: at "MKTG.TESTKIBOR", line 6
    ORA-06512: at "MKTG.TESTKIBOR", line 10
    ORA-06512: at line 1

    Hi,
    CREATE OR REPLACE PROCEDURE Testkibor
         (contno  IN VARCHAR)
    AS
    BEGIN
      DECLARE
        CURSOR c1 IS
          SELECT *
          FROM   kibor_schedule
          WHERE  cn = contno;
      BEGIN
    --//    OPEN c1; --no need to open if using for loop
        FOR line IN c1 LOOP
          UPDATE kibor_schedule
          SET    lincome = line.lincome,
                 expo = line.expo,
                 pport = line.pport
          WHERE  cn = line.cn
                 AND rno = line.rno;
        END LOOP;
        COMMIT;
    --//     CLOSE c1; -- no need for loop  does it for you
      END;
    END testkibor;SS

  • Getting error --- ORA-06511: PL/SQL: cursor already open

    I have the following code for a Apex(Application Express) project I am developing.
    declare
    mail_id varchar2(100);
    min_skill_cnt number;
    skill_cde varchar2(30);
    total_leave number;
    toal_emp number;
    cursor cur is
    select S_EMP_EMAIL
    from EMP_SKILLS_INFO where SKILLCODE='MGR' and S_EMP_EMAIL = lower(:APP_USER) ;
    cursor minskill is
    select skill_code,MINRQMT_AM
    from skills_code_info
    where skill_code in (select skillcode from emp_skills_info where S_EMP_EMAIL = lower(:APP_USER));
    cursor leavecnt(v_skill IN VARCHAR2) is
    select count(*) from emp_leave_info
    where leave_date = :P24_LEAVE_DATE
    and emp_email IN (select S_EMP_EMAIL from EMP_SKILLS_INFO where SKILLCODE = v_skill);
    cursor empcnt(v_skills IN VARCHAR2) is
    select count(*) from EMP_SKILLS_INFO
    where SKILLCODE = v_skills;
    begin
    open cur;
    open minskill;
    LOOP
    fetch minskill into skill_cde,min_skill_cnt;
    exit when minskill%NOTFOUND;
    open leavecnt(skill_cde);
    fetch leavecnt into total_leave;
    open empcnt(skill_cde);
    fetch empcnt into toal_emp;
    IF toal_emp-total_leave < min_skill_cnt
    then
    apex_mail.send(
    p_to => :APP_USER ,
    p_from => '[email protected]',
    p_cc => NULL,
    p_body => '***** This is a system generated message, please do not reply to this *****'||
    chr(10) || utl_tcp.crlf || 'Please review the current skill as '||:APP_USER||' is on leave'||
    chr(10) || utl_tcp.crlf ||'Thanks',
    p_subj => 'Skill code alert' );
    end if;
    END LOOP;
    close empcnt;
    close leavecnt;
    close minskill;
    close cur;
    end;
    =======================
    Ideally this should send email to managers when a particular skill is running short when employee applies for leave.
    I am getting error that cursor is already open when I run this code. I am not sure which cursor or where it is picking open cursor command.
    Any inputs will be appreciated.

    LOOP
          FETCH minskill
          INTO skill_cde, min_skill_cnt;
          EXIT WHEN minskill%NOTFOUND;
          OPEN leavecnt (skill_cde); --- here you open.. in a loop and not close inside loop
          FETCH leavecnt INTO total_leave;
          OPEN empcnt (skill_cde);--- here you open.. in a loop and not close inside loop
          FETCH empcnt INTO toal_emp;
          IF toal_emp - total_leave < min_skill_cnt
          THEN
             apex_mail.
             send (
                p_to     => :APP_USER,
                p_from   => '[email protected]',
                p_cc     => NULL,
                p_body   => '***** This is a system generated message, please do not reply to this *****'
                           || CHR (10)
                           || UTL_TCP.crlf
                           || 'Please review the current skill as '
                           || :APP_USER
                           || ' is on leave'
                           || CHR (10)
                           || UTL_TCP.crlf
                           || 'Thanks',
                p_subj   => 'Skill code alert');
          END IF;
       END LOOP;

  • Help with ORA-06502: PL/SQL: numeric or value error:

    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    I passed a fiscal year in as a parameter, and try to set a local variable to that value so i can use that variable later on in the for loop statement to increment the fiscal year to 2009, 2010, etc.
    I kept getting the error message above, is it because I can't assign value greater than 99 to a variable? The local variable's type is based on the table.fiscal_year%type.
    Thanks.

    The data type of the fiscal_year is number(4);
    this is the beginning of the procedure code:
    PROCEDURE load_data ( fiscal_year_in IN table8.fiscalyear%TYPE) IS
         l_fiscal_year table8.fiscalyear%TYPE := fiscal_year_in ;
    and I run the procedure as
    exec import_data.load_data(2008);
    Edited by: jasmine6 on Oct 7, 2008 8:50 AM

  • Implicit PL/SQL cursors remain open, causing ORA-01000 (Client 9.2.0.1)

    Hello,
    since migrating our system from Oracle Client 9.0.X to 9.2.0.1 (Windows XP), i am encountering troubles when calling a stored procedure from a Cobol-Program:
    after a while i run into a 'Maximum open cursors exceeded'-message (ORA-01000)
    The stored procedure returns a cursor (ref_cursor)
    When Executing the stored procedure, there are actually 2 cursors involved, in fact the stored PL/SQL procedure implicitely opens a child-cursor when doing a select within the PL/SQL.
    After fetching the result and closing the cursor in my cobol-program, it correctly closes the cursor associated with the stored-procedure, but it does not close the cursor that was implicitely opened by oracle.
    After a while i am running into a Maximum open cursors message, because those cursors have not properly been closed.
    Here's a simple PL/SQL package that illustrates the problem:
    create or replace package scott.SCOTTS_PACKAGE is
    type ref_cursor IS REF CURSOR;
    function GET_EMP(EMP_IN CHAR) return ref_cursor;
    end SCOTTS_PACKAGE;
    create or replace package body scott.SCOTTS_PACKAGE is
    -- Function and procedure implementations
    function GET_EMP(EMP_IN CHAR) return ref_cursor is
    MyCurs ref_cursor;
    begin
    OPEN MyCurs FOR
    SELECT EMPNO ,
    ENAME ,
    JOB
    FROM SCOTT.EMP
    WHERE ENAME = EMP_IN;
    return(MyCurs);
    end;
    end SCOTTS_PACKAGE;
    Here are some exerpts from my cobol program:
    (The program iterates 100x through the section that executes the PL/SQL. After each iteration an additional open cursor remains in the database)
    003800 EXEC SQL BEGIN DECLARE SECTION END-EXEC.
    003900*
    004000 01 SQL-USERNAME PIC X(16) VARYING.
    004100 01 SQL-PASSWD PIC X(16) VARYING.
    004200 01 SQL-DBNAME PIC X(64) VARYING.
    004300 01 ORACLE.
    004700 02 ORA-CUR-EMP SQL-CURSOR.
    01 EMPREC.
    02 EMPREC-EMPNO PIC X(4).
    02 EMPREC-ENAME PIC X(10).
    02 EMPREC-JOB PIC X(9).
    005400 EXEC SQL END DECLARE SECTION END-EXEC.
    018400 PROCEDURE DIVISION.
    CONTINUE.
    018700 EXEC SQL
    018800 WHENEVER SQLERROR DO PERFORM SQL-ERROR
    018900 END-EXEC.
    019000*
    CONTINUE.
    019100 EXEC SQL
    019200 WHENEVER NOT FOUND DO PERFORM SQL-NOT-FOUND
    019300 END-EXEC.
    022400 EXEC SQL
    022500 ALLOCATE :ORA-CUR-EMP
    022600 END-EXEC
    PERFORM VARYING I FROM 1 BY 1 UNTIL I > 100
    ACCEPT DUMMY FROM TER
    IF DUMMY = "E"
    MOVE 100 TO I
    END-IF
    PERFORM GET-EMP
    ADD 1 TO I
    END-PERFORM
    119300 GET-EMP SECTION.
    119400************************
    119500 GAM0.
    MOVE SPACES TO EMPREC-EMPNO EMPREC-JOB
    MOVE "SMITH" TO EMPREC-ENAME
    120200 EXEC SQL AT SSSI EXECUTE
    120300 BEGIN
    120400 :ORA-CUR-EMP:=
    120500 SCOTT.SCOTTS_PACKAGE.GET_EMP(:EMPREC-ENAME );
    120900
    END;
    121000 END-EXEC
    121200 IF DB-ERR-CODE NOT = HIGH-VALUE
    121300 DISPLAY "CCSIFSO:GET-AUTRE-MATR:APPEL PERS... OK"
    121400 EXEC SQL
    121500 FETCH :ORA-CUR-EMP
    121600 INTO
    121700 :EMPREC-EMPNO,
    121800 :EMPREC-ENAME,
    121900 :EMPREC-JOB
    122400 END-EXEC
    122500 END-IF
    122600*
    122700 IF DB-ERR-CODE NOT = HIGH-VALUE
    122800 DISPLAY "CCSIFSO:GET-AUTRE-MATR:APPEL FETCH.. OK"
    123000 ELSE
    123100 MOVE LOW-VALUE TO DB-ERR-CODE
    123200 END-IF
    123300 EXEC SQL
    123400 CLOSE :ORA-CUR-EMP
    123500 END-EXEC
    123600 GA-EX.
    123700 EXIT.
    124000 SQL-NOT-FOUND SECTION.
    124100*----------------------
    124200 NF0.
    124300 DISPLAY "CCSIFSO:SQL-NOT-FOUND SECTION."
    124400 MOVE HIGH-VALUE TO DB-ERR-CODE.
    124500 NF-EX.
    124600 EXIT.
    124700*
    124800 SQL-ERROR SECTION.
    124900*-----------------
    125000 ER0.
    125200 EXEC SQL
    125300 WHENEVER SQLERROR CONTINUE
    125400 END-EXEC
    125700 MOVE HIGH-VALUE TO DB-ERR-CODE
    125800*
    126100 DISPLAY "ORACLE ERROR DETECTED: " SQLCODE UPON TER
    126200 DISPLAY SQLERRMC UPON TER
    126300*
    126400 EXEC SQL AT SSSI
    126500 ROLLBACK WORK
    126600 RELEASE
    126700 END-EXEC
    126800 DISPLAY "----------------------------" UPON TER
    126900 DISPLAY " ! ROLLBACK ET DISCONNECT ! " UPON TER
    127000 DISPLAY "----------------------------" UPON TER
    127200 CALL "PPTERMJ".
    127400 ER-EX.
    127500 EXIT.
    Finally here's an exerpt from V$OPEN_CURSOR, after a few iterations:
    1 begin :b1 := SCOTT . SCOTTS_PACKAGE . GET_EMP (:b2 ) ; END ;
    2 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    3 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    4 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    5 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    6 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    7 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    8 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    9 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    10 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    11 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    As you see, there is only 1 cursor starting with 'begin ... '
    but there are 10 implicit cursors 'SELECT EMPNO, ... ' that have not been properly closed, nor reused by ORACLE.
    In our old configuration (ORACLE CLient 9.0.X), you would only see:
    1 begin :b1 := SCOTT . SCOTTS_PACKAGE . GET_EMP (:b2 ) ; END ;
    2 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    meaning all the other cursors have properly been closed.
    As a conclusion: the program correctly closes the implicit cursors when using a 9.0 Client, wheras the implicit cursors remain open on Client 9.2.0.1 (Windows XP)
    The underlying database can be either 8.i or 9, the problem remains the same.
    Finally here's a small Delphi code, using ODAC-components, that somewhat illustrates the same problem:
    procedure TForm1.ExecProcClick(Sender: TObject);
    var I: INTEGER ;
    begin
    FOR I := 1 TO 5 DO
    BEGIN
    SP1.StoredProcName:='SCOTT.SCOTTS_PACKAGE.GET_EMP';
    SP1.Prepare;
    SP1.ParamByName('EMP_IN').AsString := 'SMITH';
    SP1.ExecProc;
    SP1.Next;
    SP1.Close;
    SP1.UnPrepare;
    END;
    end;
    After each call to 'PREPARE', an additional implicit cursor remains open on the database. (using Oracle Client 9.2.0.1)
    On our old system (Oracle Client 9.0 or 8.X), the same program would not generate accumulating open cursors on the database
    Any suggestions would be welcome,
    Claude

    Cobol.. been many years since I last even saw some Cobol source code. Invokes all kinds of memories. :-)
    Since you found the patch, the advice is superfluous, but works. Close the cursor at the PL/SQL side, e.g.
    create or replace procedure CloseRefCursor( cRefCursor TYPELIB.TRefCursor ) is
    begin
      close cRefCursor;
    exception when OTHERS then
      -- if the cursor is already gone, not a problem
      NULL;
    end;In Delphi for example, one can subclass the class used for ref cursor calls and add a call to the above PL/SQL proc in the destructor. Or add create a standard Cobol close ref cursor section that does similar.

  • I am trying to get help with WMPlayer tech support Adobe Reader cant open wmpsupport.htm files why?

    i am trying to get help with WMPlayer tech support Adobe Reader cant open wmpsupport.htm files why?

    Adobe Reader opens PDF files, nothing else.

  • Can I get help with podcasts?  When I try to open the podcasts, itunes crashes, says "itunes has detected a problem and must close", or the spanish equivalent since my xp is in spanish.  everything else works fine, it even downloads podcasts and syncs.

    Can I get help with podcasts?  When I try to open the podcasts tab, itunes crashes, says "itunes has detected a problem and must close", or the spanish equivalent since my xp is in spanish.  everything else works fine, it even downloads podcasts and syncs.

    The only other thing I can suggest is to use the Repair option for iTunes.
    Download the iTunes programme (do not uninstall your current iTunes) and then "install" the new copy. At some stage you should see an option to "install" or "Repair". Take the Repair option.
    Once you've done that, if you still have a problem, I don't know what else to suggest, except to search through the discussions to see if anyone else has had the problem and managed to fix it.

  • Please Help with ORA-01031 - try to connect as sysdba

    The log of the error is as follows:
    D:\oracle\product\10.1.0\Db_ra>set oracle_sid
    Environment variable oracle_sid not defined
    D:\oracle\product\10.1.0\Db_ra>set oracle_sid=ra
    D:\oracle\product\10.1.0\Db_ra>connect "/ as sysdba"
    'connect' is not recognized as an internal or external command,
    operable program or batch file.
    D:\oracle\product\10.1.0\Db_ra>sqlplus "/ as sysdba"
    SQL*Plus: Release 9.0.1.4.0 - Production on Mon Aug 29 12:31:17 2005
    (c) Copyright 2001 Oracle Corporation. All rights reserved.
    ERROR:
    ORA-01031: insufficient privileges
    Enter user-name: sys@ra as sysdba
    Enter password:
    Connected to an idle instance.
    SQL> shutdown immediate;
    ORA-01034: ORACLE not available
    ORA-27101: shared memory realm does not exist
    SQL> startup;
    ORACLE instance started.
    Total System Global Area 612368384 bytes
    Fixed Size 790096 bytes
    Variable Size 170127792 bytes
    Database Buffers 440401920 bytes
    Redo Buffers 1048576 bytes
    Database mounted.
    ORA-01092: ORACLE instance terminated. Disconnection forced
    I have been trying to work this out, but no success, Thanks in advance for your help.
    JA

    some part of the alert.log:
    Instance terminated by USER, pid = 1212
    ORA-1092 signalled during: ALTER DATABASE open ...
    Dump file d:\oracle\product\10.1.0\admin\ra\bdump\alert_ra.log
    Mon Aug 29 16:40:06 2005
    ORACLE V10.1.0.2.0 - Production vsnsta=0
    vsnsql=13 vsnxtr=3
    Windows Server 2003 Version V5.2 Service Pack 1
    CPU : 4 - type 586, 2 Physical Cores
    Process Affinity: 0x00000000
    Memory (A/P) : PH:3794M/4094M, PG:5823M/5973M, VA:1960M/2047M
    Mon Aug 29 16:40:06 2005
    Starting ORACLE instance (normal)
    LICENSE_MAX_SESSION = 0
    LICENSE_SESSIONS_WARNING = 0
    Picked latch-free SCN scheme 2
    KCCDEBUG_LEVEL = 0
    Autotune of undo retention is turned on.
    Dynamic strands is set to TRUE
    Running with 2 shared and 18 private strand(s). Zero-copy redo is FALSE
    IMODE=BR
    ILAT =18
    LICENSE_MAX_USERS = 0
    SYS auditing is disabled
    Starting up ORACLE RDBMS Version: 10.1.0.2.0.
    System parameters with non-default values:
    processes = 150
    __shared_pool_size = 159383552
    __large_pool_size = 4194304
    __java_pool_size = 4194304
    sga_target = 612368384
    control_files = D:\ORACLE\PRODUCT\10.1.0\RA\U02\ORADATA\RA\CONTROLFILE\O1_MF_1GHVSHLJ_.CTL, D:\ORACLE\PRODUCT\10.1.0\RA\U03\ORADATA\RA\CONTROLFILE\O1_MF_1GHVSHNZ_.CTL
    db_block_size = 8192
    __db_cache_size = 440401920
    compatible = 10.1.0.2.0
    log_archive_dest_1 = LOCATION=D:\oracle\product\10.1.0\ra\flash_recovery_area
    log_archive_format = ARC%S_%R.%T
    db_file_multiblock_read_count= 8
    db_create_file_dest = D:\oracle\product\10.1.0\ra\u01\oradata
    db_create_online_log_dest_1= D:\oracle\product\10.1.0\ra\u02\oradata
    db_create_online_log_dest_2= D:\oracle\product\10.1.0\ra\u03\oradata
    db_recovery_file_dest = D:\oracle\product\10.1.0\ra\flash_recovery_area
    db_recovery_file_dest_size= 10485760000
    undo_management = AUTO
    undo_tablespace = UNDOTBS1
    remote_login_passwordfile= EXCLUSIVE
    db_domain = megatel.hn
    dispatchers = (protocol=TCP)
    shared_servers = 1
    job_queue_processes = 10
    background_dump_dest = D:\ORACLE\PRODUCT\10.1.0\ADMIN\RA\BDUMP
    user_dump_dest = D:\ORACLE\PRODUCT\10.1.0\ADMIN\RA\UDUMP
    core_dump_dest = D:\ORACLE\PRODUCT\10.1.0\ADMIN\RA\CDUMP
    sort_area_size = 65536
    db_name = ra
    open_cursors = 300
    pga_aggregate_target = 203423744
    MMAN started with pid=3, OS id=1236
    RECO started with pid=8, OS id=768
    CJQ0 started with pid=9, OS id=1260
    Mon Aug 29 16:40:08 2005
    starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...
    starting up 1 shared server(s) ...
    SMON started with pid=7, OS id=1256
    CKPT started with pid=6, OS id=1252
    Mon Aug 29 16:40:10 2005
    alter database mount exclusive
    PMON started with pid=2, OS id=1232
    LGWR started with pid=5, OS id=1248
    DBW0 started with pid=4, OS id=1244
    Mon Aug 29 16:40:13 2005
    Controlfile identified with block size 16384
    Mon Aug 29 16:40:17 2005
    Setting recovery target incarnation to 2
    Mon Aug 29 16:40:17 2005
    Successful mount of redo thread 1, with mount id 2665279661
    Mon Aug 29 16:40:17 2005
    Database mounted in Exclusive Mode.
    Completed: alter database mount exclusive
    Mon Aug 29 16:40:18 2005
    alter database open
    Mon Aug 29 16:40:18 2005
    Beginning crash recovery of 1 threads
    attempting to start a parallel recovery with 3 processes
    parallel recovery started with 3 processes
    Mon Aug 29 16:40:19 2005
    Started first pass scan
    Log resilvered from block #210 to block #212
    Mon Aug 29 16:40:19 2005
    Completed first pass scan
    210 redo blocks read, 131 data blocks need recovery
    Mon Aug 29 16:40:19 2005
    Started redo application at
    Thread 1: logseq 2213, block 3, scn 0.0
    Recovery of Online Redo Log: Thread 1 Group 1 Seq 2213 Reading mem 0
    Mem# 0 errs 0: D:\ORACLE\PRODUCT\10.1.0\RA\U02\ORADATA\RA\ONLINELOG\O1_MF_1_1GHVSJOX_.LOG
    Mem# 1 errs 0: D:\ORACLE\PRODUCT\10.1.0\RA\U03\ORADATA\RA\ONLINELOG\O1_MF_1_1GHVSJW8_.LOG
    Mon Aug 29 16:40:20 2005
    Completed redo application
    Mon Aug 29 16:40:20 2005
    Completed crash recovery at
    Thread 1: logseq 2213, block 213, scn 0.8340211
    131 data blocks read, 131 data blocks written, 210 redo blocks read
    Mon Aug 29 16:40:21 2005
    LGWR: STARTING ARCH PROCESSES
    ARC0 started with pid=15, OS id=2064
    ARC0: Archival started
    Mon Aug 29 16:40:21 2005
    LGWR: STARTING ARCH PROCESSES COMPLETE
    ARC1 started with pid=16, OS id=2076
    ARC1: Archival started
    Mon Aug 29 16:40:21 2005
    ARC0: Becoming the 'no FAL' ARCH
    ARC0: Becoming the 'no SRL' ARCH
    Mon Aug 29 16:40:21 2005
    ARC1: Becoming the heartbeat ARCH
    Mon Aug 29 16:40:21 2005
    LGWR: Primary database is in CLUSTER CONSISTENT mode
    Thread 1 advanced to log sequence 2214
    Maximum redo generation record size = 120832 bytes
    Maximum redo generation change vector size = 116476 bytes
    Private_strands 7 at log switch
    Thread 1 opened at log sequence 2214
    Current log# 2 seq# 2214 mem# 0: D:\ORACLE\PRODUCT\10.1.0\RA\U02\ORADATA\RA\ONLINELOG\O1_MF_2_1GHVSK69_.LOG
    Current log# 2 seq# 2214 mem# 1: D:\ORACLE\PRODUCT\10.1.0\RA\U03\ORADATA\RA\ONLINELOG\O1_MF_2_1GHVSKF3_.LOG
    Successful open of redo thread 1
    Mon Aug 29 16:40:21 2005
    MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
    Mon Aug 29 16:40:21 2005
    ARC0: Evaluating archive log 1 thread 1 sequence 2213
    Mon Aug 29 16:40:21 2005
    ARC1: Evaluating archive log 1 thread 1 sequence 2213
    ARC1: Unable to archive log 1 thread 1 sequence 2213
    Log actively being archived by another process
    ARC1: Evaluating archive log 1 thread 1 sequence 2213
    Mon Aug 29 16:40:22 2005
    SMON: enabling cache recovery
    Mon Aug 29 16:40:22 2005
    ARC1: Unable to archive log 1 thread 1 sequence 2213
    Log actively being archived by another process
    ARC1: Evaluating archive log 1 thread 1 sequence 2213
    ARC1: Unable to archive log 1 thread 1 sequence 2213
    Log actively being archived by another process
    Mon Aug 29 16:40:22 2005
    Committing creation of archivelog 'D:\ORACLE\PRODUCT\10.1.0\RA\FLASH_RECOVERY_AREA\ARC02213_0564762704.001'
    Mon Aug 29 16:40:23 2005
    Successfully onlined Undo Tablespace 1.
    Mon Aug 29 16:40:23 2005
    SMON: enabling tx recovery
    Mon Aug 29 16:40:23 2005
    Database Characterset is WE8MSWIN1252
    Mon Aug 29 16:40:23 2005
    Published database character set on system events channel
    Mon Aug 29 16:40:23 2005
    All processes have switched to database character set
    Mon Aug 29 16:40:25 2005
    Starting background process QMNC
    QMNC started with pid=17, OS id=2152
    Mon Aug 29 16:40:27 2005
    replication_dependency_tracking turned off (no async multimaster replication found)
    Mon Aug 29 16:40:28 2005
    Errors in file d:\oracle\product\10.1.0\admin\ra\udump\ra_ora_1304.trc:
    ORA-00600: internal error code, arguments: [kksfbc-reparse-infinite-loop], [], [], [], [], [], [], []
    Mon Aug 29 16:40:30 2005
    Errors in file d:\oracle\product\10.1.0\admin\ra\udump\ra_ora_1304.trc:
    ORA-00600: internal error code, arguments: [kksfbc-reparse-infinite-loop], [], [], [], [], [], [], []
    Mon Aug 29 16:40:31 2005
    Errors in file d:\oracle\product\10.1.0\admin\ra\udump\ra_ora_1304.trc:
    ORA-00600: internal error code, arguments: [kksfbc-reparse-infinite-loop], [], [], [], [], [], [], []
    Mon Aug 29 16:40:32 2005
    Errors in file d:\oracle\product\10.1.0\admin\ra\udump\ra_ora_1304.trc:
    ORA-00600: internal error code, arguments: [kksfbc-reparse-infinite-loop], [], [], [], [], [], [], []
    Error 600 happened during db open, shutting down database
    USER: terminating instance due to error 600
    Mon Aug 29 16:40:33 2005
    Errors in file d:\oracle\product\10.1.0\admin\ra\bdump\ra_mman_1236.trc:
    ORA-00600: internal error code, arguments: [], [], [], [], [], [], [], []
    Mon Aug 29 16:40:33 2005
    Errors in file d:\oracle\product\10.1.0\admin\ra\bdump\ra_p002_1984.trc:
    ORA-00600: internal error code, arguments: [15784], [600], [], [], [], [], [], []
    ORA-00600: internal error code, arguments: [], [], [], [], [], [], [], []
    Mon Aug 29 16:40:33 2005
    Errors in file d:\oracle\product\10.1.0\admin\ra\bdump\ra_p001_1980.trc:
    ORA-00600: internal error code, arguments: [15784], [600], [], [], [], [], [], []
    ORA-00600: internal error code, arguments: [], [], [], [], [], [], [], []
    Mon Aug 29 16:40:33 2005
    Errors in file d:\oracle\product\10.1.0\admin\ra\bdump\ra_p000_1568.trc:
    ORA-00600: internal error code, arguments: [15784], [600], [], [], [], [], [], []
    ORA-00600: internal error code, arguments: [], [], [], [], [], [], [], []
    Mon Aug 29 16:40:33 2005
    Errors in file d:\oracle\product\10.1.0\admin\ra\bdump\ra_reco_768.trc:
    ORA-00600: internal error code, arguments: [], [], [], [], [], [], [], []
    Mon Aug 29 16:40:33 2005
    Errors in file d:\oracle\product\10.1.0\admin\ra\bdump\ra_smon_1256.trc:
    ORA-00600: internal error code, arguments: [], [], [], [], [], [], [], []
    Mon Aug 29 16:40:33 2005
    Errors in file d:\oracle\product\10.1.0\admin\ra\bdump\ra_ckpt_1252.trc:
    ORA-00600: internal error code, arguments: [], [], [], [], [], [], [], []
    Mon Aug 29 16:40:33 2005
    Errors in file d:\oracle\product\10.1.0\admin\ra\bdump\ra_lgwr_1248.trc:
    ORA-00600: internal error code, arguments: [], [], [], [], [], [], [], []
    Mon Aug 29 16:40:34 2005
    Errors in file d:\oracle\product\10.1.0\admin\ra\bdump\ra_dbw0_1244.trc:
    ORA-00600: internal error code, arguments: [], [], [], [], [], [], [], []
    Instance terminated by USER, pid = 1304
    ORA-1092 signalled during: alter database open...

  • Help with ORA-01403: no data found please.

    First off I'd like to apologise for my lack of PL/SQL experience, what follows may seem naive, but I guess we all have to start somewhere.
    I'm trying to create a function which determines an employee's Annual Holiday Entitlement by comparing their length of service against a lookup of entitlement values. Due to the complexity of the application I'm targeting there are a number of other factors to be take into consideration, but this is the basic idea of what I want to achieve.
    I've started by taking a working SQL Server 2005 function and converted this using the translation scratch pad in SQL Developer 1.5.1 I'm now hand cranking the subtleties into the script but when I debug the code I'm getting "ORA-01403: no data found" at almost every SELECT. In fact the only successful select is from the ABS_SYSTEM_CONTROLS table. I can handle the first few failures by setting default values in the variables that I'm trying to load, but this isn't an option when it comes to selecting the DATE_OF_START from the PERSON table.
    I've sure I've probably made some fundamental error, but can't spot it myself. Any help would be most welcome.
    I've included the entire script below for your entertainment ;-)
    Thanks
    Phil.
    create or replace
    function mygetannualholidayentitlement
    ( v_empNo in varchar2
    , v_inputDate in DATE
    ) return number as
       -- Declare variables here
       v_entitlement FLOAT(53);
       v_holidayPlan VARCHAR2(20);
       v_contServiceOption VARCHAR2(255);
       v_postNo CHAR(16);
       v_lengthOfService NUMBER(10,2) ; -- Need to give this a default value else the CURSOR (below) won't initialise.
       v_empStartDate DATE;
       -- Load up our loacal variable for each row in the loop and the final value is the one we want.
       v_selectedLOF FLOAT(53);
       v_selectedDateEffective DATE;
       v_selectedAmount FLOAT(53);
       v_effectiveDate DATE;
       -- Cursor declaration
       -- Holiday plan details are also keyed on DATE_EFFECTIVE.  Need to identify which row is active as at our @effectiveDate.
       CURSOR holDefCursor
         IS SELECT length_of_service,
       date_effective,
       amount
         FROM holiday_plan_def
          WHERE hplan_code = v_holidayPlan
         AND length_of_service < v_lengthOfService
         ORDER BY date_effective ASC,
       length_of_service ASC;
    BEGIN
       -- Initialise variables --
       -- truncate any hours/Mins & secs from effective date
       v_effectiveDate := trunc(v_inputdate);
       v_entitlement := 0;
       v_contServiceOption := 0;
       v_lengthOfService := 0;
       BEGIN
       SELECT HPLAN_CODE
         INTO v_holidayPlan
         FROM APPT_HOLIDAY_BALANCE
          WHERE emp_no = v_empNo
                  --          post_no = @postNo and
                  AND ( v_effectiveDate BETWEEN HOLIDAY_YEAR_START AND HOLIDAY_YEAR_END );
       EXCEPTION
       WHEN NO_DATA_FOUND THEN
          v_holidayplan:=NULL;
       WHEN OTHERS THEN
           raise_application_error(-20011,'Unknown Exception in MyGetAnnualHolidayEntitlement function.');
       END;
       -- Still no hoildayPlan? Then use the default plan code from ABS_SYSTEM_CONTROLS.
       IF v_holidayPlan IS NULL THEN
          SELECT HPLAN_CODE
            INTO v_holidayPlan
            FROM ABS_SYSTEM_CONTROLS ;
       END IF;
       BEGIN
        SELECT OPTION_VALUE
          INTO v_contServiceOption
          FROM PS_OPTIONS
           WHERE OPTION_NAME = 'CONTINUOUS_SERVICE_OPTION';
       EXCEPTION
       WHEN NO_DATA_FOUND THEN
          v_contServiceOption := 'N' ;
       WHEN OTHERS THEN
           raise_application_error(-20011,'Unknown Exception in MyGetAnnualHolidayEntitlement function.');
       END;
       IF v_contServiceOption = 'Y' THEN
       BEGIN
          -- Need to take into account the employees CONTINUOUS_SERVICE_DATE when calculating length of service
          BEGIN
          SELECT CONTINUOUS_SERVICE_DATE
            INTO v_empStartDate
            FROM person
             WHERE emp_no = v_empNo;
          EXCEPTION  
            WHEN NO_DATA_FOUND THEN
              v_empStartDate := NULL;
            WHEN OTHERS THEN
              raise_application_error(-20011,'Unknown Exception in MyGetAnnualHolidayEntitlement function.');
          END;
          -- If we can't get a CONTINUOUS_SERVICE_DATE we will fall back to PERSON.DATE_OF_START
          IF v_empStartDate IS NULL THEN
          BEGIN
             SELECT DATE_OF_START
               INTO v_empStartDate
               FROM PERSON
                WHERE emp_no = v_empNo;
          EXCEPTION  
            WHEN OTHERS THEN
              raise_application_error(-20011,'Unknown Exception in MyGetAnnualHolidayEntitlement function.');
          END;
          END IF;
       END;
       ELSE
       BEGIN
          -- Need to use employees DATE_OF_START when calculating length of service
          SELECT DATE_OF_START
            INTO v_empStartDate
            FROM PERSON
             WHERE emp_no = v_empNo;
       END;
       END IF;
       -- Now we can get length of service
       v_lengthOfService := sqlserver_utilities.datediff('MONTH', v_empStartDate, v_effectiveDate) / 12.00;
       OPEN holDefCursor;
       FETCH holDefCursor INTO v_selectedLOF,v_selectedDateEffective,v_selectedAmount;
       WHILE ( sqlserver_utilities.fetch_status(holDefCursor%FOUND) = 0 )
       LOOP
          BEGIN
             IF v_selectedDateEffective < v_effectiveDate THEN
                v_entitlement := v_selectedAmount;
             END IF;
             -- Get the next value.
             FETCH holDefCursor INTO v_selectedLOF,v_selectedDateEffective,v_selectedAmount;
          END;
       END LOOP;
       CLOSE holDefCursor;
       -- Return the result of the function
       RETURN v_entitlement;
    END;Edited by: user4395499 on 27-Oct-2008 04:04
    Edited by: user4395499 on 27-Oct-2008 04:05
    Edited by: user4395499 on 27-Oct-2008 07:10

    Your code is extremely procedural - whilst you could ultimately get it to work like this, it is not the most efficient way of doing it.
    You should think about reducing your code to one sql statement if at all possible - this reduces the amount of context switching that needs to take place (eg. Going from PL/SQL to SQL back to PL/SQL to SQL, etc) and is usually much easier to maintain and test. You could do this by joining the various tables together, (and you might want to think about using nvl() to combine the two queries on the PERSON table!).
    Also, you've labelled your parameters "v_" and your variables "v_" ... common convention uses "p_" for parameters, to allow for easy distinction between parameters passed in and variables declared during the course of the procedure/function.
    As to the char() defined column - is there any chance that you could change that? As you've found out, chars are usually not a good datatype to use! Storing numbers in a char/varchar2 column is a no-no too, as you then run the risk of having invalid numbers stored in the column.

  • Help with ORA 14400 error while inserting data

    Hi all,
    i am facing an ora 14400 error in the following scenario , please help.
    i have created a table using the syntax:
    CREATE TABLE temp_table
    GRPKEY NUMBER(20, 0) NOT NULL,
    UKEY NUMBER(10, 0),
    ANUM VARCHAR2(250 BYTE),
    APC VARCHAR2(2 BYTE),
    SID VARCHAR2(65 BYTE),
    RDATETIME VARCHAR2(19 BYTE),
    CKEY NUMBER(20, 0),
    AVER VARCHAR2(25 BYTE),
    CVER VARCHAR2(250 BYTE),
    TNAME VARCHAR2(50 BYTE),
    SCODE VARCHAR2(30 BYTE),
    PTYPE VARCHAR2(50 BYTE),
    FILENUMB NUMBER(10, 0),
    LINENUMB NUMBER(10, 0),
    ENTRY_CREATEDDATE DATE
    , CONSTRAINT temp_table_PK PRIMARY KEY (GRPKEY))
    PARTITION BY RANGE(ENTRY_CREATEDDATE)
    (PARTITION P0 VALUES LESS THAN(TO_DATE(' 2009-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    when i try to insert data using :
    insert into temp_table values
    (1,null,null,null,null,null,null,null,null,null,null,null,null,null,'01-NOV-2010');
    i get the following error output:
    Error report:
    SQL Error: ORA-14400: inserted partition key does not map to any partition
    14400. 00000 - "inserted partition key does not map to any partition"
    *Cause:    An attempt was made to insert a record into, a Range or Composite
    Range object, with a concatenated partition key that is beyond
    the concatenated partition bound list of the last partition -OR-
    An attempt was made to insert a record into a List object with
    a partition key that did not match the literal values specified
    for any of the partitions.
    *Action:   Do not insert the key. Or, add a partition capable of accepting
    the key, Or add values matching the key to a partition specification

    Hi Chaitanya,
    Change your table script to
    CREATE TABLE temp_table
    GRPKEY NUMBER(20, 0) NOT NULL,
    UKEY NUMBER(10, 0),
    ANUM VARCHAR2(250 BYTE),
    APC VARCHAR2(2 BYTE),
    SID VARCHAR2(65 BYTE),
    RDATETIME VARCHAR2(19 BYTE),
    CKEY NUMBER(20, 0),
    AVER VARCHAR2(25 BYTE),
    CVER VARCHAR2(250 BYTE),
    TNAME VARCHAR2(50 BYTE),
    SCODE VARCHAR2(30 BYTE),
    PTYPE VARCHAR2(50 BYTE),
    FILENUMB NUMBER(10, 0),
    LINENUMB NUMBER(10, 0),
    ENTRY_CREATEDDATE DATE
    , CONSTRAINT temp_table_PK PRIMARY KEY (GRPKEY))
    PARTITION BY RANGE(ENTRY_CREATEDDATE)
    (PARTITION P0 VALUES LESS THAN(TO_DATE(' 2009-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')),
    PARTITION P1 VALUES LESS THAN(MAXVALUE)
    insert into temp_table values
    (1,null,null,null,null,null,null,null,null,null,null,null,null,null,'01-NOV-2010');
    1 row insertedor refer question regarding "Date Partitioning a table"
    *009*
    Edited by: 009 on Nov 3, 2010 11:29 PM

  • Help with escape option in sql

    SQL> select sname from shares where sname like 'VIS_%';
    SNAME
    VISAKAIND
    VISASTEEL
    VISESHINFO
    VISHALEXPO
    VISHALRET
    VISUINTL
    VIS_SIN
    7 rows selected.
    SQL> select sname from shares where sname like 'VIS\_%';
    SNAME
    VISAKAIND
    VISASTEEL
    VISESHINFO
    VISHALEXPO
    VISHALRET
    VISUINTL
    VIS_SIN
    7 rows selected.
    SQL> select sname from shares where sname like 'VIS_\%';
    SNAME
    VISAKAIND
    VISASTEEL
    VISESHINFO
    VISHALEXPO
    VISHALRET
    VISUINTL
    VIS_SIN
    7 rows selected.
    could u people please help me to get the row with the sname vis_sin only....

    Hi Sybrand - here it is - please point to the error
    if you see it...
    Thanks.
    Connected to:
    Oracle Database 10g Enterprise Edition Release
    10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL> select table_name from dba_tables where
    table_name like 'PS\_%' and rownum<10 escape '\';
    select table_name from dba_tables where table_name
    like 'PS\_%' and rownum<10 escape '\'
    ERROR at line 1:
    ORA-00933: SQL command not properly endedselect table_name from dba_tables where table_name like 'PS\_%' escape '\' and rownum < 10;
    the 'escape' is part of the like condition so you need it contiguous to the like clause.

  • Need help with ORA-00936: missing expression

    11.2.0.3
    desc killsessionlog
    Name                                                  Null?    Type
    KILLTIME                                              NOT NULL DATE
    USERNAME                                              NOT NULL VARCHAR2(30)
    SID                                                   NOT NULL NUMBER
    SERIAL#                                               NOT NULL NUMBER
    CTIME                                                 NOT NULL NUMBER
    MACHINE                                                        VARCHAR2(64)
    TERMINAL                                                       VARCHAR2(30)
    PROGRAM                                                        VARCHAR2(48)
    ACTION                                                         VARCHAR2(64)
    MODULE                                                         VARCHAR2(64)want to test the code to kill the blocker
    SQL> create or replace procedure killblocker
      2  is
      3  stmt varchar2(1000);
      4  cursor c1 is
      5  select  s1.SQL_EXEC_START+l1.ctime killtime, s1.username,s1.sid,s1.serial#,l1.ctime ,s1.machine
    ,s1.TERMINAL, s1.PROGRAM,s1.ACTION,s1.MODULE
      6      from v$lock l1, v$session s1, v$lock l2, v$session s2
      7      where s1.sid=l1.sid and s2.sid=l2.sid
      8      and l1.BLOCK=1 and l2.request > 0
      9      and l1.id1 = l2.id1
    10      and l2.id2 = l2.id2
    11      and l1.ctime >0;
    12  begin
    13  for i in c1 loop
    14  EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION ''' || i.sid || ',' || i.serial# || '''';
    15  stmt := 'insert into killsessionlog values ('||i.killtime||','|| i.username||','||i.sid||','||i
    .serial#||','||i.ctime||','||i.machine||','||i.TERMINAL||','|| i.PROGRAM||','||i.ACTION||','||i.MODU
    LE||')'
    16  ;
    17  EXECUTE IMMEDIATE stmt;
    18  dbms_output.put_line('SID '||i.sid ||' with serial# '||i.serial#||' was killed');
    19    END LOOP;
    20  END;
    21  /
    Procedure created.created the blocker and blocked sessions.
    SQL> exec killblocker
    BEGIN killblocker; END;
    ERROR at line 1:
    ORA-00936: missing expression
    ORA-06512: at "NN.KILLBLOCKER", line 17
    ORA-06512: at line 1the first EXECUTE IMMEDIATE for killing the session worked, but the 2nd EXECUTE IMMEDIATE for the insert failed as above. Not able to figure the problem.
    TIA

    SQL> create or replace procedure killblocker
      2  is
      3  stmt varchar2(1000);
      4  cursor c1 is
      5  select  s1.SQL_EXEC_START+l1.ctime killtime, s1.username,s1.sid,s1.serial#,l1.ctime ,s1.machine
    ,s1.TERMINAL, s1.PROGRAM,s1.ACTION,s1.MODULE
      6      from v$lock l1, v$session s1, v$lock l2, v$session s2
      7      where s1.sid=l1.sid and s2.sid=l2.sid
      8      and l1.BLOCK=1 and l2.request > 0
      9      and l1.id1 = l2.id1
    10      and l2.id2 = l2.id2
    11      and l1.ctime >0;
    12  begin
    13  for i in c1 loop
    14  EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION ''' || i.sid || ',' || i.serial# || '''';
    15  stmt := 'insert into killsessionlog values (:killtime, :username, :sid, :serial#, :ctime, :machine, :TERMINAL, :PROGRAM, :ACTION, :MODULE)'
    16  ;
    17  EXECUTE IMMEDIATE stmt using i.killtime, i.username, i.sid, i.serial#, i.ctime, i.machine, i.TERMINAL, i.PROGRAM, i.ACTION, i.MODULE;
    18  dbms_output.put_line('SID '||i.sid ||' with serial# '||i.serial#||' was killed');
    19    END LOOP;
    20  END;
    21  / Gerard

  • Need Help with ORA-00604 - ORA-01219

    Hey i'm having a hard to understand the error messages generated by our Oracle database server. i'm in charge of the development of a .NET apps with an Oracle DB underneath.
    i tried to change the parameter values ( the java pool and the shared pool) and when i tried to apply the change from Enterprise manager the shutdown process didn't complete, the parameters values are all gone and i'm trying to log on thru SQL* Plus i'm getting the following errors
    ORA-00604 error occured at recusive SQL Level 1
    ORA-01219 database not open: queries allowed on fixed tables/views only
    is there a way to recover or to reload the previous parameters values? . i really need some help on this
    thanks in advance

    Take a look in the alert log for the database to see why the database did not open. The alert log can be found in ORACLE_BASE/admin/<dbsid>/bdump/alert_<dbsid>.log .
    You can try to open the database with the following:
    set ORACLE_SID=<dbsid>
    sqlplus /nolog
    connect / as sysdba
    alter database open;
    It is possible that the above will not open the database if there is something preventing the opening of the database. That information can be found in the alert log mentioned above.

  • Help with VARRAY in PL/SQL

    I wrote the below Stored Procedure in a package. I am not able to execute this, can anyone please help
    Package Definition:
    CREATE OR REPLACE PACKAGE "CDS_SUBLIMIT_TYPE_PKG" as
    TYPE COLLATERAL_ARRAY is VARRAY(100) OF NUMBER(29);
    procedure get_original_balance_array_p(in_collateral_id IN NUMBER, l_data OUT COLLATERAL_ARRAY );
    end CDS_SUBLIMIT_TYPE_PKG;
    Package Body:
    CREATE OR REPLACE PACKAGE BODY "CDS_SUBLIMIT_TYPE_PKG" as
    procedure get_original_balance_array_p
    (in_collateral_id IN NUMBER, l_data OUT COLLATERAL_ARRAY ) IS
    CURSOR c_collateral IS
    SELECT collateral_id FROM collateral where rownum < 10;
    BEGIN
    l_data:=COLLATERAL_ARRAY();
    FOR collateral_rec IN c_collateral LOOP
    l_data.extend;
    l_data(l_data.count):=collateral_rec.collateral_id;
    END LOOP;
    l_data.extend;
    l_data(l_data.count):=in_collateral_id;
    END get_original_balance_array_p;
    end CDS_SUBLIMIT_TYPE_PKG;
    Execution:
    declare
    collateral_id number;
    collectionId collateral_array;
    begin
    collateral_id:=55;
    CDS_SUBLIMIT_TYPE_PKG.get_original_balance_array_p(collateral_id, collectionId);
    end;

    collectionId collateral_array;You missed out the package name - it should be
    collectionId cds_sublimit_type_pkg.collateral_array;VARRAYs are good as multivalue columns in database tables, if you're into that (I'm not particularly). In PL/SQL code, nested tables have more functionality, especially in 10g.
    www.williamrobertson.net/documents/collection-types.html

  • Urgent help with ORA-01062: unable to allocate memory for define buffer

    Hello, Folks!
    I have a c++ code that is using OCI API that is running both in
    windows and in spark.
    (The same c++ code compiled and running in both platforms)
    and asking the same query.
    In windows, everything is OK but in spark
    it failes...
    The ORACLE Server is installed on win2003 station
    Both client and server ORACLE version is 10.2.0.1.0
    The code is running on spark(oracle instant client is installed)
    This query is a simple select query that selects only one field
    of type VARCHAR2(4000) (the same problem with happen with any
    string type field larger than 150 characters)
    The error occured when calling for OCIDefineByPos method
    when associating an item in a select-list with the type and output
    data buffer.
    The error message is: ORA-01062: unable to allocate memory for define
    buffer
    (This error message signifies that I need to use piecewise operation...)
    But it happens even if I make this varchar2 field to be of size larger
    than 150.
    It is not fair to use piecewise fetch for such a small fields sizes.
    May be there is not configuration setting that can enlarge this
    I know that I wrote here a very superficial description.
    If somebody knows something about this issue, please help
    Thanks

    I had a special luck today after searching the solution per weeks:)I have got a solution.
    When I get the size of the oci field, in the following expressioin
    l_nResult = OCIAttrGet(l_oParam->pOCIHandle(), OCI_DTYPE_PARAM, &(orFieldMD.m_nSize), NULL, OCI_ATTR_DATA_SIZE, m_oOCIErrInfo.pOCIError());
    orFieldMD.m_nSize was of type ub4 but according the manual it must be ub2.
    As a result, the number returned was very large (junk?) and I passed this value to OCIDefineByPos
    Now I changed the type and everything is working!!!
    In windows there is not problem with this expression :)
    Thanks
    Issahar

Maybe you are looking for