Re: need help with a query, please

From: Prakash <venkatprakash_at_hotmail.com>
Date: 2000/07/20
Message-ID: <8l808a$bhl$1_at_nnrp1.deja.com>#1/1


Hope this work work:
set termout off echo off feed off trimspool on head off pages 0

spool countall.tmp

select 'SELECT orderid, tracenumber, username from '||table_name||';' from user_tables where orderid = '963262260741' /

spool off

set termout on
_at__at_countall.tmp

set head on feed on

Thanks

V Prakash

In article <Tg9d5.49564$i5.697114_at_news1.frmt1.sfba.home.com>,   "Michael J. Moore" <hicamel_at_home.com> wrote:
> Why don't you UNION the tables if they all have the same structure.
 You
> could do it with a VIEW and that would make your select statement look
> exactly like the one you already wrote below.
> Mike
>
> "Joe Driscoll" <joed_at_icoms.com> wrote in message
> news:39747826.9B158BFE_at_icoms.com...
> >
> > I have some 250 tables that have the same structure and I need to
 search
> > each one for a specific entry. here is the query that I have to
 check
> > just one table:
> >
> > select orderid, tracenumber, username
> > from sp236_transaction
> > where orderid = '963262260741'
> >
> > the sp236 is the only thing that changes in the table name and this
> > query. Is there a way I can loop through all 250 tables?
> >
> > TIA
> >
> > Joe
> >
>
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Thu Jul 20 2000 - 00:00:00 CEST

Original text of this message