× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I've strained my eyes looking for an error in your statement, but can't see
one. It ought to work as is.
Are you current on database fixpacks?

What happens if you provide the column list:

declare global temporary table assignment
(BBCMP,BBPCPK,BBPCPKD,BBASSIGN,bbcode,start_date,start_time,bbcode,end_date,
end_time) as (....) with data

Hth, Elvis

Celebrating 11-Years of SQL Performance Excellence on IBM i, i5/OS and
OS/400
www.centerfieldtechnology.com

-----Original Message-----
Subject: SQL Question

I am attempting to create a temporary table in QTEMP using an SQL statement
that starts with a CTE and then selects data based on the CTE.
The base SQL statement works fine, but when I wrap a Declare global tempory
table expression around it, I get a Column List Required error.

My SQL statement is :
declare global temporary table assignment as ( with trans as (     
SELECT BBCMP, BBPCPK, BBPCPKD, BBASSIGN, bbcode,min(bbcctd) bbcctd 
,min(bbcctt) bbcctt from voctrack where (bbcctd = 20090114 and     
bbcctt >= 060000 or bbcctd = 20090115 and bbcctt <= 060000) and    
bbcode = 'STR' GROUP BY BBCMP, BBPCPK, BBPCPKD, BBASSIGN, BBCODE)  
SELECT a.BBCMP, a.BBPCPK, a.BBPCPKD, a.BBASSIGN, a.bbcode,a.bbcctd 
start_date, a.bbcctt start_time, b.bbcode, b.bbcctd                
end_date,b.bbcctt end_time FROM trans a join voctrack b on a.bbcmp 
= b.bbcmp and a.bbpcpk = b.bbpcpk and a.bbpcpkd = b.bbpcpkd and    
a.bbassign = b.bbassign WHERE a.bbcode = 'STR' and b.bbcode = 'END'
and (a.bbcctd = 20090114 and a.bbcctt >= 060000 or a.bbcctd =      
20090115 and a.bbcctt <= 060000) ORDER BY BBASSIGN, BBPCPK,        
a.BBCCTT ) with data

I am on V5R3.

Any suggestions will be appreciated.

Thanks,

Jeff Young



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.