Home » Infrastructure » Unix » urgent !! how to reture value to unix from plsql block
urgent !! how to reture value to unix from plsql block [message #41616] Thu, 16 January 2003 19:38 Go to next message
vicky
Messages: 14
Registered: October 2000
Junior Member
I m calling from Unix command the oracle
The oracle is executing the stored procedure ....

sqlplus -S username/password@servername @file.sql

DECLARE
P_ERROR_CODE VARCHAR2(1);
BEGIN
P_ERROR_CODE := NULL;
// CALL PROCEDURE AND PRINT ERROR CODE
PG_CRM_COMMON.PR_EIM_CLEAN('IMPORT','EIM_CAMP_CON',21000,21999,100000,P_ERROR_CODE);
dbms_output.put_line('The Error Code from The stored procedure is P_ERROR_CODE is '||P_ERROR_CODE);
EXCEPTION
WHEN OTHERS THEN
P_ERROR_CODE := '3';
END;

I have to get back the error code to unix for some further processing,
can any body how to get back the error code ..... to unix
as i m executing oracle

I appreciate for earnest reply
thanx
Vicky
Re: urgent !! how to reture value to unix from plsql block [message #41634 is a reply to message #41616] Fri, 17 January 2003 12:19 Go to previous message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
C:OracleOra81BIN>type osscr.ksh
sqlplus -s tricore/password@larch_prod @scr
if [[ $? -eq 1 ]]
then
        echo "Data found"
else
        echo  "No data found"
fi

----------------------------------------------------------------------

C:OracleOra81BIN>type scr.sql
variable b number
declare
name varchar2(10);
jo   varchar2(10);
begin
select ename,job into name,jo from emp where empno=&empno;
dbms_output.put_line(name||','||jo);
:b :=1;
Exception
        when no_data_found then
        :b :=2;
end;
/
exit :b;

----------------------------------------------------------------------

C:OracleOra81BIN>ksh
$ ./osscr.ksh
Enter value for empno: 7369
old   5: select ename,job into name,jo from emp where empno=&empno;
new   5: select ename,job into name,jo from emp where empno=7369;

PL/SQL procedure successfully completed.

Data found
$ ./osscr.ksh
Enter value for empno: 993
old   5: select ename,job into name,jo from emp where empno=&empno;
new   5: select ename,job into name,jo from emp where empno=993;

PL/SQL procedure successfully completed.

No data found
$

Previous Topic: Error: while installing oracle 7.3.3 on solarix 7 URGENT
Next Topic: Oracle Errors in Unix
Goto Forum:
  


Current Time: Tue Nov 26 05:46:48 CST 2024