executing SQL query using unix shell script

I want to perform few post-session success tasks like update a status to 'true' in one of the sql database table, update date values to current system date in one of the configuration table in sql. How do i achieve this in a post session command?syntax with example will be helpful.

Yep, i dont know how to do this shell script.

But if possible call a PERL script, and use DBI to do the database operations from PERL script, hope this helps.

Here's how I do it in Oracle. I don't know if it will work for you or not, but you can test it.

sqlplus -s /NOLOG <<EOF
   connect username/password
   select 'blah' from dual;
   exit
EOF

If you need to store the returned value:

MYVAL=$(sqlplus -s /NOLOG <<EOF
   connect username/password
   select 'blah' from dual;
   exit
EOF)

Yup as said by jsmithstl, you need to use the here doc.

for mysql use :
mysql -u <user> -p<pwd> -e "<your query>"

Cheers