SQL Add Dummy Column to Select Statement
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