Problems executing sql script from Unix


I have the following function in Oracle database and below is the script which I am trying to execute in Unix/CYGWIN and I am stuck in screen. Can someone guide me where I am wrong?

CREATE OR REPLACE function SCOTT.fn_multi_returns ( a in number, b in out number, c out number)
return number
as
d number;
begin
b  := b + a;
c := b;
d := a+b+c;
return d;
end;
/


sqlplus -s scott/tiger 

declare
a number:=3;
b number:=4;
c number;
d number;
begin
d := fn_multi_returns(a,b,c);
commit;
dbms_output.put_line(d);
end;

exit

Open in new window

d27m11yAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
Create a HERE script:

sqlplus -s scott/tiger  << EOF

--  the rest of your code

EOF
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sdstuberCommented:
also note, if you want to see the output, you'll need to


set serveroutput on

then invoke your pl/sql block
0
d27m11yAuthor Commented:
I tried the below code as you said and I am getting the error

"SP2-0735: unknown SET option beginning "severoutpu..."

Please guide where I did wrong for "set serveroutput on"
set severoutput on;
declare
a number:=3;
b number:=4;
c number;
d number;
begin
d := fn_multi_returns(a,b,c);
commit;
dbms_output.put_line(d);
end;

exit

EOF

Open in new window

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

d27m11yAuthor Commented:

Sorry, below is my code
sqlplus -s scott/tiger << EOF



set severoutput on;
declare
a number:=3;
b number:=4;
c number;
d number;
begin
d := fn_multi_returns(a,b,c);
commit;
dbms_output.put_line(d);
end;

exit

EOF

Open in new window

0
sdstuberCommented:
you typed it wrong

set serveroutput on


and no semicolon
0
d27m11yAuthor Commented:
It still gives me error as

SP2-0735: unknown SET option beginning "severoutpu..."

PL/SQL procedure successfully completed.

sqlplus -s scott/tiger << EOF



set severoutput on
declare
a number:=3;
b number:=4;
c number;
d number;
begin
d := fn_multi_returns(a,b,c);
commit;
dbms_output.put_line(d);
end;
/
exit

EOF

Open in new window

0
sdstuberCommented:
read the error message, you still have

severoutput

and not

serveroutput
0
d27m11yAuthor Commented:
oops, my bad! I got it now.. thank you so much!
0
d27m11yAuthor Commented:
Very helpful!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.