Logic Validation [message #270114] |
Tue, 25 September 2007 15:12 |
reksab_16
Messages: 8 Registered: September 2007
|
Junior Member |
|
|
Unix gurus,
I have a requirement in shell script where I have to connect to the DB and execute a script (Disabling Constraints) and subsequently do some loading process, if the disabling of the constraints is successful. Else, I have to write to the error file and abandon the process.
Error message is basically I want to take the first line in the Variable PM_Error.
The following is the Logic I wrote.
Is this valid? Any help on this is very much appreciated.
### SqlCall For Disabling the Constraints on anp_pmk_item_xref table
export PM_Error=`sqlplus -s $PM_UP <<END
set heading off
set verify off
set feedback off
set newp NONE
@anp_pmk_item_xref_dis_cons.sql
/
END`
if [expr $PM_Error : 'ORA-']
then
echo 'Unable to Disable the Constraints on anp_pmk_item_xref table>>${PM_ERRORFILE}
export err_mess= substr($PM_Error,1,match($PM_Error,' '))
echo $PM_Error>>${PM_ERRORFILE}
exit
fi
|
|
|
Re: Logic Validation [message #270168 is a reply to message #270114] |
Wed, 26 September 2007 00:48 |
|
Michel Cadot
Messages: 68716 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Quote: | Can anybody please help me on this?
|
Maybe not those who are awake and hearing.
And maybe if you'd follow the rules you'd get more answers.
Please read and follow OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format. Use the "Preview Message" button.
Please always post your Oracle version (4 decimals).
Regards
Michel
[Updated on: Wed, 26 September 2007 08:40] Report message to a moderator
|
|
|
Re: Logic Validation [message #270308 is a reply to message #270168] |
Wed, 26 September 2007 08:30 |
Frank Naude
Messages: 4581 Registered: April 1998
|
Senior Member |
|
|
Try something like this:
OUTPUT=`sqlplus -s scott/tiger <<END
SELECT * FROM dual;
EXIT 0;
END`
ERROR=`echo $OUTPUT | grep ORA-`
if [ "$ERROR" = "" ]; then
echo 'No error - continue'
else
echo 'Error - stop!'
fi
|
|
|
Re: Logic Validation [message #270394 is a reply to message #270168] |
Wed, 26 September 2007 14:25 |
reksab_16
Messages: 8 Registered: September 2007
|
Junior Member |
|
|
Frank,
Thanks for the needful. It was really helpful.
Can you please suggest me tutorial, which contains practical examples to begin with?
Thanks and regards,
Bhaskar Natarajan.
|
|
|
|
|
|