Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Running DDL statement via ksh script

User502636-OCAug 26 2014 — edited Aug 27 2014

I need to run a DDL statement(such as ALTER USER)  via ksh script and capture the result to be able to chekc whether the statement succeeded or failed.

I wrote a script below:

sql="ALTER USER test....;"

sqlplus -s / as sysdba << EOF > $MYFILE

whernever sqlerror exit 1 rollback

$sql

commit;

exit;

EOF

When I run the script above, I get "User altered.  Commit complete." written to a file.

Is there an easy way of checking the file contents programmatically to see if ALTER USER statement succeeded or to output the result to a variable instead of a file?

This post has been answered by John Spencer on Aug 26 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 24 2014
Added on Aug 26 2014
11 comments
3,762 views