+ Reply to Thread + Post New Thread
Results 1 to 1 of 1
  1. #1
    saracooper's Avatar
    saracooper is offline Junior Member
    Join Date
    26 Feb 2010
    Posts
    11
    Say Thanks
    0
    Thanked 0 Times in 0 Posts
    Documents
    0
    Uploads
    0

    Default Stored Procedures Variable Arguments

    I am working on a project of migration where I need to have Stored Procedures for DB access routines cursor - Declare, Open, Fetch etc.
    I need to use Dynamic SQL, so I have written the routines as External Procedures in ProC and they work fine.
    The Select statement for Cursor in Declare routine is different every time & so the Fetch receives variable arguments. In External Procedures it is done by using va_list, va_arg .....
    All the Calling programs in C/Fortran call the Stored Procedures.

    I have 2 problems -
    1. how to pass the variable arguments to the Stored Procedure Fetch. Is there any way to declare parameters for Stored Procedure that are variable
    2. can i have out parameters that have more than one value or out parameters that take address to an array because Fetch needs to pass the address of the first element of the arrays

    Calling Program -
    CALL DECLARE(VCURS, SELECT_STMT)
    CALL OPEN(VCURS)
    CALL FETCH(VCURS, 2, CVAL1, CVAL2)

    where VCURS is the cursor name
    SELECt_STMT is the Select statement
    CVAL1 is a float array
    CVAL2 is an integer array

    Declare Stored Procedure -
    create or replace procedure "DECLARE"
    (cursorname IN OUT VARCHAR2,
    selectstmt IN VARCHAR2)
    is
    EXTERNAL LIBRARY externProcedures
    NAME "declarerout"
    LANGUAGE C
    PARAMETERS (
    cursorName char,
    selectstmt char );


    Declare External Procedure -
    void declarerout(char* cursorName, char* selectStr)
    {
    ......... }


    Fetch Stored Procedure -
    create or replace procedure "FETCH"
    ( ??????? )
    is
    EXTERNAL LIBRARY externProcedures
    NAME "fetchrout"
    LANGUAGE C;


    Fetch External Procedure -
    char fetchrout(char *cursorName, int numArgs, ...)
    {
    ............}


    Any help or suggestion is highly appreciated. Thank you in advance.

  2.    Club-Oracle Complementary E-Books and Magazines
    Get your free Complementary Copy of Oracle Magazine

    You can also browse the Free Magazines and E-Books section to see the complete list of free magazines, e-books and Whitepapers.

Similar Threads

  1. Use query stored in table / use output variable
    By gitesh in forum SQL PL/SQL
    Replies: 2
    Last Post: 02-11-2010, 06:09 AM
  2. Replies: 6
    Last Post: 12-28-2009, 02:18 AM
  3. How to create Stored procedures in Oracle?
    By Prity in forum Introduce Yourself
    Replies: 1
    Last Post: 12-10-2009, 09:57 AM
  4. Dynamic SQL - Variable no: columns & data type
    By man_expo in forum SQL PL/SQL
    Replies: 1
    Last Post: 12-01-2009, 08:47 AM
  5. Handling null - values in stored procedures
    By oli001 in forum SQL PL/SQL
    Replies: 1
    Last Post: 10-07-2009, 11:33 AM

Tags for this Thread