Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

SQL Add Dummy Column to Select Statement

Matt HawkinsApr 18 2007 — edited May 24 2007
Hello,

I am trying to create a query that retrieves all columns from a table but also add a dummy column. I am testing the query in SQL Workshop. (The intention is that the results of this query will be used as the source of a PDF output).

If I try :

select * from MY_TABLE where ID=1500

I get one row returned with all columns (as expected).

If I try :

select 'Dummy Column Text' as DUMMYCOL from MY_TABLE where ID=1500

I get one row returned but with only one column (as expected)

What I am trying to do is :

select 'Dummy Column Text' as DUMMYCOL, * from MY_TABLE where ID=1500

I expect one row to be returned with all available columns plus an extra column called DUMMYCOL containing the text 'Dummy Column Text'.

This fails with an "ORA-00936: missing expression" error. From my Google searches I believe this syntax is ok? It works if I replace * with a list of column names but I don't really want to have to list them all.

Is there anyway I can get this to work? Is there something wrong with my syntax? Any help gratefully received.

Matt

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 21 2007
Added on Apr 18 2007
12 comments
66,317 views