- 02-26-2010 10:38 AM #1
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.
- 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
-
Use query stored in table / use output variable
By gitesh in forum SQL PL/SQLReplies: 2Last Post: 02-11-2010, 06:09 AM -
stored procedures and packages using various database objects
By laxman in forum SQL PL/SQLReplies: 6Last Post: 12-28-2009, 02:18 AM -
How to create Stored procedures in Oracle?
By Prity in forum Introduce YourselfReplies: 1Last Post: 12-10-2009, 09:57 AM -
Dynamic SQL - Variable no: columns & data type
By man_expo in forum SQL PL/SQLReplies: 1Last Post: 12-01-2009, 08:47 AM -
Handling null - values in stored procedures
By oli001 in forum SQL PL/SQLReplies: 1Last Post: 10-07-2009, 11:33 AM


LinkBack URL
About LinkBacks
Reply With Quote
