ORA-00900: invalid SQL statement- when run a procedure in oracle 10g

[亡魂溺海] 提交于 2019-12-17 19:13:43

问题


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.


回答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;



回答2:


Lose the double-quotes around the name. They're a bad practice in Oracle.




回答3:


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();


来源:https://stackoverflow.com/questions/13722307/ora-00900-invalid-sql-statement-when-run-a-procedure-in-oracle-10g

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!