Re: Oracle Shell Script

From: Eric Stahl <eric.stahl_at_earthlink.net>
Date: Mon, 19 Jul 2010 22:03:15 -0700
Message-ID: <fdba46l8a6m5cmj68l79kn5nlc7kjft8ph_at_4ax.com>



On Mon, 19 Jul 2010 21:49:07 -0700 (PDT), The Magnet <art_at_unsu.com> wrote:

>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
>

 "table" as a reserved keyword? Received on Tue Jul 20 2010 - 00:03:15 CDT

Original text of this message