Simple Error trapping in SQLplus in Oracle
Date: 15 May 2003 16:44:00 -0700
Message-ID: <4baec153.0305151544.10b4bb05_at_posting.google.com>
Hi,
I do the following using ksh - scripting on an Oracle database:
update table1 set field1 = 'xxx' where field1 = 'yyyy';
insert into table2
+++++++++++++++++++
sqlplus username/PASS_at_Database << EOF
(field1,
field2,
field3)
values ('value1',
'value2',
'value3);
insert into table3
(field1,
field2,
field3)
values ('value1',
'value2',
'value3);
insert into table4
(field1,
field2,
field3)
values ('value1',
'value2',
'value3);
exit;
EOF
+++++++++++++++++++
The question is : How can I do an error trap on each SQL statement, so that the moment it generates an error (doesn't matter what), it does a rollback and exit out of the sqlplus ??
Cheers
Lourens
Received on Fri May 16 2003 - 01:44:00 CEST