Quote:
Originally Posted by
scottn
I agree with this:
Don't understand this:
What is here to understand? He needs an interaction with the database - and it might be better way to do it within a single transaction (or several related transactions if DDL is performed). Since it might be difficult in sqlplus - you need another option. Perl's DBI might be a choice. I believe that a PL/SQL code (might be anonymous) might be a better choice.
Quote:
Originally Posted by
scottn
And completely disagree with this
I have written that you
should not (note the difference between "should not" and "cannot") use korn shell for complex code. Not that it cannot be used for complex things - it can do artificial inteligence if you want it to. However for complex things other choices (perl, python, java, ...) are usually much more optimal.
If you don't agree then I wish you luck in writing 3D accelerated games in ksh
Complex ksh code might be difficult to read and maintain. Code might be distributed across thousands of scripts executed as functions named like a_my_function which is in fact "${x}_${y}_${z}". There is no separation between modules and people tend to use variables without declaration (try running "set -u"). You don't have references, objects, streams, inheritance, overloading, debugging, libraries, private methods, multi-threading, ...
You can find several games written in shell... try reading that mess. Then compare it to other game sources.
As for the original question, you wanted to:
1. Run some script, let say A.sql
2. Check if A.sql failed
3. Run B.sql if A.sql did not fail... probably rollback the changes if A.sql failed
In shell you would need to spool the output from sqlplus, grep it and quess what might fail (ex. grep the output by "error" string and be lucky to have there nothig like "create table my_errors(error char(10))") with checking the return code and then execute the second script.
PL/SQL script might try to work in a single transaction and have "rollback" in the exception handler. If you use any DDL there then flashback mechanism might be used.