db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@apache.org>
Subject Re: names of columns in VALUES
Date Wed, 30 Jan 2008 19:26:19 GMT
Jim Newsham wrote:

> It seems there is no way to name the columns produced by the VALUES 
> keyword. 

http://db.apache.org/derby/docs/dev/ref/rreftableexpression.html#rreftableexpression

ij> select * from (values ('aaaaaaaaaa', 'bbbbbbbbb')) AS 
T(MYCOL,MYOTHERCOL);
MYCOL     |MYOTHERC&
--------------------
aaaaaaaaaa|bbbbbbbbb

1 row selected

> On a slightly related note, for orthogonality it would also be useful to 
> be able to produce a resultset with a finite number of columns but zero 
> records, using the VALUES keyword.  For hand-written sql, this might be 
> useless, but for some of the auto-generated sql I produce, it would save 
> some special casing and code contortion.  But this one is minor… the 
> renaming would be much more helpful.

select * from (values ('aaaaaaaaaa', 'bbbbbbbbb')) AS 
T(MYCOL,MYOTHERCOL) where 1 = 0;

HTH,
Dan.

Mime
View raw message