Computing.Net > Forums > Unix > out parameter to shell

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

out parameter to shell

Reply to Message Icon

Name: OraDev
Date: August 4, 2005 at 15:21:58 Pacific
OS: SunSolaris 2.6
CPU/Ram: 2G
Comment:

Hello all,
I have problems with my shell. I need to get “out” parameter from oracle stored procedure into shell display it. Please, tell me what I’m doing wrong?
Here is my shell:

#!/bin/ksh
COUNT
sqlplus -s user/pwd <<END
exec EVENT_VERIFY_ALL;
exec EVENT_PRC_ALL($COUNT);
exit;
END

echo "$COUNT records inserted"
exit 0

Here is my procedure:

PROCEDURE EVENT_PRC_ALL(P_COUNT OUT NUMBER)
IS

CURSOR MY_CUR
IS
SELECT COLUMN1
FROM Z_TABLE;

BEGIN

FOR MY_REC IN MY_CUR
LOOP
Insert into X_TABLE(COLUMN1)
VALUES(MY_REC.COLUMN1);
END LOOP;

p_count:=SQL%ROWCOUNT;

commit;

EXCEPTION
WHEN OTHERS THEN
ROLLBACK ;

END EVENT_PRC_ALL;

Any help appreciated!

OraDev



Sponsored Link
Ads by Google

Response Number 1
Name: Luke Chi
Date: August 4, 2005 at 15:56:14 Pacific
Reply:

create or replace procedure p_1
as
begin
dbms_output.put_line('123');
end;
/

#!/bin/ksh

RETURN_VALUE=`sqlplus -s <username>/<password> <<EOF
set feedback off
set serveroutput on
exec p_1;
EOF`

echo "$RETURN_VALUE records inserted"

Luke Chi


0

Response Number 2
Name: OraDev
Date: August 5, 2005 at 09:57:11 Pacific
Reply:

Brilliant! Thanks a lot!


0

Response Number 3
Name: Luke Chi
Date: August 6, 2005 at 07:31:48 Pacific
Reply:

You're welcome.

Luke Chi


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: out parameter to shell

Input parameters to shell script www.computing.net/answers/unix/input-parameters-to-shell-script/7083.html

I need a help from you. i am new to shell scr www.computing.net/answers/unix/i-need-a-help-from-you-i-am-new-to-shell-scr/8514.html

UNIX parameter variables www.computing.net/answers/unix/unix-parameter-variables/5402.html