If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > why the below db2 sql code is giving parsing error at case expression?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-22-08, 12:55
joys joys is offline
Registered User
 
Join Date: Feb 2008
Posts: 2
why the below db2 sql code is giving parsing error at case expression?

[RTL_PRT_PLS].[EY_ID] = [RTL_P_P_STG].[EY_ID]
AND
[RTL_PRT_PLS].[AA_ID] =[CDW_RTL_P_P_STG].[AA_ID]
AND
[RTL_PRT_PLS].[PL_ID] =[RTL_P_P_STG].[PL_ID]
AND
((char([RTL_PRT_PLS].[EXPR_DTE] ) >= CASE WHEN @PROMPT ('Enter Date (format YYYY-MM-DD) or * for Current Date','C',,,) = '*'
THEN '9999-12-31' END )
OR @PROMPT('Enter Date (format YYYY-MM-DD) or * for Current Date','C',,,) BETWEEN char([RTL_PRT_PLS].[EFF_DTE] ) and
char(.[RTL_PRT_PLS].[EXPR_DTE] ))

can anyone able to explain 1) why the '*' is used 2) why there are multiple comms after 'C' and 3) what is that @prompt ?

many thanks in advance...
Reply With Quote
  #2 (permalink)  
Old 02-22-08, 13:31
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
It is you SQL, you would have to tell us. Where is this coming from? Also what DB2 version and OS?

Andy
Reply With Quote
  #3 (permalink)  
Old 02-24-08, 08:44
Wim Wim is offline
Registered User
 
Join Date: Nov 2004
Posts: 1,279
All this
Code:
[RTL_PRT_PLS].[EY_ID]
reminds me of MS access.
__________________
With kind regards . . . . . SQL Server 2000/2005/2008/2008 R2 Earned beers: 16
Wim
Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald Knuth
Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages
Reply With Quote
  #4 (permalink)  
Old 02-24-08, 13:13
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
What is this "@PROMPT(... , , , )" thing? This is not a valid SQL expression (neither by the accounts of the SQL standard nor DB2).
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #5 (permalink)  
Old 02-25-08, 05:52
joys joys is offline
Registered User
 
Join Date: Feb 2008
Posts: 2
stolze,

you are right...the problem is with @prompt, which we replaced with #prompt
and removed those multiple commas...
actually i didn't wrote the code...it's a request from the customer !
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On