dbTalk Databases Forums  

Static Select statements

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Static Select statements in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ubiquitous
 
Posts: n/a

Default Static Select statements - 03-28-2008 , 01:19 PM






Is there a way to force a static row in a SELECT statement?

For example, I have a SELECT statement which is a UNION of two identical
tables, "A" and "B". How would one create a column which identifies the source
table?

TABLE NAME REC#
----- ---- ----
A Bob 001
A Tim 002
B Joe 001
A Sue 003



Reply With Quote
  #2  
Old   
Patrick
 
Posts: n/a

Default Re: Static Select statements - 03-28-2008 , 01:42 PM






On Mar 28, 3:19*pm, Ubiquitous <web... (AT) polaris (DOT) net> wrote:
Quote:
Is there a way to force a static row in a SELECT statement?

For example, I have a SELECT statement which is a UNION of two identical
tables, "A" and "B". How would one create a column which identifies the source
table?

TABLE NAME REC#
----- ---- ----
A * * Bob *001
A * * Tim *002
B * * Joe *001
A * * Sue *003
This should work:

Select 'A' as 'TABLE', name, recno
from a
UNION
select 'B' as 'TABLE', name, recno
from b


Reply With Quote
  #3  
Old   
Patrick
 
Posts: n/a

Default Re: Static Select statements - 03-28-2008 , 01:42 PM



On Mar 28, 3:19*pm, Ubiquitous <web... (AT) polaris (DOT) net> wrote:
Quote:
Is there a way to force a static row in a SELECT statement?

For example, I have a SELECT statement which is a UNION of two identical
tables, "A" and "B". How would one create a column which identifies the source
table?

TABLE NAME REC#
----- ---- ----
A * * Bob *001
A * * Tim *002
B * * Joe *001
A * * Sue *003
This should work:

Select 'A' as 'TABLE', name, recno
from a
UNION
select 'B' as 'TABLE', name, recno
from b


Reply With Quote
  #4  
Old   
Patrick
 
Posts: n/a

Default Re: Static Select statements - 03-28-2008 , 01:42 PM



On Mar 28, 3:19*pm, Ubiquitous <web... (AT) polaris (DOT) net> wrote:
Quote:
Is there a way to force a static row in a SELECT statement?

For example, I have a SELECT statement which is a UNION of two identical
tables, "A" and "B". How would one create a column which identifies the source
table?

TABLE NAME REC#
----- ---- ----
A * * Bob *001
A * * Tim *002
B * * Joe *001
A * * Sue *003
This should work:

Select 'A' as 'TABLE', name, recno
from a
UNION
select 'B' as 'TABLE', name, recno
from b


Reply With Quote
  #5  
Old   
Patrick
 
Posts: n/a

Default Re: Static Select statements - 03-28-2008 , 01:42 PM



On Mar 28, 3:19*pm, Ubiquitous <web... (AT) polaris (DOT) net> wrote:
Quote:
Is there a way to force a static row in a SELECT statement?

For example, I have a SELECT statement which is a UNION of two identical
tables, "A" and "B". How would one create a column which identifies the source
table?

TABLE NAME REC#
----- ---- ----
A * * Bob *001
A * * Tim *002
B * * Joe *001
A * * Sue *003
This should work:

Select 'A' as 'TABLE', name, recno
from a
UNION
select 'B' as 'TABLE', name, recno
from b


Reply With Quote
  #6  
Old   
Ubiquitous
 
Posts: n/a

Default Re: Static Select statements - 03-31-2008 , 04:03 AM



bigbuck714 (AT) aol (DOT) com wrote:
Quote:
On Mar 28, 3:19*pm, Ubiquitous <web... (AT) polaris (DOT) net> wrote:

Is there a way to force a static row in a SELECT statement?

For example, I have a SELECT statement which is a UNION of two identical
tables, "A" and "B". How would one create a column which identifies the
source table?

TABLE NAME REC#
----- ---- ----
A * * Bob *001
A * * Tim *002
B * * Joe *001
A * * Sue *003

This should work:

Select 'A' as 'TABLE', name, recno
from a
UNION
select 'B' as 'TABLE', name, recno
from b
Thank you! That's exactly what I was seeking!
The 'TABLE' literal should be enclosed with double quoyes ("), however.



Reply With Quote
  #7  
Old   
Ubiquitous
 
Posts: n/a

Default Re: Static Select statements - 03-31-2008 , 04:03 AM



bigbuck714 (AT) aol (DOT) com wrote:
Quote:
On Mar 28, 3:19*pm, Ubiquitous <web... (AT) polaris (DOT) net> wrote:

Is there a way to force a static row in a SELECT statement?

For example, I have a SELECT statement which is a UNION of two identical
tables, "A" and "B". How would one create a column which identifies the
source table?

TABLE NAME REC#
----- ---- ----
A * * Bob *001
A * * Tim *002
B * * Joe *001
A * * Sue *003

This should work:

Select 'A' as 'TABLE', name, recno
from a
UNION
select 'B' as 'TABLE', name, recno
from b
Thank you! That's exactly what I was seeking!
The 'TABLE' literal should be enclosed with double quoyes ("), however.



Reply With Quote
  #8  
Old   
Ubiquitous
 
Posts: n/a

Default Re: Static Select statements - 03-31-2008 , 04:03 AM



bigbuck714 (AT) aol (DOT) com wrote:
Quote:
On Mar 28, 3:19*pm, Ubiquitous <web... (AT) polaris (DOT) net> wrote:

Is there a way to force a static row in a SELECT statement?

For example, I have a SELECT statement which is a UNION of two identical
tables, "A" and "B". How would one create a column which identifies the
source table?

TABLE NAME REC#
----- ---- ----
A * * Bob *001
A * * Tim *002
B * * Joe *001
A * * Sue *003

This should work:

Select 'A' as 'TABLE', name, recno
from a
UNION
select 'B' as 'TABLE', name, recno
from b
Thank you! That's exactly what I was seeking!
The 'TABLE' literal should be enclosed with double quoyes ("), however.



Reply With Quote
  #9  
Old   
Ubiquitous
 
Posts: n/a

Default Re: Static Select statements - 03-31-2008 , 04:03 AM



bigbuck714 (AT) aol (DOT) com wrote:
Quote:
On Mar 28, 3:19*pm, Ubiquitous <web... (AT) polaris (DOT) net> wrote:

Is there a way to force a static row in a SELECT statement?

For example, I have a SELECT statement which is a UNION of two identical
tables, "A" and "B". How would one create a column which identifies the
source table?

TABLE NAME REC#
----- ---- ----
A * * Bob *001
A * * Tim *002
B * * Joe *001
A * * Sue *003

This should work:

Select 'A' as 'TABLE', name, recno
from a
UNION
select 'B' as 'TABLE', name, recno
from b
Thank you! That's exactly what I was seeking!
The 'TABLE' literal should be enclosed with double quoyes ("), however.



Reply With Quote
  #10  
Old   
sybrandb@hccnet.nl
 
Posts: n/a

Default Re: Static Select statements - 04-03-2008 , 05:28 PM



On Mon, 31 Mar 2008 05:03:21 -0400, Ubiquitous <weberm (AT) polaris (DOT) net>
wrote:

Quote:
bigbuck714 (AT) aol (DOT) com wrote:
On Mar 28, 3:19*pm, Ubiquitous <web... (AT) polaris (DOT) net> wrote:

Is there a way to force a static row in a SELECT statement?

For example, I have a SELECT statement which is a UNION of two identical
tables, "A" and "B". How would one create a column which identifies the
source table?

TABLE NAME REC#
----- ---- ----
A * * Bob *001
A * * Tim *002
B * * Joe *001
A * * Sue *003

This should work:

Select 'A' as 'TABLE', name, recno
from a
UNION
select 'B' as 'TABLE', name, recno
from b

Thank you! That's exactly what I was seeking!
The 'TABLE' literal should be enclosed with double quoyes ("), however.
Incorrect.

Sybrand Bakker
Senior Oracle DBA


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.