WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ODBC
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Execute an Oracle stored procedure

 Keywords:  Execute Oracle stored procedure

Question:

I am using Winbatch with SQL server, and it works fine. Now when I try to do the same with Oracle 7.3 it fails. The connection to the database works fine, but when I try to execute a stored procedure, I receive an "Invalid SQL command" error message.

Here is part of my code :

 
SqlTxt = "execute tstproc('ocadm')" 
retcode = qExecDirect(hstmt, SqlTxt)

the retcode is -1 and the message returned by qError(hstmt, 2) is :

37000 [Oracle][ODBC Oracle Driver][Oracle OCI]ORA-00900: Instruction SQL
invalid.

When I type the same command : execute tstproc('ocadm') with SQL worksheet or SQL + 3.3, it works fine

Any idea ?

Answer:

The Error message seems to be saying the Oracle driver doesn't recognize that command.

You mentioned you are trying to execute a stored procedure I wonder if it has anything to do with the quotes. Maybe the stored procedure requires double quote instead of the single quotes you specified.

Also instead of the word 'execute', try {call stored_procedure).

SqlTxt = '{call tstproc("ocadm")}' 
retcode = qExecDirect(hstmt, SqlTxt)

Follow up:

Thanks, you're right it is a stored procedure, it works with the

{call tstproc('ocadm')}



Article ID:   W14538
Filename:   Execute an Oracle stored procedure.txt
File Created: 2017:07:28:13:58:32
Last Updated: 2001:01:29:14:10:44