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: Accessing 2 tables with 1 name

Re: Accessing 2 tables with 1 name

From: Sybrand Bakker <gooiditweg_at_sybrandb.demon.nl>
Date: Tue, 01 Jul 2003 22:46:35 +0200
Message-ID: <0ir3gvgnk8ie7evt3a54mr51i9rm7rbg2d@4ax.com>


On 1 Jul 2003 13:05:16 -0700, mperrault_at_ingdirect.com (Mark Perrault) wrote:

>I have 2 IDENTICAL tables (TableName_A and TableName_B) that I use in
>my production system. I have a table (TableState) with 1 row and 1
>column whose value determines which table is the "active set". (ie,
>TableState had a column named TableSet whose value is either 'A' or
>'B').
>
>I would like to setup a view that can allow me to write queries with
>"from Tablename" where the selection of A or B is done in the
>background on the fly.
>
>Is this possible?
>
>Thanks,
> Mark

yes it is possible by simply
select * from table_a
union
select * from table_b

However, it looks like you really should merge the 2 tables into one, and setup table_a and table_b as views with check option. Likely much more efficient.

Sybrand Bakker, Senior Oracle DBA

To reply remove -verwijderdit from my e-mail address Received on Tue Jul 01 2003 - 15:46:35 CDT

Original text of this message

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