How to execute an oracle stored procedure?

Viewed 399170

I am using oracle 10g express edition. It has a nice ui for db developers. But i am facing some problems executing stored procedures.

Procedure:

create or replace procedure temp_proc is
begin
  DBMS_OUTPUT.PUT_LINE('Test');
end

it is created successfully. But when i execute:

execute temp_proc;

it shows ORA-00900: invalid SQL statement

So help needed here

7 Answers

I use oracle 12 and it tell me that if you need to invoke the procedure then use call keyword. In your case it should be:

begin
  call temp_proc;
end;

In Oracle SQL Developer (GUI), using 12c, also don't forget to enable the DMBS Output window (click View => Dbms Output, then click "+" sign, and select your connection), by default the window is not enabled.

DBMS Output window DBMS output window enabled

The following syntax will then output to this window:

begin
  temp_proc
end;

You can do simply the following on the Command Window:

Connected to Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 
Connected as XXX@YYY


SQL> call temp_proc();

Or:

SQL> execute temp_proc();
Related