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?