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

Home -> Community -> Usenet -> c.d.o.server -> Re: Help, SQL Problem!!!

Re: Help, SQL Problem!!!

From: Patrick <Groeps_at_mail.interpac.be>
Date: 11 Aug 1998 07:10:53 GMT
Message-ID: <01bdc4f7$e9833be0$2dfa4ec2@internet>


You can also use dynamic SQL :

In PL/SQL use DBMS_SQL package
IN Pro*C or other Precompilers you have different levels of dynamic sql to choose from.
Put it into a loop with a incrementing variable Re-parse each time the statement

wkkkdkgk_at_worldnet.att.net wrote in article <35cfaa05.53611690_at_netnews.worldnet.att.net>...
> Better yet, use dba_tables table to build a "create view" ddl with all
> the unions in it, and select from the view to extract your data
> extract.
>
> On Mon, 10 Aug 1998 20:30:44 -0400, Valerie St Esteve
> <val22.se_at_btinternet.com> wrote:
>
> >Hi
> >
> >I hope this doesn't seem like a silly question but I'm new to all this.
> >Is there any way to dynamically alter the FROM part of a select
> >statement either in SQL or PL/SQL.
> >
> >My requirement is this: I have to gather data from 52 tables all of
> >which have an identical structure. They are only differentiated by their
> >names. The first is called sales_00001, the next sales_00002 and so on.
> >All the data has to be spooled into a single text file in one go.
> >Apart from coding a query that has 52 selects all unioned together with
> >hardcoded table names for each of the tables, is there any way of having
> >a single select statement, say within some kind of loop that has its
> >from part dynamically altered for each iteration of the loop. If so, how
> >do I achieve this? I can't find out how it is done anywhere.
> >
> >Thanks in advance
> >
> >Val
> >
>
>
Received on Tue Aug 11 1998 - 02:10:53 CDT

Original text of this message

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