RE: [sqlite] What is wrong with this SELECT CASE statement?

2007-02-18 Thread RB Smissaert
Thanks.
Yes, it will return the errors, but this fell away in my wrapper function.
Understand now how this works and will fix it and see how it compares to the
Other methods.

RBS

-Original Message-
From: Joe Wilson [mailto:[EMAIL PROTECTED] 
Sent: 19 February 2007 01:42
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] What is wrong with this SELECT CASE statement?

--- RB Smissaert <[EMAIL PROTECTED]> wrote:
> Trying to update my mmdd integers to months with a SELECT CASE
> statement:
> 
> SELECT CASE
> (CAST(DATE_OF_BIRTH / 100 AS INTEGER) - CAST(DATE_OF_BIRTH / 1 AS
> INTEGER) * 100)
> WHEN 1 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'January'
> WHEN 2 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'February'
> WHEN 3 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'March'
> WHEN 4 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'April'
> WHEN 5 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'May'
> WHEN 6 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'June'
> WHEN 7 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'July'
> WHEN 8 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'August' 
> WHEN 9 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'September'
> WHEN 10 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'October'
> WHEN 11 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'November'
> WHEN 12 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'December'
> END
> FROM A2IDC21_J
> 
> But no updates take place.

SQL error: near "UPDATE": syntax error

Does the environment you run in return error codes?

You can't perform an UPDATE in a WHEN sub-clause.

 UPDATE TABLE1 
 SET FOO = (CASE ...whatever... END)

> Thanks for any advice.
> 
> RBS



 


Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121


-
To unsubscribe, send email to [EMAIL PROTECTED]

-




-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] What is wrong with this SELECT CASE statement?

2007-02-18 Thread Joe Wilson
--- RB Smissaert <[EMAIL PROTECTED]> wrote:
> Trying to update my mmdd integers to months with a SELECT CASE
> statement:
> 
> SELECT CASE
> (CAST(DATE_OF_BIRTH / 100 AS INTEGER) - CAST(DATE_OF_BIRTH / 1 AS
> INTEGER) * 100)
> WHEN 1 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'January'
> WHEN 2 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'February'
> WHEN 3 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'March'
> WHEN 4 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'April'
> WHEN 5 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'May'
> WHEN 6 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'June'
> WHEN 7 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'July'
> WHEN 8 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'August' 
> WHEN 9 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'September'
> WHEN 10 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'October'
> WHEN 11 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'November'
> WHEN 12 THEN UPDATE A2IDC21_J SET DATE_OF_BIRTH = 'December'
> END
> FROM A2IDC21_J
> 
> But no updates take place.

SQL error: near "UPDATE": syntax error

Does the environment you run in return error codes?

You can't perform an UPDATE in a WHEN sub-clause.

 UPDATE TABLE1 
 SET FOO = (CASE ...whatever... END)

> Thanks for any advice.
> 
> RBS



 

Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121

-
To unsubscribe, send email to [EMAIL PROTECTED]
-