|
-
Hello
You might try this
#!/bin/bash
sqlplus user/passwd@move << EOF
select * from kk;
variable temp number
whenever sqlerror exit sql.sqlcode;
begin
:temp := 25; -- this is really a function call, not 25
if ( :temp <> 0 )
then
raise_application_error( (-20000-224) - :temp, 'test' );
end if;
end;
/
EOF
echo $?
i havent tested this as i am not very good at shell scripts
the crux of the logic is raise_application_error( (-20000-224) - :temp, 'test' );
We can raise errors in a given range but the probelm lies with unix shell as the shell will only keep an unsigned byte in the status return value (values 0..255). It takes our exit file and just looks at that last byte. By using -20000-224 and subtracting from the your return code -- we end up exiting with the value of your return code
regards
Hrishy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|