Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 956
kumar Avatar asked Dec 05 '12 11:12

kumar


People also ask

How to check if Procedural option is installed?

You can determine if the Procedural Option is installed by starting SQL*Plus. If the PL/SQL banner is not displayed, then the option is not installed. Action: Correct the syntax or install the Procedural Option.

What is the error ORA 00913?

This error occurs when the second set contains more items than the first set. For example, the subquery in a WHERE or HAVING clause may return too many columns, or a VALUES or SELECT clause may return more columns than are listed in the INSERT.


2 Answers

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;
like image 125
Kirill Leontev Avatar answered Oct 04 '22 20:10

Kirill Leontev


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();
like image 40
Michael Kremser Avatar answered Oct 04 '22 21:10

Michael Kremser