Oracle Shell Script
From: The Magnet <art_at_unsu.com>
Date: Mon, 19 Jul 2010 21:49:07 -0700 (PDT)
Message-ID: <d317dd46-508c-4926-b25d-3e52c128af97_at_j8g2000yqd.googlegroups.com>
I know how to use a shell variable in a query from shell. Can anyone help?
data_rec=`sqlplus -s $user/${password} << "EOF" set heading off feedback off verify off timing off SELECT owner||':'||name
FROM replicated_tables
WHERE obj_type = '$type';
exit
EOF` However, I cannot seem to replace the FROM table:
cnt=`sqlplus -s $user/${password} << "EOF" set heading off feedback off verify off timing off SELECT count(*) FROM '$table';
exit;
#EOF` + cnt= SELECT count(*) FROM '$table'
ERROR at line 1:
ORA-00903: invalid table name Received on Mon Jul 19 2010 - 23:49:07 CDT
Date: Mon, 19 Jul 2010 21:49:07 -0700 (PDT)
Message-ID: <d317dd46-508c-4926-b25d-3e52c128af97_at_j8g2000yqd.googlegroups.com>
I know how to use a shell variable in a query from shell. Can anyone help?
This works fine
data_rec=`sqlplus -s $user/${password} << "EOF" set heading off feedback off verify off timing off SELECT owner||':'||name
FROM replicated_tables
WHERE obj_type = '$type';
exit
EOF` However, I cannot seem to replace the FROM table:
This Fails
cnt=`sqlplus -s $user/${password} << "EOF" set heading off feedback off verify off timing off SELECT count(*) FROM '$table';
exit;
#EOF` + cnt= SELECT count(*) FROM '$table'
*
ERROR at line 1:
ORA-00903: invalid table name Received on Mon Jul 19 2010 - 23:49:07 CDT