How to type cast PL/SQL table to REF cursor?

any one knows how to CAST PL/SQl table to Ref cursor?
eg
procedure some_name(r_out out sys_refcurosr)
IS
type t is table of tab%ROWTYPE;
my_type t;
begin
select * bulk collect into my_type from tab;
r_out := my_type; -- need help here..
end;
it's 10g

ref cursor is pointer to result set. You can not cast to PL/SQL table.
1 create or replace procedure some_name(r_out out sys_refcursor)
2 IS
3 begin
4 OPEN r_out for select * from emp;
5* end;
SQL> /
Procedure created.
SQL> var mycursor refcursor;
SQL> exec some_name(:mycursor);
PL/SQL procedure successfully completed.
SQL> set linesize 2000
SQL> print :mycursor;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 12/17/80 00:00:00 800 20
7499 ALLEN SALESMAN 7698 02/20/81 00:00:00 1600 300 30
7521 WARD SALESMAN 7698 02/22/81 00:00:00 1250 500 30
7566 JONES MANAGER 7839 04/02/81 00:00:00 2975 20
7654 MARTIN SALESMAN 7698 09/28/81 00:00:00 1250 1400 30
7698 BLAKE MANAGER 7839 05/01/81 00:00:00 2850 30
7782 CLARK MANAGER 7839 06/09/81 00:00:00 2450 10
7788 SCOTT ANALYST 7566 04/19/87 00:00:00 3000 20
7839 KING PRESIDENT 11/17/81 00:00:00 5000 10
7844 TURNER SALESMAN 7698 09/08/81 00:00:00 1500 0 30
7876 ADAMS CLERK 7788 05/23/87 00:00:00 1100 20
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7900 JAMES CLERK 7698 12/03/81 00:00:00 950 30
7902 FORD ANALYST 7566 12/03/81 00:00:00 3000 20
7934 MILLER CLERK 7782 01/23/82 00:00:00 1300 10
14 rows selected.

Similar Messages

  • How to join two pl/sql tables .,.,,Urgent pls help

    Hi,
    Please tell me how to join to pl/sql tables with example
    thanks
    asp

    If your main intention is to get the common records/or getting whole records from the 2 different pl/sql arrays then , pls check this piece of code & explanation
    The SQL language has long offered the ability to apply set operations (UNION, INTERSECT, and MINUS) to the result sets of queries. In Oracle Database 10g, you can now use those same high-level, very powerful operators against nested tables (and only nested tables) in your PL/SQL programs and on nested tables declared as columns inside relational tables.
    Let's take a look at some of the syntax needed to do this, starting with UNION.
    First, I create a schema-level nested table type:
    CREATE OR REPLACE TYPE strings_nt
    IS TABLE OF VARCHAR2(100);
    Then I define a package and within it create and populate two nested tables of this type, each containing some of my father's and my favorite things:
    CREATE OR REPLACE PACKAGE favorites_pkg
    IS
    my_favorites strings_nt
    := strings_nt ('CHOCOLATE'
    , 'BRUSSEL SPROUTS'
    , 'SPIDER ROLL'
    dad_favorites strings_nt
    := strings_nt ('PICKLED HERRING
    , 'POTATOES'
    , 'PASTRAMI'
    , 'CHOCOLATE'
    PROCEDURE show_favorites (
    title_in IN VARCHAR2
    , favs_in IN strings_nt
    END;
    In this package, I also include a procedure to show the contents of a strings_nt nested table. This will come in very handy shortly.
    By defining these collections in a package, outside any program, they persist (they maintain their state and values) for the duration of my session or until I change or delete them. This means that I can now write programs outside the package to manipulate the contents of those collections.
    Note that this package has been simplified for the purposes of presenting collection functionality. In a production application, you should always take care to "hide" your package data, as with these collections, in the package body, and then provide procedures and functions to manage the data.
    Suppose, for example, that I would like to combine these two collections into a single collection of our favorites. Prior to Oracle Database 10g, I would have to write a loop that transfers the contents of one collection to another. Now, I can rely on the MULTISET UNION operator, as shown below:
    DECLARE
    our_favorites
    strings_nt := strings_nt ();
    BEGIN
    our_favorites :=
    favorites_pkg.my_favorites
    MULTISET UNION ---- Use INTERSECT , if you want to know common records
    favorites_pkg.dad_favorites;
    favorites_pkg.show_favorites (
    'ME then DAD', our_favorites);
    END;
    The output from this script is:
    ME then DAD
    1 = CHOCOLATE
    2 = BRUSSEL SPROUTS
    3 = SPIDER ROLL
    4 = PICKLED HERRING
    5 = POTATOES
    6 = PASTRAMI
    7 = CHOCOLATE
    ------------------------------

  • How to import XML into SQL Table

    Dear all,
    There are a lot of books about exporting data into XML format.
    Actually, how to use XML Documents? Sorry I am new that I ask such a question.
    What i think may be exchange or save data using xml. If so, How to import into MS SQL table? Do it need to do any mapping?
    Appreciate for your hints

    Are you sure you want to use XML with tables for this? No doubt importing XML into tables is useful for some specialized tasks, such as importing formatting information inside the XML itself, but for most of the familiar tasks that XML excels at, tables are neither necessary nor useful.
    In my (limited) experience, if the XML elements are well-differentiated, by which I mean different types of data have their own distinctive tags, then the special powers of XML can be exploited more fully using the more familiar tagged text, nested tags etc. in ordinary text frames using paragraph breaks, tab characters, etc. to achieve a suitably "tabular" finished appearance.
    If you must import XML into tables, I recommend Adobe's own PDF "Adobe InDesign CS3 and XML: A Technical Reference" availabe here:
    http://www.adobe.com/designcenter/indesign/articles/indcs3ip_xmlrules.pdf
    It sounds very daunting -- the words "technical reference" make me shudder -- but actually it's very readable and not very technical at all. Some nice pics and everything!
    Jeremy

  • How to fetch NO DATA FOUND exception in Ref Cursor.

    In my procedure ref cursor is out parameter with returns dataset. in my proceudre
    its like...
    OPEN pPymtCur FOR
    select.....
    when I call this procedure from report to get dataset it causes NO DATA FOUND exception.
    How to fetch this exception in my oracle procedure so I can get some other data.
    Any Idea to do this?
    Edited by: Meghna on 17-Jun-2009 22:28

    Mass25 wrote:
    Correct me if I am wrong.
    So if I do something as follows in my stored proc, I do not have to check for NO_DATA_FOUND?
    OPEN my_CuRSR FOR
          SELECT DISTINCT blah blah blahmy_cursr is what I am returning as OUT param in my SP.Correct. At the point you open the cursor, oracle has not attempted any 'fetch' against the data so it won't know if there is any data or no data. that only occurs when a fetch is attempted.
    Take a read of this:
    [PL/SQL 101 : Understanding Ref Cursors|http://forums.oracle.com/forums/thread.jspa?threadID=886365&tstart=0]

  • How to sort index_by pl/sql tables data in Oracle 9i Release 9.2.0.1.0 ?

    Hi all,
    I have populated an index_by binary_integer pl/sql table :
    declare
    type rec_ty is record(ligne number,code_enreg number(2),code_enreg_ordered number(2));
         type tab_ty is table of rec_ty index by binary_integer;
         vtab tab_ty;
         i pls_integer := 1;
    begin
    for venreg in(select * from fichier_tempo where num > 0 order by num) loop
              vtab(i).ligne := venreg.num;
              vtab(i).code_enreg := to_number(substr(venreg.texte,7,2));
              i := i + 1;
         end loop;
    end;
    Now I want to sort the code_enreg data of vtab into its code_enreg_ordered field. I must do that because I must verify that each code_enreg data entered are ordered. So if code_enreg is not equal to code_enreg_ordered at a specified index of vtab then I must take a decision in my program code ; I must code something when this disorder happens.
    How to do that ?
    Thank you very much indeed.

    Thank you Jeneesh , it works with a few modifications about the assignement of the pl/sql tables.
    Fantasy > Your blog talks about sorting the pl/sql table through the key. But I want to sort it through the field data. And my field data contains duplicated data. So you did not really reply to my need. Thank you anymore.

  • [HOW TO] comare 2 PL/SQL tables

    I want to compare 2 PL/SQL tables, something like this pseudo code:
    TYPE type_tbl IS TABLE OF table123%ROWTYPE
    INDEX BY BINARY_INTEGER;
    test1 type_tbl;
    test2 type_tbl;
    BEGIN
    insert a couple rows into each table
    IF test1 = test2 then EQUAL!
    ELSE NOT EQUAL
    END IF
    Based on this link I would think it's possible in 10g but I get a compile time error on the IF statement.
    [http://www.oracle.com/technology/oramag/oracle/03-sep/o53plsql.html]
    I understand that I could write my own Equal function but I it looks like it should be built in functionality.
    Thanks in advance for the help!

    Here is how it's going to be used: 2 separate developers are going to write code, each will create an in memory table, call them table1 and table2. These two tables then need to be compared against each other to see if every row and every column are identical. If they are equal we will take the data from one of the in memory tables and write that data to a physical table.
    If the 2 in memory tables are not equal then we want to abort and throw an error.

  • How to find indexes in sql tables

    Hi i need help for how to find the indexes for the sql tables.I had some tables in sql 2005 and i need to find indexes for that tables.Can anyone will help in this isssue.

    I think you can use one of the built-in db functions ... (but it depends upon which database you're using)
    in sql server:
    sp_helpindex tablename

  • How to Update this T-SQL Table?

    Hello,
    I am having trouble finding the correct syntax for updating this T-SQL table.
    Here is my Query which is adding an additional ' at the beginning and end.
    Query:
        Update [denodo].[dbo].[wrappers]
      SET wrapperWhereClause = '''AND County_Input=''Cheyenne & Arapaho Tribal Court'' AND WrapperID=729'''
      WHERE wrapperID = '729'
    The Outcome:
    'AND County_Input='Cheyenne & Arapaho Tribal Court' AND WrapperID=729'
    The Outcome I am hoping for:
    AND County_Input='Cheyenne & Arapaho Tribal Court' AND WrapperID=729
    Can anyone help me edit this so I can receive the outcome I am hoping for?

    >> Please learn
    I am having trouble finding the correct syntax for updating this T-SQL table. Here is my Query [sic] which is adding an additional ' at the beginning and end. <<
    Please learn basic terms so
    we can communicate. UPDATE is a statement and not a query. You do not know ISO-11179 rules, etc.
    Why are you building statements in SQL? You are doing bad SQL programming
    and need to stop. Your silly meta-data “wrapper_where_clause” and “county_input” is so fundamentally wrong I would fire you. Look at what I have done
    with SQL and see what a criticism that is!
    UPDATE Wrappers
    SET ??
    WHERE county_something =
    'Cheyenne & Arapaho Tribal Court'
    AND wrapper_id = '729';
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • How to return a table to ref cursor?

    My client has created a package stored procedure that takes in 2 parameters of VarChar2 and an out parameter which is a table
    Following is the package header
    CREATE OR REPLACE PACKAGE "PKG_TRAVEL_NEW_SUND" IS
    ---RECORD TYPE DELARATION
    TYPE DIRECT_ALT_REC IS RECORD (SERVICE_NO CBG_DISTANCE_FARE.SERVICE_NO%TYPE,
    DISTANCE CBG_DISTANCE_FARE.DISTANCE%TYPE,
    CASH_FARE_AC CBG_DISTANCE_FARE.CASH_FARE_AC%TYPE,
    CASH_FARE_NON_AC CBG_DISTANCE_FARE.CASH_FARE_NON_AC%TYPE,
    CARD_FARE_AC CBG_DISTANCE_FARE.CARD_FARE_AC%TYPE,
    CARD_FARE_NON_AC CBG_DISTANCE_FARE.CARD_FARE_NON_AC%TYPE,
    EZLINK_FARE_AC CBG_DISTANCE_FARE.EZLINK_FARE_AC%TYPE,
    EZLINK_FARE_NON_AC CBG_DISTANCE_FARE.EZLINK_FARE_NON_AC%TYPE,
    AVG_RUNTIME CBG_DISTANCE_FARE.AVG_RUNTIME%TYPE,
    ALTERNATIVE_NO CBG_DIRECT_ALT.ALTERNATIVE_NO%TYPE,
    MAX_FREQ_AM CBG_SVC.MAX_FREQ_AM%TYPE,
    MIN_FREQ_AM CBG_SVC.MIN_FREQ_AM%TYPE,
    ADVANTAGE_CODE CBG_DIRECT_ALT.ADVANTAGE_CODE%TYPE,
    DIST_FARE_CODE_1 CBG_DISTANCE_FARE.DIST_FARE_CODE%TYPE,
    DIST_FARE_CODE_2 CBG_DISTANCE_FARE.DIST_FARE_CODE%TYPE,
    DIST_FARE_CODE_3 CBG_DISTANCE_FARE.DIST_FARE_CODE%TYPE,
    FROM_STOP_CODE CBG_DISTANCE_FARE.FROM_STOP_CODE%TYPE,
    TO_STOP_CODE CBG_DISTANCE_FARE.TO_STOP_CODE%TYPE,
    MIN_TIME CBG_DIRECT_ALT.MIN_TIME%TYPE,
    MIN_FARE CBG_DIRECT_ALT.MIN_FARE%TYPE,
                                            ACT_FARE CBG_DIRECT_ALT.MIN_FARE%TYPE,
    TRAVEL_TYPE VARCHAR2(4),
    TRANSFER_INFO VARCHAR2(1),
    END_TRANSFER_INFO VARCHAR2(1));
    --TABLE  TYPE DECLARATION
    TYPE BUS_INFO_TAB IS TABLE OF DIRECT_ALT_REC INDEX BY BINARY_INTEGER;
    -- CURSOR TYPE DECLARATION
    TYPE TEMP_REC_STRUCT1 IS RECORD (
    RECORD_POSITION BINARY_INTEGER,
    DIST_FARE_CODE1 CBG_DISTANCE_FARE.DIST_FARE_CODE%TYPE,
    DIST_FARE_CODE2 CBG_DISTANCE_FARE.DIST_FARE_CODE%TYPE,
    DIST_FARE_CODE3 CBG_DISTANCE_FARE.DIST_FARE_CODE%TYPE,
    ADVANTAGE_CODE CBG_DIRECT_ALT.ADVANTAGE_CODE%TYPE,
    MINIMUM_FARE CBG_DIRECT_ALT.MIN_FARE%TYPE,
    MINIMUM_TIME CBG_DIRECT_ALT.MIN_TIME%TYPE,
    TRAVEL_TYPE VARCHAR2(4) );
    TYPE TEMP_TAB_STRUCT1 IS TABLE OF TEMP_REC_STRUCT1 INDEX BY BINARY_INTEGER;
    TEMP_TABLE1 BUS_INFO_TAB;
    G_RESULTSET_INDEX BINARY_INTEGER := 0 ;
    G_TOT_RECS_IN_TAB1 BINARY_INTEGER := 0 ;
    TYPE BUS_INFO_CUR IS REF CURSOR RETURN DIRECT_ALT_REC;
    ---PROCEDURE INSIDE THE PACKAGE
    --- PROCEDURE TO SELECT THE RECORDS
    PROCEDURE SEL_DIRECT_ALT(P_FROM_STOP_CODE IN VARCHAR2,
    P_TO_STOP_CODE IN VARCHAR2,
    RESULTSET IN OUT BUS_INFO_TAB);
    I'm using ODP.net and here is my code
    string storedprocedure = "PKG_TRAVEL_NEW_SUND.SEL_DIRECT_ALT";
    //PKG_TRAVEL_NEW_SUND
    //CBG003_XP_SP_TEST1
    ArrayList retlist = new ArrayList();
    OracleConnection curr_conn = this.GetOpenConnection();
    OracleCommand cmd = curr_conn.CreateCommand();
    cmd = new OracleCommand(storedprocedure, curr_conn);
    cmd.CommandType = CommandType.StoredProcedure;
    // input parameter
    OracleParameter param1 = new OracleParameter();
    OracleParameter param2 = new OracleParameter();
    param1.ParameterName = "start_code";
    param2.ParameterName = "end_code";
    param1.OracleDbType = OracleDbType.Varchar2;
    param2.OracleDbType = OracleDbType.Varchar2;
    param1.Direction = ParameterDirection.Input;
    param2.Direction = ParameterDirection.Input;
    param1.Size = 5;
    param2.Size = 5;
    param1.Value = start_codes;
    param2.Value = end_codes;     
    cmd.Parameters.Add(param1);
    cmd.Parameters.Add(param2);
    OracleParameter outputparam3 = new OracleParameter();
    outputparam3.Direction = ParameterDirection.InputOutput;
    outputparam3.ParameterName = "output";
    outputparam3.OracleDbType = OracleDbType.RefCursor;
    // output type
    cmd.Parameters.Add(outputparam3);
    cmd.ExecuteNonQuery();
    At this point, when i execute Query, i get the message telling me that i could have the wrong number or type arguments for the procedure.
    I've looked thru countless examples saying i should use a RefCursor, but what else could i miss out?

    Hi,
    This is from Metalink NOTE.219191.1 How to return the values in a PL/SQL table to a ref cursor
    Hope it helps,
    Greg
    This document gives details with an example on how to pass the values
    in a PL/SQL table to a ref cursor.
    SCOPE & APPLICATION
    This document is useful for developers who are familiar with SQL & PL/SQL
    How to return the values in a PL/SQL table to a ref cursor
    This can be done by using a SQL Object type instead of a PL/SQL table.
    Here is an example.
    SQL> create or replace type ObjectType as object
    2 ( x int,
    3 y date,
    4 z varchar2(25)
    5 );
    6 /
    Type created.
    SQL> create or replace type TabType as table of ObjectType;
    2 /
    Type created.
    SQL> create or replace
    2 function demo_function( p_start_row in number,
    3 p_end_row in number )
    4 return TabType
    5 as
    6 l_data TabType := TabType();
    7 l_cnt number default 0;
    8 begin
    9 for x in ( select * from emp order by sal desc )
    10 loop
    11 l_cnt := l_cnt + 1;
    12 if ( l_cnt >= p_start_row )
    13 then
    14 l_data.extend;
    15 l_data(l_data.count) :=
    16 objectType( x.empno,
    17 x.hiredate,
    18 x.ename );
    19 end if;
    20 exit when l_cnt = p_end_row;
    21 end loop;
    22
    23 return l_data;
    24 end;
    25 /
    Function created.
    SQL> select *
    2 from the ( select cast( demo_function(3,7) as TabType )
    3 from dual ) a;
    X Y Z
    7902 03-DEC-81 FORD
    7566 02-APR-81 JONES
    7698 01-MAY-81 BLAKE
    7782 09-JUN-81 CLARK
    7844 08-SEP-81 TURNER
    By using a SQL object type, the table can be selected easily.
    SQL> create or replace package demo_pkg
    2 as
    3 type rc is ref cursor;
    4
    5 procedure p( p_cursor in out rc );
    6 end;
    7 /
    Package created.
    SQL> create or replace package body demo_pkg
    2 as
    3
    4 procedure p( P_cursor in out rc )
    5 is
    6 l_data TabType := TabType();
    7 begin
    8 for i in 1 .. 3 loop
    9 l_data.extend;
    10 l_data(i) :=
    11 ObjectType( i, sysdate+i, i || ' data');
    12 end loop;
    13
    14 open p_cursor for
    15 select *
    16 from TABLE ( cast ( l_data as TabType) );
    17 end;
    18
    19 end;
    20 /
    Package body created.
    SQL> set autoprint on
    SQL> variable x refcursor
    SQL> exec demo_pkg.p(:x)
    PL/SQL procedure successfully completed.
    X Y Z
    1 15-NOV-02 1 data
    2 16-NOV-02 2 data
    3 17-NOV-02 3 data

  • How to create table from ref cursor

    I have a proc that returns a ref cursor, whats the simplest way to create a table based on the return of the ref cursor?
    declare
    type rc is ref cursor;
    p_data rc;
    begin
    call_my_proc(p_data);
    :result := p_data; -- If I run this in TOAD I can see the data here but I want to create a table based on it rather than outputting it)
    end;
    thanks.
    edit: sorry. typed this wrong first time, should be right now

    961469 wrote:
    I have a proc that returns a ref cursor, whats the simplest way to create a table based on the return of the ref cursor?Not to do it...
    A cursor is not a result set. A cursor is not a result set. Worth repeating several times as this is a common misconception
    A cursor is essentially a program. Executable code that was compiled from a SQL source code program.
    A SELECT cursor is "read" program. Each fetch instruction runs this program (from its current "paused state"), and outputs data.
    An INSERT cursor is a "write" program. You pass data to it (process called binding, via bind variables). You then execute the program. It writes the data it received (can be bulk data via a bulk bind) to table.
    Now your question is: How do I write the output of a cursor program back to the database?
    The answer is that a "write" cursor program is needed. Your code needs to execute (fetch output from) the ref (read/select) cursor. Then bind that data to the "write" cursor and execute it.
    In other words, you have a read cursor and a write cursor, and you need to pass data from one to the other.
    HOWEVER.. This is slow. This does not scale. This is also known as slow-by-slow row by row processing.
    The correct approach is to create a single program. One that reads the data, and then writes the data. No to send data via a detour through your code between the read part and write part.
    The cursor to create is an INSERT..SELECT cursor. This can do fast direct path inserts. This can be executed in parallel - i.e. the database executing several copies of this read-and-write program at the same time.

  • Why do we need varrays ,index by table,pl/sql table etc when cursor is avai

    hi,
    Why do we need Composite data types like Index by Table, varrays etc when we have cursors and we can do all the things with cursor.
    Thanks
    Ram

    I would have to create a collection type for each column in the select statement.No.
    SQL> select count(*) from scott.emp ;
      COUNT(*)
            14
    1 row selected.
    SQL> DECLARE
      2      TYPE my_Table IS TABLE OF scott.emp%ROWTYPE;
      3      my_tbl my_Table;
      4  BEGIN
      5      SELECT * BULK COLLECT INTO my_tbl FROM scott.emp;
      6      dbms_output.put_line('Bulk Collect rows:'||my_tbl.COUNT) ;
      7  END;
      8  /
    Bulk Collect rows:14
    PL/SQL procedure successfully completed.
    SQL> disc
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.7.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.7.0 - Production
    SQL>Message was edited by:
    Kamal Kishore

  • How to call a Stored Procedure with a REF CURSOR output parameter

    I am looking forward an example that call a stored function/procedure with a REF CURSOR output parameter and get the result.
    In other words, I have a stored function/procedure that execute a SELECT statement using the OCI library and then it could get the values of each column and each row.
    I put a code snippet, it have only the main thing to call a simple stored procedure and print the name of each column of the cursor, but I couldn´t to print out the values in the table that call the stored procedure.
    I understand that the next step, it is to call a OCIStmtFetch.
    How to associate the cursor with the OCIStmtFetch?
    If you need more information, only tell me.
    I am using ANSI C with HP-UX Operative System (C for HP-UX) and Oracle 10g.
    Regards.
    Antonio Garcia
    /* callOracleSP */
    #include <stdio.h>
    #include <string.h>
    #include <oci.h>
    #include <stdlib.h>
    char* pConnectChar ="server";
    char* pUsernameChar = "user";
    char* pPasswordChar = "passwd";
    char* sqlCharArray1 = "BEGIN SP_GETCITIES(:s, :c); END;";
    int retval;
    ub4 parmcnt=0;
    ub4 pos2=0;
    text *pcoln[20];
    ub4 namelen[20];
    char state_key[5];
    OCIStmt* pOciStatement;
    OCIStmt* pOciStatCursor;
    OCIError* pOciError;
    OCIEnv* pOciEnviron;
    OCIServer* pOciServer;
    OCISession* pOciSession;
    OCISvcCtx* pOciServiceContext;
    OCIBind* pOciBind[500];
    OCIParam* pOciParam;
    int main()
    retval = OCIEnvCreate(&pOciEnviron, OCI_DEFAULT, NULL, NULL, NULL, NULL,0,NULL);
    retval = OCIEnvInit(&pOciEnviron, OCI_DEFAULT, 0, NULL);
    retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciError, OCI_HTYPE_ERROR, 0, NULL);
    retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciServiceContext, OCI_HTYPE_SVCCTX, 0, NULL);
    retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciStatement, OCI_HTYPE_STMT, 0, NULL);
    retval = OCILogon(pOciEnviron,pOciError,&pOciServiceContext,(unsigned char *)pUsernameChar,
         strlen(pUsernameChar), (unsigned char *)pPasswordChar, strlen(pPasswordChar),
                   (unsigned char *)pConnectChar,strlen(pConnectChar));
    printf("OCILogon retval=%d\n",retval);
    retval = OCIStmtPrepare(pOciStatement, pOciError, (unsigned char *)sqlCharArray1,strlen(sqlCharArray1),
         OCI_NTV_SYNTAX, OCI_DEFAULT);
    printf("StmtPrepare retval=%d\n",retval);
    retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciStatCursor, OCI_HTYPE_STMT, 0, NULL);
    retval = OCIBindByPos(pOciStatement,&pOciBind[0], pOciError, (ub4) 1, (void *)&state_key,
         (sb4) sizeof(state_key), SQLT_STR, (void *) 0, (ub2 *) 0, (ub2 *)0,(ub4)0, (ub4 *)0, (ub4) OCI_DEFAULT);
    printf("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);
    retval = OCIBindByPos(pOciStatement,&pOciBind[1], pOciError, (ub4) 2, (void *)&pOciStatCursor,
         (sb4) 0, SQLT_RSET, (void *) 0, (ub2 *) 0, (ub2 *)0,(ub4)0, (ub4 *)0, (ub4) OCI_DEFAULT);
    printf("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);
    strcpy(state_key,"CA");
    retval = OCIStmtExecute(pOciServiceContext, pOciStatement, pOciError, (ub4)1, (ub4) 0,
         (OCISnapshot *)NULL, (OCISnapshot *)NULL, (ub4) OCI_DEFAULT);
    printf("StmtExecute retval=%d\n",retval);
    /* How to get the values of the cursor? */
    /* Get number of parameters of the Cursor */
    OCIAttrGet((void *) pOciStatCursor, (ub4)OCI_HTYPE_STMT, (void*) &parmcnt,(ub4 *) 0,
         (ub4)OCI_ATTR_PARAM_COUNT, pOciError);
    printf("\nNumber of parameters of the cursor = %d\n",parmcnt);
    for (int pos = 1; pos <= (int)parmcnt; pos++)
         OCIAttrGet((void *) pOciStatCursor, (ub4)OCI_HTYPE_STMT, (void*) &pos2,(ub4 *) 0,
              (ub4)OCI_ATTR_CURRENT_POSITION, pOciError);
         retval = OCIParamGet((void *)pOciStatCursor, (ub4)OCI_HTYPE_STMT, pOciError, (void **)&pOciParam,
              (ub4) pos );
         OCIAttrGet((void*) pOciParam, (ub4) OCI_DTYPE_PARAM,(void*) &pcoln[pos-1],(ub4 *) &namelen[pos-1],
              (ub4) OCI_ATTR_NAME,(OCIError *)pOciError );
    for (int i = 1; i <=(int)parmcnt; i++)
    printf("Column %i\tNAME = %.*s\n",i,namelen[i-1],pcoln[i-1]);
    return 0;
    This is the script that create the table, insert records and create the stored procedure
    CREATE TABLE CITIES (
         STATE_CODE     VARCHAR2(2) NULL,
         CITY_CODE      NUMBER(15,5) NULL,
         CITY_NAME      VARCHAR2(30) NULL
    INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES('CA', 30, 'SAN DIEGO')
    INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES('CA', 40, 'SACRAMENTO')
    INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES('FL', 10, 'MIAMI')
    INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES('FL', 20, 'ORLANDO')
    INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES('NY', 10, 'NEW YORK')
    INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES('NY', 20, 'ALBANY')
    INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES('CA', 10, 'LOS ANGELES')
    INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES('CA', 20, 'SAN FRANCISCO')
    CREATE OR REPLACE PACKAGE globalPkg AUTHID CURRENT_USER AS
    /* The following are T/SQL specific global variables. */
    TYPE RCT1 IS REF CURSOR;/*new weak cursor definition*/
    END globalPkg;
    CREATE OR REPLACE PROCEDURE SP_ADDCITY(
    P_STATE_CODE IN VARCHAR,
    P_CITY_CODE      IN NUMBER,
    P_CITY_NAME      IN VARCHAR2,
    P_RETURN IN OUT NUMBER)
    AS
    StoO_error INTEGER;
    StoO_selcnt INTEGER;
    StoO_rowcnt INTEGER;
    StoO_errmsg VARCHAR2(255);
         BEGIN
    StoO_rowcnt := 0;
    StoO_error := 0;
    StoO_selcnt := 0;
    P_RETURN := 0;
    INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES (P_STATE_CODE, P_CITY_CODE, P_CITY_NAME);
    StoO_rowcnt := SQL%ROWCOUNT;
    EXCEPTION
    WHEN TOO_MANY_ROWS THEN
    StoO_rowcnt := 2;
    WHEN OTHERS THEN
    StoO_rowcnt := 0;
    StoO_selcnt := 0;
    StoO_error := SQLCODE;
    StoO_errmsg := SQLERRM;
              IF StoO_error != 0 THEN
    BEGIN
                   P_RETURN := 1;
         RETURN;
         END;
              END IF;
         END;
    CREATE OR REPLACE PROCEDURE SP_GETCITIES(
    STATE_KEY IN VARCHAR,
    RC1      IN OUT globalPkg.RCT1)
    AS
    StoO_error INTEGER;
    StoO_selcnt INTEGER;
    StoO_rowcnt INTEGER;
    StoO_errmsg VARCHAR2(255);
    BEGIN
    StoO_rowcnt := 0;
    StoO_error := 0;
    StoO_selcnt := 0;
    OPEN RC1 FOR
    SELECT STATE_CODE, CITY_CODE, CITY_NAME
    FROM CITIES
    WHERE STATE_CODE = STATE_KEY
    ORDER BY CITY_CODE;
    StoO_rowcnt := SQL%ROWCOUNT;
    EXCEPTION
    WHEN OTHERS THEN
    StoO_rowcnt := 0;
    StoO_error := SQLCODE;
    StoO_errmsg := SQLERRM;
         END;
    /

    Hi Mark,
    Thanks for your recommendations.
    I change the code with OCIDefineByPos, one for each parameter from cursor and then use the OCIStmtFetch.
    I don´t receive a error when call OCIDefineByPos, but when I call OCIStmtFetch receive a -1 error number.
    What is wrong with the code?
    The script is the same.
    I need your help!
    Best Regards!
    Antonio Garcia (Mexico)
    This the new code:
    #include <stdio.h>
    #include <string.h>
    #include <oci.h>
    #include <stdlib.h>
      char*   pConnectChar ="ORAC617";
      char*   pUsernameChar = "C617_005_DBO_01";
      char*   pPasswordChar = "Tempora1";
      char*   sqlCharArray1 = "BEGIN SP_GETCITIES(:s, :c); END;";
      int     retval;
      ub4 parmcnt=0;
      ub4 pos2=0;
      sb2   *c_indp;
      text *pcoln[20], *name,*name2;
      ub4 namelen[20],len;
      ub2 type,size;
      char state_key[5];
      OCIDefine        *pdef;
      OCIBind          *p_bnd;
      ub1          **c_buf;
      OCIStmt*     pOciStatement;      /* Statement handle */
      OCIStmt*     pOciStatCursor;     /* Statement handle */   
      OCIError*    pOciError;          /* Error handle */
      OCIEnv*      pOciEnviron;        /* Environment handle */
      OCIServer*   pOciServer;         /* Server handle */  
      OCISession*  pOciSession;        /* Session handle */
      OCISvcCtx*   pOciServiceContext; /* Service Context handle */
      OCIBind*     pOciBind[500];      /* Bind handle */
      OCIParam*    pOciParam;          /* Param handle */
      int OCI_Fetch(OCIStmt *p_select,OCIError *p_err, int *piOcc)
      int iOcc, rc; 
      rc=OCIStmtFetch(p_select,p_err,1,OCI_FETCH_NEXT,OCI_DEFAULT);
      printf("rc fetch %i",rc);
      if(rc==0&&piOcc!=NULL){
           printf("entro al if");
        iOcc=*piOcc;
        *piOcc=iOcc+1;
      return rc;
    int main()
    int pos,i=0,rc;
      retval = OCIEnvCreate(&pOciEnviron, OCI_DEFAULT, NULL, NULL, NULL, NULL,0,NULL);
      printf("EnvCreate retval=%d\n", retval);
      retval = OCIEnvInit(&pOciEnviron, OCI_DEFAULT, 0, NULL);
      printf("EnvInit retval=%d\n",retval);
      retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciError, OCI_HTYPE_ERROR, 0, NULL);
      printf("HandleAlloc OCI_HTYPE_ERROR retval=%d\n",retval);
      retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciServiceContext, OCI_HTYPE_SVCCTX, 0, NULL);
      printf("HandleAlloc OCI_HTYPE_SVCCTX retval=%d\n",retval);
      retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciStatement, OCI_HTYPE_STMT, 0, NULL);
      printf("HandleAlloc OCI_HTYPE_STMT retval=%d\n",retval);
      retval = OCILogon(pOciEnviron,pOciError,&pOciServiceContext,(unsigned char *)pUsernameChar,
                  strlen(pUsernameChar), (unsigned char *)pPasswordChar, strlen(pPasswordChar),
                    (unsigned char *)pConnectChar,strlen(pConnectChar));
      printf("OCILogon retval=%d\n",retval);
      retval = OCIStmtPrepare(pOciStatement, pOciError, (unsigned char *)sqlCharArray1,strlen(sqlCharArray1),
                 OCI_NTV_SYNTAX, OCI_DEFAULT);
      printf("StmtPrepare retval=%d\n",retval);
      retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciStatCursor, OCI_HTYPE_STMT, 0, NULL);
      printf("HandleAlloc OCI_HTYPE_STMT retval=%d\n",retval);
      retval = OCIBindByPos(pOciStatement,&pOciBind[0], pOciError, (ub4) 1, (void *)&state_key,
                 (sb4) sizeof(state_key), SQLT_STR, (void *) 0, (ub2 *) 0, (ub2 *)0,(ub4)0, (ub4 *)0, (ub4) OCI_DEFAULT);
      printf("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);
      retval = OCIBindByPos(pOciStatement,&pOciBind[1], pOciError, (ub4) 2, (void *)&pOciStatCursor,
                 (sb4) 0, SQLT_RSET, (void *) 0, (ub2 *) 0, (ub2 *)0,(ub4)0, (ub4 *)0, (ub4) OCI_DEFAULT);
      printf("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);
      strcpy(state_key,"CA");
      retval = OCIStmtExecute(pOciServiceContext, pOciStatement, pOciError, (ub4)1, (ub4) 0,
                   (OCISnapshot *)NULL, (OCISnapshot *)NULL, (ub4) OCI_DEFAULT);
      printf("StmtExecute retval=%d\n",retval);
      c_buf=(ub1 **)calloc(sizeof(ub1 *),3);
      c_indp=(sb2 *)calloc(sizeof(sb2 *),3);
      // Get number of parameters of the Cursor
      OCIAttrGet((void *) pOciStatCursor, (ub4)OCI_HTYPE_STMT, (void*) &parmcnt,(ub4 *) 0,
                  (ub4)OCI_ATTR_PARAM_COUNT, pOciError);
      printf("\nNumber of parameters of the cursor = %d\n",parmcnt);
      for (pos = 1; pos <= (int)parmcnt; pos++)
           OCIAttrGet((void *) pOciStatCursor, (ub4)OCI_HTYPE_STMT, (void*) &pos2,(ub4 *) 0,
                (ub4)OCI_ATTR_CURRENT_POSITION, pOciError);
           retval = OCIParamGet((void *)pOciStatCursor, (ub4)OCI_HTYPE_STMT, pOciError, (void **)&pOciParam,(ub4) pos );
           // Get the column name
           OCIAttrGet((void*) pOciParam, (ub4) OCI_DTYPE_PARAM,(void*) &name,(ub4 *) &len, (ub4) OCI_ATTR_NAME,(OCIError *)pOciError );
            // Get the column datatype
           OCIAttrGet((void*) pOciParam, (ub4) OCI_DTYPE_PARAM,(void*) &type,(ub4 *)0,(ub4)OCI_ATTR_DATA_TYPE,(OCIError *)pOciError);      
            // Get the column size
           OCIAttrGet((void*) pOciParam, (ub4) OCI_DTYPE_PARAM,(void*) &size,(ub4 *)0,(ub4)OCI_ATTR_DATA_SIZE,(OCIError *)pOciError);
           printf("Column %i\tNAME = %.*s \ttype %d \tsize %d\n",pos,len,name,type,size);
           // OCIDefine ByPos, one for each parameter
           // c_buf store the STATE_CODE, CITY_CODE and CITY_NAME columns from the cursor
           rc=OCIDefineByPos(pOciStatCursor,&pdef,(OCIError *)pOciError,pos,c_buf[pos-1],size+1,(ub2)type,(dvoid *)c_indp[pos-1],(ub2 *)0,(ub2 *)0,OCI_DEFAULT);     
          printf("OCIDefineByPos retval=%d\n,rc);
      // call OCIStmtFetch. In the next line, I receive the error
      rc=OCIStmtFetch(pOciStatCursor,pOciError,1,OCI_FETCH_NEXT,OCI_DEFAULT);
      printf("rc fetch %i",rc);
      return 0;
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to pass strings for IN Clause in REF Cursor

    I have following query;
    SELECT 1 INTO L
    FROM test_po_apprvlines
    where '4020' between NVL(approval_cost_centre_from, '0000') and
    nvl (approval_cost_centre_to, '9999')
    and req_approval_type IN ('BUS', 'FIN') and 10500 >= approval_amount
    and NVL(req_line_type, 'X') = 'X'
    AND ROWNUM =1;
    Now the values for req_approval_type should be dynamic, based on approval_amount. If approval_amout > 10000 then
    req_approval_type should have 'BUS' and 'FIN' , other wise only 'BUS'.
    I have tried with the following code using ref cursor. But i'm not getting the result.
    Any help. The problem is how to concatenate those two values to get the result.
    in the following code, strings are not recoginised properly. Valid data exists in the table.
    DECLARE
    l_approva_type1 VARCHAR2(20) := 'FIN';
    l_approva_type2 VARCHAR2(10) := 'BUS';
    l_approva_type VARCHAR2(20) := '''FIN'''||','||'''BUS''';
    L NUMBER;
    TYPE TEST_REF IS REF CURSOR;
    cur_ref TEST_REF;
    L_str varchar2(1000) := 'SELECT 1'||
    ' FROM test_po_apprvlines'
    ||' where '||'''4020'''||' between NVL(approval_cost_centre_from, '||'''0000'''||') and nvl(approval_cost_centre_to, '|| '''9999'''||')'
    ||' and req_approval_type IN ( :bi_approva_type)'||
    ' and 10500 >= approval_amount '||
    ' and req_line_type IS NULL '||
    'AND ROWNUM =1';
    L_flg varchar2(1);
    BEGIN
    DBMS_OUTPUT.PUT_LINE (l_approva_type);
    open cur_ref for l_str USING l_approva_type;
    fetch cur_ref INTO l_flg;
    close cur_ref;
    DBMS_OUTPUT.PUT_LINE (nvl(L_flg, 'x'));
    EXCEPTION
    WHEN OTHERS THEN
    if cur_ref%isopen then
         close cur_ref;
         end if;
    DBMS_OUTPUT.PUT_LINE (SQLERRM);
    END;

    You cant "Bind" here.
    One way..
    SQL> var a refcursor
    SQL> declare
      2   str varchar2(100) := '''SALESMAN'',''ANALYST''';
      3  begin
      4   open :a for 'select ename from emp
      5                where job in ('||str||')';
      6  end;
      7  /
    PL/SQL procedure successfully completed.
    SQL> print :a
    ENAME
    WARD
    SCOTT
    Message was edited by:
            jeneesh
    Results in More parsing...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • 26.4 Basing an entity Object on a PL/SQL Package API - Ref Cursor, no View

    I am hoping that I could get some help in the details of a problem. I am trying to follow the directions in the Oracle Application Development Framework Developer's Guide for Forms/4GL Developers, Section 26.4 - Basing an Entity Object on a PL/SQL Package API.
    There is example code in the downloadable AdvancedEntityExamples - EntityWrappingPL/SQLPackage
    The question is, how will the implementation change if the entity is based entirely on PL/SQL - simply stated - no view is available, just ref cursors and insert,update,delete procedures.
    In the example code, there are two procedures, lock_product and select_product. This is where things get more complicated. I can create a function to return a single record ref cursor, instead of the list of OUT variables defined in both functions (select_product and lock_product). It makes sense that I just return one cursor and get all of the columns from that instead of lots of OUT variables.
    So what's stopping me you may ask... There is one difference between select_product and select_lock. Select_lock has a select that includes "FOR UPDATE NOWAIT". I don't have that as an option when creating my ref cursor. I am not sure what the impact of "FOR UPDATE NOWAIT" is? Can I ignore it?
    In the problem I am working with, (getting data from Oracle Portal 10.1.4) I return the following:
    function getRefCursor return ref_cursor is
    v_tab wwsbr_all_items_object_type := wwsbr_all_items_object_type();
    p_recordset wwsbr_types.cursor_type;
    l_results wwsrc_api.items_result_array_type;
    begin
    wwctx_api.set_context(<username>,<password>);
    l_results := wwsrc_api.item_search(.. parameters..);
    <snip>
    ... Loop through the objects and populate v_tab
    <snip>
    open p_recordset for
    select * from table(cast(v_tab as wwsbr_all_items_object_type));
    return p_recordset;
    end getRefCursor;
    With this sample, it would be easy to return a single row by passing the masterid as a parameter.
    So I am still left with, how should the implementation of callLockProcedureAndCheckForRowInconsistency() and callSelectProcedure() be changed in order to use a ref cursor instead of a view? The user guide was missing that extra section <bg>.
    What would be REALLY helpful, is an example, say 26.4A that demonstrates creating an entity object from a ref cursor and procedures from PL/SQL only without a view.
    Thank you, Ken

    The lock procedure is expected to obtain a row-level lock on the row, given its key.
    Depending on the setting of jbo.locking.mode, the entity object's lock() method will be invoked either as soon as the first persistent attribute is successfully modified by the user (in the case of jbo.locking.mode=pessimistic), or it will be called during commit processing just before the row is updated in the database (with jbo.locking.mode=optimistic).
    Usually 2-tier Swing applications use pessimistic mode, while web applications use optimistic mode.
    The FOR UPDATE NOWAIT is the Oracle clause that can be appened to a SELECT statement to acquire a row-level lock on the selected rows. The NOWAIT modifier means that rather than hanging, waiting for a row locked by another user to free up, it will raise an exception if any of the rows being selected-and-locked are not available to lock.
    If you're not able to work the FOR UPDATE NOWAIT into the syntax of the ref cursor, perhaps you can initially perform the lock using a different cursor inside the stored procedure, then return your ref cursor.

  • How can I see the contents in a Ref Cursor

    I have this code:
    CREATE OR REPLACE PACKAGE APOD_LOG.APOD_C3_LOG_API_PKG
    AUTHID CURRENT_USER
    AS
    type rc is ref cursor;
    PROCEDURE Fetch_Log_Spec
    in_LOCAL_IP_VALUE IN BINARY_INTEGER,
    out_RESULT_SET OUT rc
    END APOD_C3_LOG_API_PKG;
    CREATE OR REPLACE PACKAGE BODY APOD_LOG.APOD_C3_LOG_API_PKG
    AS
    PROCEDURE Fetch_Log_Spec
    in_LOCAL_IP_VALUE IN BINARY_INTEGER,
    out_RESULT_SET OUT rc
    IS
    BEGIN
    DBMS_APPLICATION_INFO.set_module(module_name => 'APOD_LOG.API_PKG',action_name => 'Fetch_Log_Spec');
    DBMS_APPLICATION_INFO.set_client_info(client_info => 'Calling with in_LOCAL_IP_VALUE = ' ||to_char(in_LOCAL_IP_VALUE));
    open out_RESULT_SET for
    select
    in_LOCAL_IP_VALUE as IN_LOCAL_IP_VALUE,
    10002 as PORT,
    APOD_CORE.UTIL_IP_PKG.IPAddressToIPValue2('''224.168.100.1''') as MULTICAST_IP_VALUE
    from
    dual
    union
    select
    in_LOCAL_IP_VALUE as IN_LOCAL_IP_VALUE,
    10002 as PORT,
    APOD_CORE.UTIL_IP_PKG.IPAddressToIPValue2('''224.168.200.1''') as MULTICAST_IP_VALUE
    from
    dual
    union
    select
    in_LOCAL_IP_VALUE as IN_LOCAL_IP_VALUE,
    10002 as PORT,
    APOD_CORE.UTIL_IP_PKG.IPAddressToIPValue2('''224.168.100.123''') as MULTICAST_IP_VALUE
    from
    dual
    union
    select
    in_LOCAL_IP_VALUE as IN_LOCAL_IP_VALUE,
    10002 as PORT,
    APOD_CORE.UTIL_IP_PKG.IPAddressToIPValue2('''224.168.200.123''') as MULTICAST_IP_VALUE
    from
    dual;
    DBMS_APPLICATION_INFO.set_client_info(client_info => 'Called Fetch_Log_Spec '||to_char(SQL%ROWCOUNT)||' row(s) returned with in_LOCAL_IP_VALUE = '||to_char(in_LOCAL_IP_VALUE) );
    END Fetch_Log_Spec;
    END APOD_C3_LOG_API_PKG;
    And I am trying to test it like this:
    DECLARE
    IN_LOCAL_IP_VALUE BINARY_INTEGER;
    OUT_RESULT_SET APOD_LOG.APOD_C3_LOG_API_PKG.rc;
    BEGIN
    IN_LOCAL_IP_VALUE := 23374048;
    -- OUT_RESULT_SET := NULL; How do I see this
    APOD_LOG.APOD_C3_LOG_API_PKG.FETCH_LOG_SPEC ( IN_LOCAL_IP_VALUE, OUT_RESULT_SET );
    END;
    How can I see the dataset returnd by the OUT_RESULT_SET in SQLPlus or Quest ScriptRunner?

    A ref cursor doesn't really contain rows but you can use them to reference a SQL statement that fetches the rows.
    Re: returning resultset from procedure...or pkg

Maybe you are looking for

  • .mac account in Mail.app won't download mail - it freezes

    I just screenshared my mother for about 4 hours (there is about a 20 second lag time between every click i enter and the response on her end, maddening!! but that's another story). Her AOL IMAP accounts are working fine in Mail.app, but her .mac acco

  • How can I transfer a Photoshop license from one pc to another?

    I Have already a serial number for adobe photoshop. However i'm going to change from work pc and need to transfer photoshop from one to another. How can I do it? thanks

  • Image slide show...

    Hi, If I have a Flash web page with a button and I'd like an image slide show to launch at the top of the page upon one clicking the button, plus the slide show container to have the play/pause, forward, backward controls, along with small numbers 1-

  • Error in 9i user export through 10g...

    As i am Exporting 9iR2 Database user through 10g its giving me following error EXP-00056: ORACLE error 6550 encountered ORA-06550: line 1, column 41: PLS-00302: component 'SET_NO_OUTLINES' must be declared ORA-06550: line 1, column 15: PL/SQL: Statem

  • Screen broken, need to backup but keeps asking for password. THANKS!

    I had my iPhone screen broken and i have to backup it but itunes keeps me asking to put the password on the iphone, but i cant because the screen is black now. Someone?