Questions about calling PL/SQL packages from ProC

From: Ian Britten <britten_at_caris.universal.ca>
Date: 1995/07/29
Message-ID: <Pine.SUN.3.91.950729163049.4087H-100000_at_caris>#1/1


Hi,
I've got a .pc file that contains a bunch of C functions. These functions are basically just wrappers around calls to PL/SQL packages (stored in the database).

I've got 2 questions about the arguments to the packages.

First, why can't I (seem to) do this:
I'm trying to pass C function arguments directly into the package call

int someFunction(int x, int y)
{

.
.

	EXEC SQL EXECUTE
	BEGIN
		somePackage.someProcedure(:x, :y);
	END;
	END-EXEC;


.
.

}

I seem to have to do this:
Copy the arguments into local variables and pass those into the package

int someFunction(int x, int y)
{

	EXEC SQL BEGIN DECLARE SECTION;
	int	xCopy=x;
	int	yCopy=y;
	EXEC SQL END DECLARE SECTION;

        .
        .
 
        EXEC SQL EXECUTE
        BEGIN
                somePackage.someProcedure(:xCopy, :yCopy);
        END;
        END-EXEC;
 
        .
        .

}

Second, why can't I (seem to) do this:
I want to pass structure members into the package call

int someFunction(void)
{

	EXEC SQL BEGIN DECLARE SECTION;
	someStruct	x;
	EXEC SQL END DECLARE SECTION;


.
.
EXEC SQL EXECUTE BEGIN somePackage.someProcedure(:x.var1, :x.var2); END; END-EXEC;
.
.

}

I seem to have to do this:
Duplicate the structure members as (primative) local variables and use them

int someFunction(void)
{

        EXEC SQL BEGIN DECLARE SECTION;
        someStruct      x;	/* In or out of this DECLARE block	*/
	int		var1;
	int		var2;
        EXEC SQL END DECLARE SECTION;
         
        .
        .
        
        EXEC SQL EXECUTE
        BEGIN
                somePackage.someProcedure(:var1, :var2);
        END;
        END-EXEC;
        
	x.var1 = var1;
	x.var2 = var2;
        .
        .

}

Both of these problems are going to result in a substantial performance hit for me (due to the number of times called, number of variables, etc.) Is there something obvious (or not so obvious) I've missed that will allow me to do what I want? (Sorry, I've only been doing this for about 2 weeks now)

(email preferred if possible)
Thanks,


| Ian Britten - Programmer			Universal Systems Ltd.	|
| britten_at_caris.universal.ca			Fredericton, N.B.	|
| Ph. (506) 458-8533				Canada			|
| Fax (506) 459-3849				http://www.universal.ca |
|		     "Just a spoke, not a spokesman"			|
| 	      "I'm not prejudice. I hate everybody equally"		|
-------------------------------------------------------------------------
Received on Sat Jul 29 1995 - 00:00:00 CEST

Original text of this message