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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: sql query read from text file

Re: sql query read from text file

From: Vladimir Begun <jester_at_whale.sunbay.crimea.ua>
Date: Tue, 19 Jun 2001 23:53:30 -0700
Message-ID: <F001.0032F820.20010619231546@fatcity.com>

On Jun 19, 2001 at 12:17:32PM, Seema Singh wrote:
> Hi
> If i have one file a.txt and I want to put that content in where clause of
> sql statement then how can I do it.
> Example :
> a.txt content
> 98989
> 67676
> 898989
> Select x,y,z from abc
> where x in (98989,67676,898989)
> /

create file named modify.ed, put the following commands:

1,$-1s/$/,/
$s/$/);/
w
q

your SQL*Plus script

SET FEEDBACK OFF TERMOUT OFF
SPOOL _launch.sql
PROMPT SELECT x, y, z FROM abc WHERE x IN ( SPOOL OFF
!ed -s a.txt < modify.ed; cat a.txt >> _launch.sql REM a.txt is modified!!!
SET FEEDBACK ON TERMOUT ON
REM @@_launch.sql

-- 
Vladimir Begun               | If you push the "extra ice" button on the
http://vbegun.net/           | soft drink vending machine, you won't get
http://vbegun.net/wap/       | any ice.  If you push the "no ice" button,
me_at_vbegun.net                | you'll get ice, but no cup.
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Vladimir Begun
  INET: jester_at_whale.sunbay.crimea.ua

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Wed Jun 20 2001 - 01:53:30 CDT

Original text of this message

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