ControlAltDelete
ControlAltDelete

Reputation: 3694

SQL Multiple Functions in One SQL File

I have a question regarding defining two functions back to back with PL/SQL. Below is the code I have:

create or replace procedure test2(mynum in integer, retnum out integer)
as
begin
    DBMS_OUTPUT.put_line(mynum + 1);
    retnum := 1000;
end;



create or replace procedure test3(mynum in integer, retnum out integer)
as
begin
    DBMS_OUTPUT.put_line(mynum + 1);
    retnum := 1000;
end;

When I run it I get the following error, but when I create the functions separately I do not. Am I missing some keyword to separate the two declarations?

Procedure TEST2 compiled

LINE/COL ERROR


10/1 PLS-00103: Encountered the symbol "CREATE" Errors: check compiler log

Upvotes: 2

Views: 2523

Answers (1)

Miroslav Duník
Miroslav Duník

Reputation: 606

After every PL/SQL statement you should properly end it by adding / on a separate line as this is the "master delimiter".

Try to save your script as this:

create or replace procedure test2(mynum in integer, retnum out integer)
as
begin
    DBMS_OUTPUT.put_line(mynum + 1);
    retnum := 1000;
end;
/

create or replace procedure test3(mynum in integer, retnum out integer)
as
begin
    DBMS_OUTPUT.put_line(mynum + 1);
    retnum := 1000;
end;
/

Upvotes: 4

Related Questions