TPR
TPR

Reputation: 2577

oracle - run stored procedure from script

I've a script that I am using to build/drop tables and basically setting up the entire schema. After googling, I still can't figure out how to run a stored procedure.

The script is a .txt file, and I run it using Apex SQL Oracle.

If I write only this line in a script:

execute procedurename(1); --where 1 is paramter. 

You have requested to run a script that does not contain any runnable statements.

Upvotes: 1

Views: 31123

Answers (2)

ShoeLace
ShoeLace

Reputation: 3576

SQL>create or replace procedure procedurename(p_num number) 
as 
begin 
null; 
end;
/

Procedure created.

SQL>execute procedurename(1);

PL/SQL procedure successfully completed.

everything seems ok on SQLPLUS with oracle 11.

so it must be an apex thing.

Upvotes: 2

psaraj12
psaraj12

Reputation: 5072

Since execute is a sqlplus statement ,try calling the procedure using begin-end PLSQL block in Apex SQL

BEGIN
procedurename(1); 
END;
/

save this in a file proc_call.sql and then call it in your script like

 @C:\proc_call.sql 

where C: is the sample path

For some information refer the below link

https://forums.oracle.com/forums/thread.jspa?threadID=618393

Upvotes: 1

Related Questions