Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > IBM DB2 > Rewrite LUW que...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 6 Topic 9097 of 9180
Post > Topic >>

Rewrite LUW query to work on z/OS

by "VGD" <vgarcia@[EMAIL PROTECTED] > Jul 17, 2008 at 09:26 AM

Hello

I've a table Table_val as follows:
   C1   C2
   ---- ----
   V1   val1
   V2   val1
   V2   val2
   V2   val3
   V3   val2
   V3   val4

Also there is a list of values to search in C1:
   V2, V2, V3, V4, Vempty, Vempty

I'm looking for an output like this:
   C1   C2
   ---- ----
   V4   ?
   V2   val1
   V2   val2
   V3   val2
   V2   val3
   V3   val4

Using DB2/NT 7.2.9 and executing this query
-------------------------------
   with
      Value_list(C1)
    as
     ( values
         ('V2'),
         ('V2'),
         ('V3'),
         ('V4'),
         ('Vempty'),
         ('Vempty')
      )
   select
      distinct
      value_list.C1 ,
      case when Table_val.C2 is null then '?' else Table_val.C2 end
   from
      Table_val
   right outer join
      Value_list
    on
      Table_val.C1 = Value_list.C1
   where
      Table_val.C1 <> 'Vempty';

-------------------------------

it works ok and outputs the desired data.

But  I need to run the query against the same data set on a DB2 OS/390
8.1.5
and then I got this error:

   SQL0104N  An unexpected token "Value_list" was found following "".
   Expected tokens may include:  "DSN_INLINE_OPT_HINT".  SQLSTATE=42601

Then the question is: How I need to rewrite the query in order to obtain
the
desired output using DB2 OS/390 8.1.5 ?

Thanks in advance

    Vicente
 




 6 Posts in Topic:
Rewrite LUW query to work on z/OS
"VGD" <vgarc  2008-07-17 09:26:21 
Re: Rewrite LUW query to work on z/OS
Serge Rielau <srielau@  2008-07-17 06:45:06 
Re: Rewrite LUW query to work on z/OS
"VGD" <vgarc  2008-07-17 15:03:49 
Re: Rewrite LUW query to work on z/OS
Lennart <Erik.Lennart.  2008-07-17 06:36:29 
Re: Rewrite LUW query to work on z/OS
Serge Rielau <srielau@  2008-07-17 14:53:36 
Re: Rewrite LUW query to work on z/OS
"VGD" <vgarc  2008-07-18 08:17:34 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Aug 21 19:02:09 CDT 2008.