How to call Oracle PL/SQL functions from DBTools

Article ID: 886
Last updated: 05 Feb, 2008
Article ID: 886
Last updated: 05 Feb, 2008
Revision: 1
Views: 11837
Posted: 26 Nov, 1997
by Dean J.
Updated: 05 Feb, 2008
by Dean J.
Problem


Can RWDBStoredProc handle Oracle PL/SQL functions?


Action


Yes, RWDBStoredProc can be used for PL/SQL function calls.
But the usage is a little bit different than PL/SQL procedure calls.
You get function value back through RWDBStoredProc::returnValue() function, which is an RWDBValue object.
Here is an example:

/*
CREATE FUNCTION foo(x NUMBER) RETURN NUMBER IS y NUMBER;
BEGIN
y:= x + 1;
RETURN y;
END;
*/
RWDBStoredProc sp= db.storedProc(foo, cn);

sp << 10 ;
sp.execute(cn);
cout << Look: << sp.returnValue().asInt() << endl;
This article was:   Helpful | Not helpful
Report an issue
Article ID: 886
Last updated: 05 Feb, 2008
Revision: 1
Views: 11837
Posted: 26 Nov, 1997 by Dean J.
Updated: 05 Feb, 2008 by Dean J.

Others in this category