Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Calling a PL/SQL Function from OCI?
Hi,
How do I execute a PL/SQL function from OCI?
My test function:
CREATE OR REPLACE FUNCTION GetNodeQuery(TypeId IN INTEGER) RETURN
VARCHAR2 IS
Query VARCHAR2(500);
BEGIN
Query := 'Select * from Logical_Name';
RETURN Query;
END GetNodeQuery;
/
char SQL[16];
strcpy(SQL, "GetNodeQuery(1)");
char ColumnVariable[500];
int VariableSize = 500;
OCIStmtPrepare(qHandle, hError, SQL, (ub4)strlen(SQL),
(ub4)OCI_NTV_SYNTAX, (ub4)OCI_DEFAULT);
OCIDefineByPos(qHandle, &pDefine, hError, 1, (dvoid*)ColumnVariable, (sb4)VariableSize, 1,(dvoid*)0, (ub2*)0, (ub2*)0, OCI_DEFAULT); OCIStmtExecute(svchp, qHandle, hError, (ub4)1, (ub4)0,
(CONST OCISnapshot *)NULL, (OCISnapshot*)NULL,
OCI_DEFAULT);
On the Execute I get an error saying that ORA-00900: invalid SQL statement
Any Help would be appreciated.
Thank You,
Scott Metzger
Sent via Deja.com
http://www.deja.com/
Received on Mon Jan 08 2001 - 11:18:41 CST