1 Reply Latest reply on Jan 13, 2015 8:56 PM by Gary Graham-Oracle

    Spool in Sql Plus - my doubt is How to send values to the variables in the WHERE clause

    korrq

      ALL Experts

       

      I am testing the

      spool procedure in sqlplus

      and my doubt is how to send values to the variables in the WHERE clause.

       

      As in the example below;

      =============================================================

      sqlplus -S /nolog <<EOF

      CONNECT user/pwd@host:port/service_name;

       

      set echo on;

      set serveroutput on;

      set termout off;

       

      set head on;

      set pagesize 10000;

      set linesize 10000;

       

      spool /opt/oracle/xxxxyyyy.csv REPLACE

       

      select       x, y, z

      FROM         r    inner join d.d      on r.idd.id

                        inner join s on d.id = s.id

                        inner join dm   on r.id = dm.id

      WHERE

         TO_CHAR(s.date,'DD/MM/YYYY') >= ('&StartDate')

      AND

         TO_CHAR(s.date,'DD/MM/YYYY') <= ('&EndDate')

      spool off;

      set echo on

      EOF

      exit

      ==========================================================

       

      How could send linux sheel values for the variables (WHERE), &StartDate and &EndDate ?

       

      Thanks for any help