ORA-00900: invalid SQL statement- when run a procedure in oracle 10g
93,196
Solution 1
Just noticed a detail in your question. You press run
button. Thus, you must be using an IDE.
You cannot use execute
in IDEs - it is an sql*plus
command. It might work in Oracle SQL Developer though, but I wouldn't use it there anyway;
Try
begin
exam;
end;
Solution 2
See: Syntax error while trying to call an Oracle package using ODBC in C#
You have to put "{" and "}" before the command. Example:
processListCmd.CommandType = CommandType.StoredProcedure;
processListCmd.CommandText = "{ call rep_invnr_proclist }";
processListCmd.ExecuteNonQuery();
Author by
kumar
Updated on July 09, 2022Comments
-
kumar almost 2 years
I am using Oracle 10g database and trying to run a procedure using SQL commands.
create or replace procedure "exam" is begin DBMS_OUTPUT.PUT_LINE('Test'); end;
Then click on Run button. It shows: "procedure created".
When I try to execute it using:
execute exam;
then click on Run button, it shows:
ORA-00900: invalid SQL statement
Thanks for your help.
-
kumar over 11 yearswhen used: create or replace procedure exam is begin DBMS_OUTPUT.PUT_LINE('Test'); end; same error is coming.
-
David Aldridge over 11 yearsMust be the way that you're executing it in whatever tool you're using then. Does it work in SQL*Plus? If not, you may be executing it as SQL instead of as a procedure call.
-
Kirill Leontev over 11 yearsif you quote your procedure name, then you should also quote procedure call. if you do not - don't quote in both places.
-
Kirill Leontev over 11 yearstry
create or replace exam...
,execute exam;
(no quotes) -
Line almost 4 yearsthe question is not related to C#
-
Line almost 4 yearsthat should be rather a comment, it does not provide the solution in my opinion
-
Michael Kremser almost 4 years@Line You are absolutely right! Probably I got confused with too many browser tabs opened and picked the wrong tab when answering.
-
Magnus Reftel about 3 yearsActually, this may be the correct answer. Since, as @kirill-leontev pointed out, @kumar seems not to be using SQL*Plus, using
{ call ... }
instead ofexec ...
should work better.