Re: Spool in SqlPlusa nd my doubt is How to send values to the variables in the WHERE clause.
Date: Wed, 14 Jan 2015 18:31:54 +0000 (UTC)
Message-ID: <pan.2015.01.14.18.32.06_at_gmail.com>
On Tue, 13 Jan 2015 10:52:47 -0800, 32442 wrote:
> 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
There is a gazillion methods of how to do that, all described on the Internet. Google is your friend. If you are too lazy to use a search engine, try the list for idiots, namely oracle-l_at_freelists.org. They would welcome you there.
-- Mladen Gogala The Oracle Whisperer http://mgogala.byethost5.com Je suis CharlieReceived on Wed Jan 14 2015 - 19:31:54 CET