HOW TO INCLUDE LOG IN INFORMATION IN AN SQL SCRIPT

Tags:
Database
Oracle
Oracle 9i
Scripting
SQL
Windows Server 2003
Please I have an SQL update statement which I want to put in an SQL script which users can run to update an oracle9i database running on a windows 2003 server.The statement is as follows: update jobs set JOBSTATE = 3 where APPID = 5 ; COMMIT; Exit I do not want users to be opening the script and be putting username, password and database name when they want to run the script but I want to include the username, password and database name inside the script so that when they just run it will automatically log in and update the table. Please How can I write such SQL script? So that users will not have reason to be editing the script. Thank you, Idongesit Daniel Udoh idongesitu@yahoo.com

Answer Wiki

Thanks. We'll let you know when a new response is added.

Suggestion is somthing like the following:

. ${HOME}/.profile
……
sqlplus $ASQLUSER @$SQL_DEPOT/sqlplus_filename.sql
……
if [ Check-ERROR-Condition-of-SQL-Output-File ]
then
echo “The Tariff Group Revert Back to Residential Type Customer for Antillia is not completed.” | mailx -s “A
NTILLIA BOC ERROR $0″ $MAILTO
exit;
fi

= = = = = = = = = = = = = = = = = = = = = =
In . ${HOME}/.profile

$ASQLUSER=rcrp/rcrp

= = = = = = = = = = = = = = = = = = = = = =
In $SQL_DEPOT/sqlplus_filename.sql

spool $SQL_DEPOT/LOGS/sqlplus_filename.log
update PRICE_CLASS_DET set PCD_VALUE=1 where PCD_ID=11313;
commit;

= = = = = = = = = = = = = = = = = = = = = =

The above is from a Unix system, but you could incorporate a large portion of it to a DOS script.

Hope it helps some.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following