Using cursor inside other procedure

Hello,
I have a question, i have a procedure that have several IN parameters and one OUT sys_refcursor. i need to call this procedure from other procedure, and i need to use the values that cursor have it inside, for example, my cursor have 5 columns with several IDs and i need to use this ID and send it like XMLtype.
Is it possible to use the value from cursor??
Thank you.
Samm.
Edited by: Samm on Mar 10, 2009 2:37 PM

several variables?? how?
create or replace procedure test_out (pOutValue OUT sys_refcursor)
is
begin
   open pOutValue for select object_id,object_name,.... from all_objects where rownum < 10;
end;
declare
   l_Cursor     SYS_REFCURSOR;
   l_Object_id  number;
  l_object_name varchar2;
begin
   test_out(l_Cursor);
   loop
   fetch l_Cursor into l_Object_id *???????????!!!!!!!!!!!, how to fetch the object_name also?*
   exit when l_Cursor%notfound;
   end loop;
end;Edited by: Samm on Mar 10, 2009 4:04 PM

Similar Messages

  • Calling a procedure that returns a cursor inside a procedure

    Hi,
    I have two stored procedures. They both return a cursor as output variables. On the other hand I have another stored procedure that calls these procedures and return their results again an output variable. I know that this seems quite odd to be wanting to do something like this but how can I do that?

    You can make the hack generic. Make it execute any SQL as that schema that creates the ref cursor. E.g.
    // as schema BILLY, open a huge security hole and grant access to USER1
    SQL> create or replace procedure GetTableData( tableName varchar2, refCur out sys_refcursor ) authid definer is
      2          dynamicSQL      varchar2(32767);
      3  begin
      4          dynamicSQL := 'select * from '||tableName;
      5          open refCur for dynamicSQL;
      6  end;
      7  /
    Procedure created.
    SQL>
    SQL>
    SQL> grant execute on GetTableData to USER1;
    Grant succeeded.As USER1, you can now execute SQL (and even PL/SQL) as BILLY:
    SQL> create or replace type TStrings is table of varchar2(4000);
      2  /
    Type created.
    SQL> grant execute on TStrings to BILLY;
    Grant succeeded.
    SQL> --// execute this as the caller (which will be BILLY.GetTableData)
    SQL> create or replace procedure ExecSQL( hackSQL varchar2 ) authid current_user is
      2          pragma autonomous_transaction;
      3  begin
      4          execute immediate hackSQL;
      5          commit;
      6  end;
      7  /
    Procedure created.
    SQL> --// wrap the above into something that BILLY.GetData can execute as a ref cursor
    SQL> --// and return a meaningful message as to how successful the hack was
    SQL> create or replace function PipeLineHack( hackSQL varchar2 ) return TStrings authid current_user pipelined is
      2  begin
      3          ExecSQL(  hackSQL );
      4          pipe row( 'SQL hack successful' );
      5  exception when OTHERS then
      6          pipe row( 'SQL hack faled with '||SQLERRM(SQLCODE) );
      7  end;
      8  /
    Function created.
    SQL>
    SQL> grant execute on PipeLineHack to BILLY;
    Grant succeeded.
    SQL>
    SQL> var c refcursor
    SQL> --// expected used of the GetTableData() interface
    SQL> --// we select from table BILLY.EMP
    SQL> exec BILLY.GetTableData( 'EMP', :c );
    PL/SQL procedure successfully completed.
    SQL> print c
         EMPNO ENAME      JOB              MGR HIREDATE                   SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 1980/12/17 00:00:00        800          0         20
          7499 ALLEN      SALESMAN        7698 1981/02/20 00:00:00       1600        300         30
          7521 WARD       SALESMAN        7698 1981/02/22 00:00:00       1250        500         30
          7566 JONES      MANAGER         7839 1981/04/02 00:00:00       2975                    20
          7654 MARTIN     SALESMAN        7698 1981/09/28 00:00:00       1250       1400         30
          7698 BLAKE      MANAGER         7839 1981/05/01 00:00:00       2850                    30
          7782 CLARK      MANAGER         7839 1981/06/09 00:00:00       2450                    10
          7788 SCOTT      ANALYST         7566 1987/04/19 00:00:00       3000                    20
          7839 KING       PRESIDENT            1981/11/17 00:00:00       5000                    10
          7844 TURNER     SALESMAN        7698 1981/09/08 00:00:00       1500          0         30
          7876 ADAMS      CLERK           7788 1987/05/23 00:00:00       1100                    20
          7900 JAMES      CLERK           7698 1981/12/03 00:00:00        950                    30
          7902 FORD       ANALYST         7566 1981/12/03 00:00:00       3000                    20
          7934 MILLER     CLERK           7782 1982/01/23 00:00:00       1300                    10
    14 rows selected.
    SQL>
    SQL> --// getting that interface to run unexpected code - we
    SQL> --// rename BILLY.EMP table to something else
    SQL> exec BILLY.GetTableData( 'TABLE(USER1.PipeLineHack( ''alter table emp rename to emp_has_been_hacked''))', :c );
    PL/SQL procedure successfully completed.
    SQL> print c
    COLUMN_VALUE
    SQL hack successful
    SQL>

  • How to use &APP_ID. inside stored procedure.

    Hello, I have created one stored procedure. I am calling it from my process code. I want to use so many page variables like &APP_ID. I do not want to pass it as argument. Is it possible to use those variables without passing it in to procedure.? (&page_id. and also some application level variables )
    Any help is appreciated.
    Thank you.

    Ashif:
    The APEX documentation describes in detail the various ways of referencing APEX session state.
    http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10499/concept.htm#BEICHBBG
    Local variables declared in your process block are not available in APEX' session state. Hence you cannot refence such variables in a stored procedure.
    Varad

  • Cursor in stored procedure fails

    Hi,
    In our application we have a stored procedure which is called with in parameters to generate data into some table. This procedure is being called from another procedure.
    This procedure has been used to generate data into the table without any problem since oracle 9i. Last year we have upgraded to oracle 11g after that this procedure is failing intermittently to generate data. When this procedure is executed 50 times it fails atleast once to generate data. If we rerun the procedure for the failed case it generates the data without any change to program code nor any change in underlying data. It doesn't fail if we rerun. Therefore we are unable to simulate the problem.
    Procedure has got a very simple code.
    proc1 (p1 date,p2 date) is
    begin
    for c1_rec in c1 (select col1,col2
    from x,y where x.......)
    loop
    end loop;
    end;
    First we thought for some reason this procedure was not executed at all. But it is not the case. Actually it calls the procedure but the cursor inside the procedure doesn't fetch any records. Also it doesn't report any oracle error.
    Appreciate if any one can help me in this.
    Thanks & Regards,
    Raja

    vaidyanathanraja wrote:
    4. If there is a logical error, the same procedure should not generate data when it is rerun. Behaviour should be the same at all times.Incorrect. Something like NLS settings for example can make the same code, behave differently. E.g. a date string is passed and implicitly converted to a date. And this will work for most dates from different session using different NLS settings (e.g. yyyy/mm/dd versus yyyy/dd/mm). And these sessions will provide different results using the same parameters calling the same application code.
    There are a number of such run-time factors that influences code.
    5. Failed means it didn't generate the expected output. Which means that there is a problem with that SQL being executed the way it is, with the parameters used. You need to isolate the problem further.
    6. Parameter values are right.Have you proved that by using a test case that runs the very same SQL via a test proc, using the same parameter, via a job? Ran that test case interactively via sqlplus?
    You need to pop the hood and isolate the problem.
    7. I came across one blog saying different behaviour for REF CURSOR between oracle 10g and 11g and he says it is oracle bug. I don't know whether it is applicable for this case also.Bahumbug. There are many Oracle bugs. As there is in all software. However, you have not provided any evidence of a bug.
    Application code is behaving inconsistently. That is the symptom. Oracle system code is not relevant until you can prove that the inconsistency is not in the application code, but lower down the call stack.

  • Any way to use cursor values inside other cursor by bulk collect?

    hi,
    Is there any way to use cursor get_tables value insdide loop get column if i am using bulk collect in both cursors?
    I tried a lot but i am nt able to do it.kindly help...
    create or replace procedure MULTIPLE_CURSORS_PROC is
    v_owner varchar2(40);
    v_table_name varchar2(40);
    v_column_name varchar2(100);
    cursor get_tables is
    select distinct tbl.owner, tbl.table_name
    from all_tables tbl
    where tbl.owner = 'SYSTEM';
    cursor get_columns is
    select distinct col.column_name
    from all_tab_columns col
    where col.owner = v_owner
    and col.table_name = v_table_name;
    begin
    open get_tables;
    loop
    fetch get_tables into v_owner, v_table_name;
    open get_columns;
    loop
    fetch get_columns into v_column_name;
    end loop;
    close get_columns;
    end loop;
    close get_tables;
    end ;

    hi there
    Refer this
    CREATE OR REPLACE PROCEDURE MULTIPLE_CURSORS_PROC
    IS
       TYPE scol IS VARRAY (10000) OF VARCHAR2 (32767);
       v_table_name    scol;
       v_column_name   scol;
       TYPE curtyp IS REF CURSOR;
       get_columns     curtyp;
       CURSOR get_tables
       IS
          SELECT   DISTINCT tbl.table_name
            FROM   all_tables tbl
           WHERE   tbl.owner = 'SYSTEM';
    BEGIN
       OPEN get_tables;
       LOOP
          FETCH get_tables BULK COLLECT INTO   v_table_name;
          FOR indx IN v_table_name.FIRST .. v_table_name.LAST
          LOOP
             SELECT   DISTINCT col.column_name
               BULK   COLLECT
               INTO   v_column_name
               FROM   all_tab_columns col
              WHERE   col.table_name = v_table_name (indx);
             FOR ind IN v_column_name.FIRST .. v_column_name.LAST
             LOOP
                DBMS_OUTPUT.put_line (v_column_name (ind));
             END LOOP;
          END LOOP;
          EXIT WHEN get_tables%NOTFOUND;
       END LOOP;
       CLOSE get_tables;
    END MULTIPLE_CURSORS_PROC;regards
    Hitesh

  • Select clause inside a Procedure with cursor

    Good Moring guys,
    I run into a problem that is giving me serious troubles.... I have a Select clause:
                  SELECT count(*)
                 FROM TD004_ENT_ORGAO_UO TD004
                 WHERE TD004.CODG_ENTIDADE = 1121742
                 AND TD004.NUMR_ANO_EXERCICIO = 2011
                 AND TD004.CODG_ORGAO = 02
                 AND TD004.CODG_UO = 001
    My table is empty and this query returns a count = 0, so far so good but, when I'm using this same query inside a Procedure that implements a cursor, I'm implementing a way of controling when to or not insert the records of this cursor in my table:
    OPEN cDIMENSAO;
    LOOP
           FETCH cDIMENSAO INTO EXERCICIO, CODG_ORGAO, NOME_ORGAO, CODG_UO, NOME_UO, CODG_ENTIDADE, SK_ENTIDADE;
           EXIT WHEN cDIMENSAO%NOTFOUND;
           begin
                 v_count := 0;
                 SELECT count(*) into V_COUNT
                 FROM TD004_ENT_ORGAO_UO TD004
                 WHERE TD004.CODG_ENTIDADE = CODG_ENTIDADE
                 AND TD004.NUMR_ANO_EXERCICIO = EXERCICIO
                 AND TD004.CODG_ORGAO = CODG_ORGAO
                 AND TD004.CODG_UO = CODG_UO;
                 IF V_COUNT = 0 THEN
                    INSERT INTO APLIC.TD004_ENT_ORGAO_UO(SK_ENT_ORGAO_UO, NUMR_ANO_EXERCICIO, CODG_ORGAO, NOME_ORGAO, CODG_UO, NOME_UO, CODG_ENTIDADE, SK_ENTIDADE, DATA_CARGA)
                    VALUES (APLIC.SK004_ENT_ORGAO_UO.NEXTVAL, EXERCICIO, CODG_ORGAO, NOME_ORGAO, CODG_UO, NOME_UO,CODG_ENTIDADE,SK_ENTIDADE,v_data_carga);
                    COMMIT;
                 END IF;
    The problem occurs here, my v_count controler just returns 1 even if the record isnt inside my table, is like the Where clasue is being ignored. What can be done ??
    I'm using the Oracle XE 11g.
    Thnks all.

    See below. Where clause will never ignore any condition
    Note: you need handle null values  specially
    SQL>
    SQL> select * from v$version;
    BANNER                                                                         
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production   
    PL/SQL Release 11.2.0.2.0 - Production                                         
    CORE 11.2.0.2.0 Production                                                     
    TNS for Linux: Version 11.2.0.2.0 - Production                                 
    NLSRTL Version 11.2.0.2.0 - Production                                         
    SQL>
    SQL> set serveroutput on;
    SQL>
    SQL> DECLARE
      2     CURSOR c1
      3     IS
      4        WITH dmn
      5             AS (SELECT 1 col1, 'TEST' col2, NULL col3 FROM DUAL
      6             UNION ALL
      7                 SELECT 2 col1, 'TESTING' col2, 'COL3' col3 FROM DUAL
      8              UNION ALL
      9                 SELECT 3 col1, 'TESTING123' col2, 'COL3' col3 FROM DUAL
    10                )
    11        SELECT *
    12          FROM dmn;
    13 
    14     v_col1    VARCHAR2 (10);
    15     v_col2    VARCHAR2 (10);
    16     v_col3    VARCHAR2 (10);
    17     v_count   NUMBER;
    18  BEGIN
    19     OPEN c1;
    20 
    21     LOOP
    22        FETCH c1
    23        INTO v_col1, v_col2, v_col3;
    24        EXIT WHEN c1%NOTFOUND;
    25 
    26           WITH txn
    27             AS (SELECT 1 col1, 'TEST' col2, NULL col3 FROM DUAL
    28                 UNION ALL
    29                 SELECT 2 col1, 'TESTING' col2, 'COL3' col3 FROM DUAL
    30                )
    31        SELECT COUNT (*)
    32          INTO v_count
    33          FROM txn
    34         WHERE  col1 = v_col1
    35               AND col2 = v_col2
    36               AND nvl(col3,'##') = nvl(v_col3, '##');
    37 
    38           DBMS_OUTPUT.put_line ('V_count = ' || v_count);
    39        IF v_count = 0
    40        THEN
    41           DBMS_OUTPUT.put_line ('Insert is processed for ' || v_col1);
    42        ELSE
    43           DBMS_OUTPUT.put_line ('Insert is Ignored for ' || v_col1);
    44        END IF;
    45        v_count := 0;
    46     END LOOP;
    47  END;
    48  /
    V_count = 1                                                                    
    Insert is Ignored for 1                                                        
    V_count = 1                                                                    
    Insert is Ignored for 2                                                        
    V_count = 0                                                                    
    Insert is processed for 3                                                      
    PL/SQL procedure successfully completed.
    Thanks,
    GPU

  • Server Crashes when using Cursor Vars in Stored Procedure

    Can anyone make a suggestion
    We are experiencing a problem that causes our Weblogic Server to crash
    when a JDBC call is made to our Oracle database.
    Host Details
    Operating System: Solaris Version 8
    SunOS 5.8 Generic_108528-15 sun4u sparc SUNW,UltraAX-i2
    WebLogic Server 6.1 SP1 09/18/2001 14:28:44 #138716
    Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
    JDBC Driver Weblogic JDriver for Oracle
    The jdbc command that causes the problem is similar the spcursor
    example code file:
    // Here we prepare a CallableStatement using a WebLogic extension
    // to JDBC that supports binding an Oracle cursor to an output
    // parameter. Register the output parameter type as OTHER . . .
    cstmt =
         (weblogic.jdbc.common.OracleCallableStatement)conn.prepareCall("BEGIN
    OPEN ? FOR select * from emp; END;");
    cstmt.registerOutParameter(1, java.sql.Types.OTHER);
    The crash happens when the re.next() method is invoked after the
    execute()
    This is the core dump message that is generated:
    An unexpected exception has been detected in native code outside the
    VM.
    Unexpected Signal : 11 occurred at PC=0xd339f37c
    Function name=kpcxk2u
    Library=/u01/app/oracle/product/8.1.7/lib/libclntsh.so.8.0
    Current Java thread:
    at weblogic.db.oci.OciCursor.arrayFetch(Native Method)
    at weblogic.db.oci.OciCursor.oci_arrayFetch(OciCursor.java:2002)
    at weblogic.jdbc.oci.ResultSet.next(ResultSet.java:759)
    at weblogic.jdbc.pool.ResultSet.next(ResultSet.java:180)
    at weblogic.jdbc.rmi.internal.ResultSetImpl.next(ResultSetImpl.java:132)
    at weblogic.jdbc.rmi.internal.ResultSetImpl_WLSkel.invoke(Unknown
    Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:296)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:265)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    Dynamic libraries:
    0x10000 /opt/bea/jdk131/jre/bin/../bin/sparc/native_threads/java
    0xff350000 /usr/lib/libthread.so.1
    0xff390000 /usr/lib/libdl.so.1
    0xff200000 /usr/lib/libc.so.1
    0xff330000 /usr/platform/SUNW,UltraAX-i2/lib/libc_psr.so.1
    0xfe480000 /opt/bea/jdk131/jre/lib/sparc/hotspot/libjvm.so
    0xff2e0000 /usr/lib/libCrun.so.1
    0xff1e0000 /usr/lib/libsocket.so.1
    0xff100000 /usr/lib/libnsl.so.1
    0xff0d0000 /usr/lib/libm.so.1
    0xff310000 /usr/lib/libw.so.1
    0xff0b0000 /usr/lib/libmp.so.2
    0xff080000 /opt/bea/jdk131/jre/lib/sparc/native_threads/libhpi.so
    0xff050000 /opt/bea/jdk131/jre/lib/sparc/libverify.so
    0xfe440000 /opt/bea/jdk131/jre/lib/sparc/libjava.so
    0xff020000 /opt/bea/jdk131/jre/lib/sparc/libzip.so
    0xfe230000 /opt/bea/jdk131/jre/lib/sparc/libnet.so
    0xfe160000 /usr/lib/nss_files.so.1
    0xd3700000 /opt/bea/wlserver6.1/lib/solaris/oci817_8/libweblogicoci37.so
    0xd3000000 /u01/app/oracle/product/8.1.7/lib/libclntsh.so.8.0
    0xfd090000 /usr/lib/libC.so.5
    0xfd3b0000 /u01/app/oracle/product/8.1.7/lib/libwtc8.so
    0xfd070000 /usr/lib/libgen.so.1
    0xfd050000 /usr/lib/libsched.so.1
    0xfd020000 /usr/lib/libaio.so.1
    0xfafd0000 /opt/bea/wlserver6.1/lib/solaris/libmuxer.so
    Local Time = Thu Apr 3 10:39:37 2003
    Elapsed Time = 178
    # The exception above was detected in native code outside the VM
    # Java VM: Java HotSpot(TM) Client VM (1.3.1-b24 mixed mode)
    # An error report file has been saved as hs_err_pid7599.log.
    # Please refer to the file for further information.
    Abort - core dumped
    TIA
    Tony

    Tony,
    "Tony Ross" <[email protected]> wrote in message
    news:[email protected]...
    Thanks Mitesh for your response.
    We have followed your advice on using the 901 driver and updating the
    config.xml file. Alas it has not stopped the Solaris WLS from
    crashing.Actually, Mitesh sugested you replacing weblogic driver
    with oracle one. As it follows from the stacktrace, it has
    not been done.
    I'd also recommend moving to oracle thin driver as it
    doesn't have native code thus is more stable.
    Regards,
    Slava Imeshev
    In addition to this we tried using WLS 6.1 SP2 on a Win2000 box
    (connecting to same database). We managed to crash this instance as
    well. The core dump is as follows:
    An unexpected exception has been detected in native code outside the
    VM.
    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at
    PC=0x6021bc08
    Function name=kpcxk2u
    Library=C:\Oracle\Ora81\BIN\oracommon8.dll
    Current Java thread:
    at weblogic.db.oci.OciCursor.arrayFetch(Native Method)
    - locked <2956f78> (a weblogic.db.oci.OciCursor)
    at weblogic.db.oci.OciCursor.oci_arrayFetch(OciCursor.java:2022)
    at weblogic.jdbc.oci.ResultSet.next(ResultSet.java:759)
    - locked <3423480> (a weblogic.db.oci.OciConnection)
    at weblogic.jdbc.rmi.internal.ResultSetImpl.next(ResultSetImpl.java:133)
    at weblogic.jdbc.rmi.internal.ResultSetImpl_WLSkel.invoke(Unknown
    Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    atweblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
    atweblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:2
    2)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    Dynamic libraries:
    0x00400000 - 0x00405000 c:\bea\jdk131\bin\java.exe
    0x77F80000 - 0x77FFB000 C:\WINNT\System32\ntdll.dll
    0x77DB0000 - 0x77E0D000 C:\WINNT\system32\ADVAPI32.dll
    0x77E80000 - 0x77F36000 C:\WINNT\system32\KERNEL32.DLL
    0x77D30000 - 0x77DA1000 C:\WINNT\system32\RPCRT4.DLL
    0x78000000 - 0x78046000 C:\WINNT\system32\MSVCRT.dll
    0x6D420000 - 0x6D4EE000 c:\bea\jdk131\jre\bin\hotspot\jvm.dll
    0x77E10000 - 0x77E75000 C:\WINNT\system32\USER32.dll
    0x77F40000 - 0x77F7C000 C:\WINNT\system32\GDI32.DLL
    0x77570000 - 0x775A0000 C:\WINNT\System32\WINMM.dll
    0x6D220000 - 0x6D227000 c:\bea\jdk131\jre\bin\hpi.dll
    0x6D3B0000 - 0x6D3BD000 c:\bea\jdk131\jre\bin\verify.dll
    0x6D250000 - 0x6D266000 c:\bea\jdk131\jre\bin\java.dll
    0x6D3C0000 - 0x6D3CD000 c:\bea\jdk131\jre\bin\zip.dll
    0x6D2A0000 - 0x6D2BB000 c:\bea\jdk131\jre\bin\jdwp.dll
    0x6D1D0000 - 0x6D1D5000 c:\bea\jdk131\bin\dt_socket.dll
    0x75030000 - 0x75043000 C:\WINNT\System32\ws2_32.dll
    0x75020000 - 0x75028000 C:\WINNT\System32\WS2HELP.DLL
    0x74FD0000 - 0x74FED000 C:\WINNT\system32\msafd.dll
    0x75010000 - 0x75017000 C:\WINNT\System32\wshtcpip.dll
    0x6D340000 - 0x6D348000 C:\bea\jdk131\jre\bin\net.dll
    0x75050000 - 0x75058000 C:\WINNT\System32\WSOCK32.dll
    0x782C0000 - 0x782CC000 C:\WINNT\System32\rnr20.dll
    0x77980000 - 0x779A4000 C:\WINNT\System32\DNSAPI.DLL
    0x77340000 - 0x77353000 C:\WINNT\System32\iphlpapi.dll
    0x77520000 - 0x77525000 C:\WINNT\System32\ICMP.DLL
    0x77320000 - 0x77337000 C:\WINNT\System32\MPRAPI.DLL
    0x75150000 - 0x75160000 C:\WINNT\System32\SAMLIB.DLL
    0x75170000 - 0x751BF000 C:\WINNT\System32\NETAPI32.DLL
    0x77BE0000 - 0x77BEF000 C:\WINNT\System32\SECUR32.DLL
    0x751C0000 - 0x751C6000 C:\WINNT\System32\NETRAP.DLL
    0x77950000 - 0x7797A000 C:\WINNT\system32\WLDAP32.DLL
    0x77A50000 - 0x77B45000 C:\WINNT\system32\OLE32.DLL
    0x779B0000 - 0x77A4B000 C:\WINNT\system32\OLEAUT32.DLL
    0x773B0000 - 0x773DE000 C:\WINNT\System32\ACTIVEDS.DLL
    0x77380000 - 0x773A2000 C:\WINNT\System32\ADSLDPC.DLL
    0x77830000 - 0x7783E000 C:\WINNT\System32\RTUTILS.DLL
    0x77880000 - 0x7790D000 C:\WINNT\System32\SETUPAPI.DLL
    0x77C10000 - 0x77C6E000 C:\WINNT\System32\USERENV.DLL
    0x774E0000 - 0x77512000 C:\WINNT\System32\RASAPI32.DLL
    0x774C0000 - 0x774D1000 C:\WINNT\System32\RASMAN.DLL
    0x77530000 - 0x77552000 C:\WINNT\System32\TAPI32.DLL
    0x71730000 - 0x717BA000 C:\WINNT\system32\COMCTL32.DLL
    0x70BD0000 - 0x70C20000 C:\WINNT\system32\SHLWAPI.DLL
    0x77360000 - 0x77379000 C:\WINNT\System32\DHCPCSVC.DLL
    0x777E0000 - 0x777E8000 C:\WINNT\System32\winrnr.dll
    0x777F0000 - 0x777F5000 C:\WINNT\System32\rasadhlp.dll
    0x10000000 - 0x10055000
    C:\bea\wlserver6.1\bin\oci901_8\weblogicoci37.dll
    0x0DE20000 - 0x0DE3A000 C:\Oracle\Ora81\BIN\OCI.dll
    0x780A0000 - 0x780B2000 C:\WINNT\System32\MSVCIRT.dll
    0x60400000 - 0x60502000 C:\Oracle\Ora81\BIN\OraClient8.Dll
    0x60600000 - 0x60682000 C:\Oracle\Ora81\BIN\oracore8.dll
    0x60800000 - 0x60848000 C:\Oracle\Ora81\BIN\oranls8.dll
    0x0DE40000 - 0x0DE46000 C:\Oracle\Ora81\BIN\oravsn8.dll
    0x60200000 - 0x60264000 C:\Oracle\Ora81\BIN\oracommon8.dll
    0x60000000 - 0x6011F000 C:\Oracle\Ora81\BIN\orageneric8.dll
    0x60350000 - 0x60356000 C:\Oracle\Ora81\BIN\orawtc8.dll
    0x60A00000 - 0x60A2B000 C:\Oracle\Ora81\BIN\oranl8.dll
    0x60B00000 - 0x60BAA000 C:\Oracle\Ora81\BIN\oran8.dll
    0x60E00000 - 0x60E10000 C:\Oracle\Ora81\BIN\orancrypt8.dll
    0x61100000 - 0x61137000 C:\Oracle\Ora81\BIN\oranro8.dll
    0x0DE50000 - 0x0DEAE000 C:\Oracle\Ora81\BIN\orannzsbb8.dll
    0x61500000 - 0x6150E000 C:\Oracle\Ora81\BIN\oranldap8.dll
    0x61700000 - 0x6171C000 C:\Oracle\Ora81\BIN\oraldapclnt8.dll
    0x61900000 - 0x61906000 C:\Oracle\Ora81\BIN\oranhost8.dll
    0x62100000 - 0x62106000 C:\Oracle\Ora81\BIN\oranoname8.dll
    0x0DEB0000 - 0x0DEB6000 C:\Oracle\Ora81\BIN\orancds8.dll
    0x62300000 - 0x62306000 C:\Oracle\Ora81\BIN\orantns8.dll
    0x62500000 - 0x62508000 C:\Oracle\Ora81\BIN\orannds8.dll
    0x0DEC0000 - 0x0DEDC000 C:\Oracle\Ora81\BIN\orannms8.dll
    0x62700000 - 0x62741000 C:\Oracle\Ora81\BIN\ORATRACE8.dll
    0x62900000 - 0x62B1B000 C:\Oracle\Ora81\BIN\orapls8.dll
    0x63100000 - 0x63108000 C:\Oracle\Ora81\BIN\oraslax8.dll
    0x63200000 - 0x63272000 C:\Oracle\Ora81\BIN\orasql8.dll
    0x64700000 - 0x6470C000 C:\Oracle\Ora81\bin\orantcp8.dll
    0x64500000 - 0x6450D000 C:\Oracle\Ora81\bin\orannts8.dll
    0x75500000 - 0x75504000 C:\WINNT\System32\security.dll
    0x782D0000 - 0x782EE000 C:\WINNT\system32\msv1_0.dll
    0x11260000 - 0x11265000 C:\bea\wlserver6.1\bin\wlntio.dll
    0x77920000 - 0x77943000 C:\WINNT\system32\imagehlp.dll
    0x72A00000 - 0x72A2D000 C:\WINNT\system32\DBGHELP.dll
    0x690A0000 - 0x690AB000 C:\WINNT\System32\PSAPI.DLL
    Local Time = Thu Apr 03 17:31:00 2003
    Elapsed Time = 327
    # The exception above was detected in native code outside the VM
    # Java VM: Java HotSpot(TM) Client VM (1.3.1_01 interpreted mode)
    So now we have a situation where - we can crash either server with a
    call to a function. We can now run the spcursors.java example without
    problem. The procedure that does crash the WLS can be run successfully
    from within sqlplus (it involves multiple subqueries and outer joins).
    FYI - the cursors we are returning in the function are weak cursor
    types (TYPE ref_cursor IS REF CURSOR)
    Any other suggestions greatly welcomed.
    Tony
    Mitesh Patel <[email protected]> wrote in message
    news:<[email protected]>...
    Please do the following:
    Make sure you have login delay sec=1 for connection pool in config.xml
    Should have TestConnOnReserve=true
    and use 901 driver instead of 817 driver. Using suggested driver, stillyou can connect to
    your original database.
    Thanks,
    Mitesh
    Tony Ross wrote:
    Can anyone make a suggestion
    We are experiencing a problem that causes our Weblogic Server to crash
    when a JDBC call is made to our Oracle database.
    Host Details
    Operating System: Solaris Version 8
    SunOS 5.8 Generic_108528-15 sun4u sparc SUNW,UltraAX-i2
    WebLogic Server 6.1 SP1 09/18/2001 14:28:44 #138716
    Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
    JDBC Driver Weblogic JDriver for Oracle
    The jdbc command that causes the problem is similar the spcursor
    example code file:
    // Here we prepare a CallableStatement using a WebLogic extension
    // to JDBC that supports binding an Oracle cursor to an output
    // parameter. Register the output parameter type as OTHER . . .
    cstmt =
    (weblogic.jdbc.common.OracleCallableStatement)conn.prepareCall("BEGIN
    OPEN ? FOR select * from emp; END;");
    cstmt.registerOutParameter(1, java.sql.Types.OTHER);
    The crash happens when the re.next() method is invoked after the
    execute()
    This is the core dump message that is generated:
    An unexpected exception has been detected in native code outside the
    VM.
    Unexpected Signal : 11 occurred at PC=0xd339f37c
    Function name=kpcxk2u
    Library=/u01/app/oracle/product/8.1.7/lib/libclntsh.so.8.0
    Current Java thread:
    at weblogic.db.oci.OciCursor.arrayFetch(Native Method)
    atweblogic.db.oci.OciCursor.oci_arrayFetch(OciCursor.java:2002)
    at weblogic.jdbc.oci.ResultSet.next(ResultSet.java:759)
    at weblogic.jdbc.pool.ResultSet.next(ResultSet.java:180)
    atweblogic.jdbc.rmi.internal.ResultSetImpl.next(ResultSetImpl.java:132)
    atweblogic.jdbc.rmi.internal.ResultSetImpl_WLSkel.invoke(Unknown
    Source)
    atweblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:296)
    atweblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:265)
    atweblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:
    atweblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    Dynamic libraries:
    0x10000/opt/bea/jdk131/jre/bin/../bin/sparc/native_threads/java
    0xff350000 /usr/lib/libthread.so.1
    0xff390000 /usr/lib/libdl.so.1
    0xff200000 /usr/lib/libc.so.1
    0xff330000 /usr/platform/SUNW,UltraAX-i2/lib/libc_psr.so.1
    0xfe480000 /opt/bea/jdk131/jre/lib/sparc/hotspot/libjvm.so
    0xff2e0000 /usr/lib/libCrun.so.1
    0xff1e0000 /usr/lib/libsocket.so.1
    0xff100000 /usr/lib/libnsl.so.1
    0xff0d0000 /usr/lib/libm.so.1
    0xff310000 /usr/lib/libw.so.1
    0xff0b0000 /usr/lib/libmp.so.2
    0xff080000 /opt/bea/jdk131/jre/lib/sparc/native_threads/libhpi.so
    0xff050000 /opt/bea/jdk131/jre/lib/sparc/libverify.so
    0xfe440000 /opt/bea/jdk131/jre/lib/sparc/libjava.so
    0xff020000 /opt/bea/jdk131/jre/lib/sparc/libzip.so
    0xfe230000 /opt/bea/jdk131/jre/lib/sparc/libnet.so
    0xfe160000 /usr/lib/nss_files.so.1
    0xd3700000/opt/bea/wlserver6.1/lib/solaris/oci817_8/libweblogicoci37.so
    0xd3000000 /u01/app/oracle/product/8.1.7/lib/libclntsh.so.8.0
    0xfd090000 /usr/lib/libC.so.5
    0xfd3b0000 /u01/app/oracle/product/8.1.7/lib/libwtc8.so
    0xfd070000 /usr/lib/libgen.so.1
    0xfd050000 /usr/lib/libsched.so.1
    0xfd020000 /usr/lib/libaio.so.1
    0xfafd0000 /opt/bea/wlserver6.1/lib/solaris/libmuxer.so
    Local Time = Thu Apr 3 10:39:37 2003
    Elapsed Time = 178
    # The exception above was detected in native code outside the VM
    # Java VM: Java HotSpot(TM) Client VM (1.3.1-b24 mixed mode)
    # An error report file has been saved as hs_err_pid7599.log.
    # Please refer to the file for further information.
    Abort - core dumped
    TIA
    Tony

  • How to return a resultset in a stored procedure without using Cursor

    Dear all,
    I need to return a resultset in a stored procedure.
    I know I can return a Cursor.
    But because there are many complicate logics I need to carry out,
    so I can finish all the logic in a SINGLE SQL select statement, so I think it can't
    use Cursor as return value.
    Does anybody know other approaches? Please help.
    Thanks!

    Some basic techniques that one can use in SQL. These are merely to illustrate (simplistically) different approaches.
    > field3 = select count(*) from table2,table1 where table2.id = table1.id
    This can be done via an analytical function (refer to the SQL Reference) or very simply, as an in-line select as follows:
    SQL> select
    2 o.object_name,
    3 (select count(*) from user_objects u where u.object_type = o.object_type) as "ONE OF",
    4 o.object_type
    5 from user_objects o
    6 where o.object_name = 'LISTFILES';
    OBJECT_NAME ONE OF OBJECT_TYPE
    LISTFILES 8 PROCEDURE
    So LISTFILE is "one of 8" procedures. I would however rather so this via an analytic function as these are a lot more flexible. Note the WITH clause that allows "modularisation" of SQL - kind of like creating "sub-SQL results" in a single SQL statement:
    SQL> with DATASET1 as(
    2 select
    3 object_name,
    4 count(distinct object_name) over (partition by object_type) as TOTAL_TYPES,
    5 object_type
    6 from user_objects
    7 ),
    8 DATASET2 as(
    9 select
    10 name,
    11 text as SOURCE_LINE,
    12 line as LINE_NO,
    13 count(line) over (partition by name) as TOTAL_LINES
    14 from user_source
    15 )
    16 select
    17 object_name,
    18 '1 of '||total_types||' '||object_type as "TYPE",
    19 source_line as "1st LINE",
    20 total_lines as "TOTAL LINES"
    21 from DATASET1 ds1,
    22 DATASET2 ds2
    23 where ds1.object_name = ds2.name
    24 and ds1.object_name = 'LISTFILES'
    25* and ds2.line_no = 1
    SQL> /
    OBJECT_NAME TYPE 1st LINE TOTAL LINES
    LISTFILES 1 of 8 PROCEDURE procedure ListFiles( cDirectory in varchar2 ) 3
    SQL>
    SQL is quite powerful and analytical functions allows all kinds of aggregation processing per row, accessing the leading or lagging rows' data, etc.
    You need to play around with this to get to grips with it and how to apply it.

  • Can we define cursors from in procedure while using .procedure file?

    Hi Team,
    Can we define cursors from in procedure while using .procedure file?
    I have a catalog procedure in which am using cursors and it is working fine. But while trying to create the same procedure using .procedure , the validation is failing with "An error occurred while parsing your procedure".
    Request your suggestions.
    Regards,
    Krishna Tangudu

    Hi Krishna,
    I also tried to find the validation for procedure and failed. What was on my mind when I posted earlier was related to Window -> Properties -> SAP HANA -> Modeler -> Validation Rules but this is not the same for procedure.
    Also the validation error seems to not being raised by Studio but the server, so it's not a frontend validation anyway.
    Trying to replicate your error I create two procedures here and both worked fine with cursor.
    The behavior you found was the same I found, the .procedure goes to repository and _SYS_BIC after activation and .hdbprocedure goes to catalog only.
    As far as I understood as you are moving from catalog (manually) and it worked on catalog (.hdbprocedure), I could check the declaration of table types of header as it's the main difference.
    Despite this investigation of declaration, you can try create it on modeler direct and see what you found on .procedure created. This can speed up investigation.
    Regards, Fernando Da Rós
    BTW: I'm faced an very strange behavior that each caracter I type on .procedure or .hdbprocedure freezes studio by around 15 seconds ?!?!?!?! (studio rev73)

  • How to create store procedure using cursor, and looping condition with exce

    Hi,
    I am new in pl/sql development , please help me for follwoing
    1. I have select query by joining few tables which returns lets say 100 records.
    2. I want to insert records into another table(lets say table name is tbl_sale).
    3. If first record is inserted into tbl_sale,and for next record if value is same as first then update into tbl_sale else
    insert new row
    4. I want to achieve this using store procedure.
    Please help me how to do looping,how to use cursor and all other necessary thing to achieve this.

    DECLARE
       b   NUMBER;
    BEGIN
       UPDATE tbl_sale
          SET a = b
        WHERE a = 1;
       IF SQL%ROWCOUNT = 0
       THEN
          INSERT INTO tbl_sale
                      (a
               VALUES (b
       END IF;
    END;note : handle exceptions where ever needed
    Regards,
    friend
    Edited by: most wanted!!!! on Mar 18, 2013 12:06 AM

  • Re : When to Use tables instead of Cursors in Stores Procedures

    Hello All,
    Hope all is well. I know this is very broad questions and requires more specifics. All, I am trying to understand from very high level is to what are some of the instances when one would prefer to have physical/temp tables instead of using cursors in SP. Generic Pointers would really be helpful.
    Thanks in advance,
    Sam

    You are comparing apples and oranges here.
    A cursor is a work area where oracle stores the procession information when it executes a multi-row query.
    Lets say you have a sql query like this
    select * from empWhen such a query is executed oracle allocates a work area where the processing information of the query is stored. This
    is called a cursor. You can explicitly define a cursor like this.
    cursor c_emp
    is
    select * from empIn this case you are giving a name to the work area allocated by oracle. Now you can use this name c_emp to access the
    result set sequentially.
    On the other hand a Table is an oracle Object. It is a logical representation of your physical data.
    Data in a table can be manipulated meaning, you can insert, update or delete it. Data in a table is persistent.
    So i don't think a comparison between this two is appropriate.
    Thanks,
    Karthick.

  • Use database inside a stored procedure

    Hi guys, a stupid question: I'm working with several database and sometimes I'm afraid to run an alter or a create something in the wrong database, bear in mind that several database have the same tables. Sometime happens to run a query oin the db A
    instead in the db B. So, the question: If I create a procedure like this,
    create procedure creatingPillar as
    use USA
    begin
    IF EXISTS (SELECT * FROM sys.objects WHERE object_id =
    OBJECT_ID(N'pillarretail') AND type in (N'U'))
    DROP TABLE PillarRetail
    create table PillarRetail (anid int , ancore varchar(20), period dec(18,6), settlem datetime2,
    settlementper int, asf dec(18,6),astlf dec (18,6), tot dec (18,6) )
    insert into PillarRetail select anid, ancore, Period, settlem, settlementper,
    asf, astlf, tot from createsemipillar2011
    insert into PillarRetail select select anid, ancore, Period, settlem, settlementper,
    asf, astlf, tot createsemipillar
    end
    but I'm wondering if is useless to put the use USA in the stored procedure by the moment that I'm creating the procedure in USA. I mean, having the SP in the USA db even if I run the procedure from another db it should run in USA. Just a stupid question
    I know but I got this doubt...
    Thanks 

    You may try as below:
    create proc as below: (This will create the proc in USA database.
    use USA
    Go
    create procedure dbo.creatingPillar as
    begin
    IF EXISTS (SELECT * FROM sys.objects WHERE object_id =
    OBJECT_ID(N'pillarretail') AND type in (N'U'))
    DROP TABLE PillarRetail
    create table PillarRetail (anid int , ancore varchar(20), period dec(18,6), settlem datetime2,
    settlementper int, asf dec(18,6),astlf dec (18,6), tot dec (18,6) )
    insert into PillarRetail select anid, ancore, Period, settlem, settlementper,
    asf, astlf, tot from createsemipillar2011
    insert into PillarRetail select select anid, ancore, Period, settlem, settlementper,
    asf, astlf, tot createsemipillar
    end
    Then you can call as below:
    Exec USA.dbo.creatingPillar

  • Question about using cursor

    My question is about performance:
    If I have a java program to call a stored procedure using a cursor, the code segment is like this:
    ResultSet rs = oracleCallableStatement.getObject(a_cursor);
    while (rs.hasNext()) {
    rs.getString(column_name);
    My question is -- how does this work behind scene? Would my java process talk to oracle to get the next record for EACH call inside the while loop? If yes, this seems to slow down my program and we should avoid using cursor.
    Thanks in advance for any reply.
    tom

    Victor,
    Is there something similar using PL/SQL, we use a gateway connection to AS400. I see that a PL/SQL cursor is fetching as many times as there are number of rows.
    Thanks for your help in advance.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Victor Yu ([email protected]):
    Hi, Tom,
    Actually, Oracle JDBC will cache some rows in client side to reduce the round trip. It's called prefetching. Once your next() calls have run through those rows, JDBC will go back to fetch the next N rows. The default number of rows to prefetch to the client is 10. If your cursor return a lot of rows, say 1000 or more, you can change the number of rows to prefetch. Use the setRowPrefetch() method at the Statement level or setDefaultRowPrefetch() at the Connection level.<HR></BLOCKQUOTE>
    null

  • Cursor inside DBMS_XMLGen.newContext SetRowTag?

    Hi,
    I have the following code
    v_ctx := DBMS_XMLGen.newContext('select ' || chr(39) || 'F5' || chr(39) || ' as "sender",
                                            payloadid as "messageId",
                                            ordernumber as "orderNumber",
                                            recordtype as "recordType",
                                            billtoid as "billToId",
                                            shiptoid as "shipToId",
                                            shipperid as "shipperId",
                                            shipfromid as "shipFromId",
                                            currency as "currency",
                                            siteid as "siteId",
                                            carrierid as "carrierId",
                                            forwarderid as "forwarderId",
                                            flexcharacterattr7 as "flexCharacterAttr7",
                             hazardousindicator as "hazardousIndicator",
                                            motcode as "motCode",
                                            enduserid as "endUserId",
                                            orderdate as "orderDate",
                                            paymentterm as "paymentTerm",
                                            routedexportindicator as "routedExportIndicator",
                                            cursor(select linenumber as "lineNumber"
                                                     from f5_ec_order_ln_out b
                                                    where b.ordernumber = a.ordernumber) "lineRequest" 
                                       from f5_ec_order_hdr_out a
                                      where payloadid = 15');
    DBMS_XMLGen.setRowsetTag(v_ctx, 'orderRequest');
    DBMS_XMLGen.setRowTag(v_ctx, 'headerRequest');This is returning rows with a Row tag
    <lineRequest>
    <lineRequest_ROW>
    <lineNumber>1078</lineNumber>
    </lineRequest_ROW>
    <lineRequest_ROW>
    <lineNumber>1079</lineNumber>Is there any sort of command like
    DBMS_XMLGen.setRowTag(v_ctx, 'headerRequest');
    for a cursor inside this statement are there any like routines like
    DBMS_XMLGen.setRowsetTag(v_ctx, 'orderRequest');
    DBMS_XMLGen.setRowTag(v_ctx, 'headerRequest');
    for the cursor part inside or do I need to simply use a replace on my XML after?
    Thanks in advance!

    You can use xmlagg instead of the inner cursor:
    SQL> declare
      2   v_ctx dbms_xmlgen.ctxHandle;
      3   x varchar2(2000);
      4  begin
      5    v_ctx := DBMS_XMLGen.newContext('select dname ,
      6                                            (select xmlagg(xmlelement("lineNumber",ename))
      7                                                   from emp b
      8                                                  where b.deptno = a.deptno) "lineRequest"
      9                                     from dept a');
    10  
    11    DBMS_XMLGen.setRowsetTag(v_ctx, 'orderRequest');
    12    DBMS_XMLGen.setRowTag(v_ctx, 'headerRequest');
    13    x := dbms_xmlgen.getxml(v_ctx);
    14    dbms_output.put_line(x);
    15  end;
    16  /
    <?xml version="1.0"?>
    <orderRequest>
    <headerRequest>
    <DNAME>ACCOUNTING</DNAME>
      <lineRequest>
    <lineNumber>CLARK</lineNumber><lineNumber>KING</lineNumber><lineNumber>MILLER</lineNumber>  </lineRequest>
    </headerRequest>
    <headerRequest>
    <DNAME>RESEARCH</DNAME>
      <lineRequest>
    <lineNumber>SMITH</lineNumber><lineNumber>JONES</lineNumber><lineNumber>SCOTT</lineNumber><lineNumber>ADAMS</lineNumber><lineNumber>FORD</lineNumber>
    </lineRequest>
    </headerRequest>
    <headerRequest>
      <DNAME>SALES</DNAME>
    <lineRequest>
    <lineNumber>ALLEN</lineNumber><lineNumber>WARD</lineNumber><lineNumber>MARTIN</lineNumber><lineNumber>BLAKE</lineNumber><lineNumber>TURNER</lineNumber><lineNumber>JAMES</lineNumber>  </lineRequest>
    </headerRequest>
    <headerRequest>
    <DNAME>OPERATIONS</DNAME>
    </headerRequest>
    </orderRequest>
    PL/SQL procedure successfully completed.Max
    http://oracleitalia.wordpress.com

  • How to pick max value from a column of a table using cursor and iteration

    Hello Everybody
    I have a table loan_detail
    and a column in it loan_amount
    now i want to pick values from this table using cursor and then by using iteration i want to pick max value from it using that cursor
    here is my table
    LOAN_AMOUNT
    100
    200
    300
    400
    500
    5600
    700i was able to do it using simple loop concepts but when i was trying to do this by using cursor i was not able to do it .
    Regards
    Peeyush

    SQL> SELECT MAX(sal) Highest_Sal,MIN(sal) Lowest_Sal FROM emp;
    HIGHEST_SAL LOWEST_SAL
           5000        800
    SQL> set serverout on
    SQL> DECLARE
      2    TYPE tmp_tbl IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
      3    sal_tbl tmp_tbl;
      4    CURSOR emp_sal IS
      5      SELECT sal FROM emp;
      6    counter INTEGER := 1;
      7  BEGIN
      8    FOR i IN emp_sal LOOP
      9      sal_tbl(i.sal) := counter;
    10      counter := counter + 1;
    11    END LOOP;
    12    DBMS_OUTPUT.put_line('Lowest SAL:' || sal_tbl.FIRST);
    13    DBMS_OUTPUT.put_line('Highest SAL:' || sal_tbl.LAST);
    14  END;
    15  /
    Lowest SAL:800
    Highest SAL:5000
    PL/SQL procedure successfully completed.
    SQL> Even smaller
    SQL> DECLARE
      2    TYPE tmp_tbl IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
      3    sal_tbl tmp_tbl;
      4    CURSOR emp_sal IS
      5      SELECT sal FROM emp;
      6    counter INTEGER := 1;
      7  BEGIN
      8    FOR i IN emp_sal LOOP
      9      sal_tbl(i.sal) := 1;
    10    END LOOP;
    11    DBMS_OUTPUT.put_line('Lowest SAL:' || sal_tbl.FIRST);
    12    DBMS_OUTPUT.put_line('Highest SAL:' || sal_tbl.LAST);
    13  END;
    14  /
    Lowest SAL:800
    Highest SAL:5000
    PL/SQL procedure successfully completed.
    SQL> Edited by: Saubhik on Jan 5, 2011 4:41 PM

Maybe you are looking for

  • Maximum file size for email iCloud, maximum file size for email iCloud

    Where can I find the maximum file /photo att. size in my icloud email

  • Dynamically creating variable names in javascript

    Hi. I have to create variable names dynamically in JavaScript. My JSP file accesses information from Database and forms a String corresponding to the information received. This String is passed to a JAvaScript function that should CREATE a variable w

  • How to rebuild index in E-Business

    Hi As on core DB side we can check index status for rebuild with command select owner,index_name,blevel,last_analyzed from dba_indexes where blevel>3 order by last_analyzed and after that alter index <index_name> rebuild compute statistics; my questi

  • Best Location for Deploying Common File in WSP

    I have a small wsp containing a masterpage and a stylesheet that will act as the standard branding for many SP site collections in my company.  One of the requirements is to have a footer with a link to a Terms & Conditions PDF in the masterpage.  So

  • Order operation change

    Hi, I must modify order operation. Have you a sample program with function 'IBAPI_ORDER_OPERATION_CHANGE'? Thanx in advance. CV