Solved

Interactive 'WITH' Statement

Posted on 2009-05-14
2
179 Views
Last Modified: 2012-05-07
Sample code not working and I don't see why.  Any suggestions?
Token ( was not valid. Valid tokens: FOR WITH FETCH ORDER UNION EXCE 
 WITH MYTABLE AS (SELECT DDCREW, DDDRV#,                              
   DATE(DDYEAR || DDMOTH || DDDAY) As strdate, ddmd from cdsddm)      
 select * from MYTABLE                                                
   where dddrv#=2523                                                  
    and strdate = 20090316

Open in new window

0
Comment
Question by:lynn_harris
2 Comments
 
LVL 18

Accepted Solution

by:
daveslash earned 50 total points
ID: 24390015

Since my date-format is *ISO, the following works for me:

WITH MYTABLE AS (
  SELECT 2523 as DDDRV#,
         DATE('2009' || '-' || '03' || '-' || '16') As strdate
  from   sysibm/sysdummy1)
select *
from   MYTABLE
where  dddrv#=2523
  and  strdate = '2009-03-16'
 
HTH,
DaveSlash

Open in new window

0
 

Author Closing Comment

by:lynn_harris
ID: 31581707
Thank You.  I will toy with my some more.  
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question