Technology and Everything…..

Posts Tagged ‘shell oracle’

Accessing Oracle Database from Unix Shell Script

Posted by Shibu on August 5, 2008

Many times when you develop shell script for deployment or batch job often you have to check some database field values. I will show you how you can access database field value into unix shell variable.


DB_CHECK=`sqlplus -s user_name/<pass_word> <<EOF

set pages 0

set lines 2000

set heading off

select ‘OK’ from dual;



echo $DB_CHECK

Here you can have multiple line in the select statement. If you have multiple lines you have to put ‘\’ at the end of each line except the last line.


Posted in Technology | Tagged: | Leave a Comment »