Pradyumna
Pradyumna

Reputation: 1633

In-line temporary tables in Derby (like DB2)

Does Derby have an equivalent syntax for in-line temporary tables such as these:

(this is valid DB2 syntax):

    with data(a,b) as (values
                        ('a',10),
                        ('b',20),
                        ('c',30),
                        ('d',40)
                      )
    select * from data 

Thanks,

Pradyumna

Upvotes: 3

Views: 4351

Answers (2)

Dexygen
Dexygen

Reputation: 12561

'DECLARE GLOBAL TEMPORARY TABLE (table-name)' etcera

I found this by googling on "Derby Temp Tables", it's the #1 result, and straight from the docs:

http://db.apache.org/derby/docs/10.2/ref/rrefdeclaretemptable.html

Upvotes: 3

Bryan Pendleton
Bryan Pendleton

Reputation: 16349

I'm not quite sure if this is what you're trying to achieve, but this works in Derby:

select a,b from (values ('a', 10), ('b', 20), ('c', 30)) as x(a,b);

Upvotes: 3

Related Questions