How To Use SQL to Create a File that Bash can Query
1#Query the host_details for the type of host
2sqlplus <user>/<userpassword>@<instance> > $tmpFile << EOF
3SET ECHO OFF
4SET HEADING OFF
5SET PAGES 100
6SET FEEDBACK OFF
7SELECT host_name, host_type
8 FROM host_details
9 WHERE host_name '$dbname'
10 AND host_type IN (1, 4)
11EOF
12
13# Get the host type from the file
14hostType=$(grep $dbName $tmpFile | awk '{ print $2}' )