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: <nasof_at_hotmail.com>
Date: Tue, 11 Aug 1998 00:23:08 GMT
Message-ID: <6qo2tc$6b1$1@nnrp1.dejanews.com>

You could make a view for this, but you would still be hardcoding the table names in the view.

Sounds like the data should be all one table anyway with an addtional field of sales_code.

It gets difficult to do things in a relational database when it is used as anything but that. For example, if we have tables like employee_bob, employee_sam, employee_sarah, etc... each with the same fields, we're eventually going to run into problems like the one you are presented with.

I'd say take your lickin's and get to hard-coding...

In article <35CF90B4.D1BECF6C_at_btinternet.com>,   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
>
>

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Mon Aug 10 1998 - 19:23:08 CDT

Original text of this message

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