Re: ODBC and stored procedures???
Posted in 1997
Topics: Stored Procedures & SPL, Connectivity: ODBC / JDBC / .NET
Feng Huang wrote: > > Hi, ODBC experts, > > I've got a question regarding ODBC and stored procedures. Suppose I need to > write an application with ODBC accessing Oracle and Sybase. We plan to > develop some stored procedures in Oracle and Sybase. Is is possible to make > the application code portable across Oracle and Sybase, and maybe some other > DBMS? The programming language will be C++. Both client and server will be > on Unix. So I guess I need to find some Unix driver as well. > > How well is the ODBC API with respect to calling stored procedures, or this > is purely up to the driver implementation? > > I'd appreciate any help from you. Thank you very much. > > --Frank > fhuang@cs.umd.edu To the best of my knowledge, I believe the conventions for invoking stored procedures under ODBC are pretty much universally followed. At least, as far as I have seen with Sybase & MS SQL Server, and with DB2. I haven't tried invoking stored procedures under Oracle, but for the rest, the invocation is just: "{ call <proc-name> [(param1,...)] }" rather than using a SQL DML statement. The curly braces are what specify that the statement is a stored procedure, and are required for its invocation. Invoke either using SQLPrepare()/SQLExecute() for select actions that need to bind return columns between preparation and execution, or SQLExecDirect() for insert/update/delete actions. param1..paramN can either be literals or '?' for substitution variables, in which case you would have to use SQLPrepare() + SQLBindParam() + SQLExecute() to substitute in your parameter variables. If you should have any more questions, please feel free to e-mail. Roby Gamboa robyg@crl.com