Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Quick Question on Passing Parameters

Re: Quick Question on Passing Parameters

From: <amerar_at_iwc.net>
Date: 25 Sep 2006 10:20:33 -0700
Message-ID: <1159204833.717161.96870@k70g2000cwa.googlegroups.com>

Ok, found the answer with enough f**king around. For whatever reason, this works:

sqlplus -s /@$sid << EOT 1>>$LOG_FILE 2>>$LOG_FILE

   set autoprint off
   set feedback off
   set head off
   set term off
   set pages 0
   set echo off
   set lines 150
   col data_type format a20
   spool ${sid}.txt
   SELECT table_name, column_id, column_name, data_type, data_length FROM dba_tab_columns WHERE owner = '$db_user' ORDER BY table_name, column_id;

   spool off
   exit
EOT Notice the curly braces around the spool file name.........

I never saw that before.

amerar_at_iwc.net wrote:
> Hi All,
>
> I need to pass some parameters into SQLPLUS. I am doing this from a
> Korn Shell script. However, we do NOT have a stored SQL .sql script on
> disk, rather we are using this syntax:
>
> sqlplus -s /@$sid << EOT 1>>$LOG_FILE 2>>$LOG_FILE
> set autoprint off
> set feedback off
> set head off
> set term off
> set pages 0
> set echo off
> set lines 150
> col data_type format a20
> spool /u/oracle/tables.txt
> SELECT table_name, column_id, column_name, data_type, data_length
> FROM dba_tab_columns WHERE owner = '$db_user' ORDER BY table_name,
> column_id;
> spool off
> exit
> EOT
>
> Where on that line will the parameters go? Basically I want to create
> a dynamic spool file name. But as I said, we are not using stored
> scripts on disk, so there is no .sql file to call....
>
> I've tried the following with errors:
>
> sqlplus -s /@$sid << EOT 1>>$LOG_FILE 2>>$LOG_FILE 'ABC'
> sqlplus -s /@$sid 'ABC' << EOT 1>>$LOG_FILE 2>>$LOG_FILE
>
> Please advise
>
> Thanks!
Received on Mon Sep 25 2006 - 12:20:33 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US