I’m locally running an instance of Oracle 11gR2 for testing. I’m connecting to it with OLEDB using VC++. I use CCommand and I’m able to select, update, insert and delete from my tables.
What I can’t do right now is execute stored procedures.
It is a simple stored procedure that inserts a row to my table. I can run it from SQL Plus without a hitch. However, when I come to execute it from my code, it doesn’t work. I get a 80040e14 error.
It’s pretty straightforward, but here is the line anyway.
hr = cmd.Open(session, "exec get_item_count");
Any ideas?
EXECis SQL*Plus syntax. It is not valid outside SQL*Plus (and a variety of PL/SQL GUIs that implement many of the features SQL*Plus provides).You probably want something like this (using ODBC syntax)
or this (using Oracle syntax)
If you use the Oracle syntax, the same syntax will work both in SQL*Plus and from your application. SQL*Plus does not understand ODBC syntax. However, other OLE DB providers will support ODBC syntax so ODBC syntax is portable across different database engines.
Additionally, if you have a PL/SQL object that retrieves an item count, that should be a stored function not a stored procedure. You say that the procedure is inserting a row into your table, which is something that a procedure should do and a function should not, but the name of the object
get_item_countdoesn’t seem to match your description of what it is doing.