Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: ODBC question
When going for "DBMS independent" invocation of Stored Procedures, you need to use the ODBC "Escape" syntax, that uses braces {} to delimit the statement as special ODBC syntax. Specifically, to call stored procedure foo(), you would issue to following syntax:
SQLExecDirect (hstmt, "{call foo()}", SQL_NTS);
If you needed to feed several parameters into the stored proc call, you need to delimit them in the call's invocation, e.g. if you needed to feed three parameters into a Stored Proc called, foobar(), you would issue the following sequence:
SQLBindParameter (hstmt, 1, ...); SQLBindParameter (hstmt, 2, ...); SQLBindParameter (hstmt, 3, ...);
If you do not use the ODBC {call } syntax, then you have to code Stored
Proc
invocations using the back-end's target-specific systax, as you have
discovered
empirically.
Sam Brown wrote:
>
> This may be a trivial question for you gurus out there. I did not find a
> newsgroup which deals specifically with ODBC issues, so here goes...
>
> There seems to be a different calling syntax in SQLExecDirect() for
> stored procedures through ODBC.
>
> For example,
>
> the query for SQlServer can be in native form (surprise, surprise..)
>
> <stored_procedure_name>
>
> But using the Oracle ODBC driver, the syntax has to be
>
> Begin
> <stored_procedure_name>;
> End;
>
> Does anyone know what this would be using other ODBC drivers which
> interface to Sybase, Informix, Db2, progress, etc ? Is this documented
> somewhere for the "over 50 drivers" that ODBC supports ?
>
> Thanks in advance.
>
> Sam
Received on Mon May 26 1997 - 00:00:00 CDT