Re: Spool in SqlPlusa nd my doubt is How to send values to the variables in the WHERE clause.

From: Michel MB <mmiottobarbosa_at_gmail.com>
Date: Wed, 14 Jan 2015 03:51:46 -0800 (PST)
Message-ID: <c76716bd-8ca6-444d-807a-f6d3a186b752_at_googlegroups.com>


Dear

Is sufficient
==
export $StartDate=01/12/2014
exort $Enddate=31/12/2014
Before connecting in sqlplus ( sqlplus -S /nolog <<EOF CONNECT user/pwd_at_host:port/service_name; )

in Where clause, set ('$StartDate') ('$EndDate')

Thanks.

Em terça-feira, 13 de janeiro de 2015 16:52:56 UTC-2, 32442 escreveu:
> 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_at_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.id = d.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
Received on Wed Jan 14 2015 - 12:51:46 CET

Original text of this message