Subject | Re: [firebird-support] Switch statement in FIREBIRD |
---|---|
Author | Mr. John |
Post date | 2009-12-04T12:23:59Z |
Thanks Svein
Hi, I use firebird 2.1
I have inside SP :
IF (NEW.TIP=1) THEN EXECUTE PROCEDURE PR1
IF (NEW.TIP=6) THEN EXECUTE PROCEDURE PR2
IF (NEW.TIP<>6 AND NEW.TIP<>1) THEN EXECUTE PROCEDURE PR3
And I want something like this :
SELECT CASE (NEW.TIP)
CASE 1
EXECUTE PROCEDURE PR1
CASE 6
EXECUTE PROCEDURE PR2
CASE ELSE
THEN EXECUTE PROCEDURE PR3
END CASE
If it is not possible I'll use If..Else but much clear is the syntax I'm looking for.
Thanks.
________________________________
From: Svein Erling Tysvær <svein.erling.tysvaer@...>
To: "firebird-support@yahoogroups.com" <firebird-support@yahoogroups.com>
Sent: Fri, December 4, 2009 1:55:23 PM
Subject: RE: [firebird-support] Switch statement in FIREBIRD
Can you show an example (imagined Firebird syntax) of what you're searching for and tell which Firebird version you're using? I generally find that CASE and sometimes COALESCE or UNION fit my needs, but that might not be suitable in your case.
Set
-----Original Message-----
From: firebird-support@ yahoogroups. com [mailto:firebird-support@ yahoogroups. com] On Behalf Of Mr. John
Sent: 4. desember 2009 12:15
To: firebird-support@ yahoogroups. com
Subject: [firebird-support] Switch statement in FIREBIRD
Hi ! I'm looking for a solution to handle multiple if-else statements switch in firebird just like DO CASE in FOXPRO,SELECT CASE in VB, SWICH in C++.
I found CASE but seems to apply only for an expression.Thanks for any clue.
[Non-text portions of this message have been removed]
Hi, I use firebird 2.1
I have inside SP :
IF (NEW.TIP=1) THEN EXECUTE PROCEDURE PR1
IF (NEW.TIP=6) THEN EXECUTE PROCEDURE PR2
IF (NEW.TIP<>6 AND NEW.TIP<>1) THEN EXECUTE PROCEDURE PR3
And I want something like this :
SELECT CASE (NEW.TIP)
CASE 1
EXECUTE PROCEDURE PR1
CASE 6
EXECUTE PROCEDURE PR2
CASE ELSE
THEN EXECUTE PROCEDURE PR3
END CASE
If it is not possible I'll use If..Else but much clear is the syntax I'm looking for.
Thanks.
________________________________
From: Svein Erling Tysvær <svein.erling.tysvaer@...>
To: "firebird-support@yahoogroups.com" <firebird-support@yahoogroups.com>
Sent: Fri, December 4, 2009 1:55:23 PM
Subject: RE: [firebird-support] Switch statement in FIREBIRD
Can you show an example (imagined Firebird syntax) of what you're searching for and tell which Firebird version you're using? I generally find that CASE and sometimes COALESCE or UNION fit my needs, but that might not be suitable in your case.
Set
-----Original Message-----
From: firebird-support@ yahoogroups. com [mailto:firebird-support@ yahoogroups. com] On Behalf Of Mr. John
Sent: 4. desember 2009 12:15
To: firebird-support@ yahoogroups. com
Subject: [firebird-support] Switch statement in FIREBIRD
Hi ! I'm looking for a solution to handle multiple if-else statements switch in firebird just like DO CASE in FOXPRO,SELECT CASE in VB, SWICH in C++.
I found CASE but seems to apply only for an expression.Thanks for any clue.
[Non-text portions of this message have been removed]