CASE statement syntax query 
Author Message
 CASE statement syntax query

Hi,

How can i get this to work:?

create function x(in_stbname integer) returning varchar(10)

CASE in_stbname
WHEN  1 THEN
return "1";
WHEN 2 THEN
return "2";
WHEN 3 THEN
return "3";
WHEN 4 THEN
return "4";
ELSE
RAISE EXCEPTION 100; --illegal value
END CASE

end function

essentially i want a case statement that processes drop and create
table base on the 'in_stbname' value.
the above is an example of what i'm trying but i'm getting a syntax
error.
whats the correct syntax to make this work?

thanks.

sk



Mon, 14 Jun 2004 19:58:37 GMT
 CASE statement syntax query

Is CASE valid now?  AFAIK SPL doesn't/didn't support case statements

Quote:

> Hi,

> How can i get this to work:?

> create function x(in_stbname integer) returning varchar(10)

> CASE in_stbname
> WHEN  1 THEN
> return "1";
> WHEN 2 THEN
> return "2";
> WHEN 3 THEN
> return "3";
> WHEN 4 THEN
> return "4";
> ELSE
> RAISE EXCEPTION 100; --illegal value
> END CASE

> end function

> essentially i want a case statement that processes drop and create
> table base on the 'in_stbname' value.
> the above is an example of what i'm trying but i'm getting a syntax
> error.
> whats the correct syntax to make this work?

> thanks.

> sk

--
Paul Watson             #          
Oninit Ltd              # Growing old is mandatory
Tel: +44 1436 672201    # Growing up is optional
Fax: +44 1436 678693    #
www.oninit.com          #


Mon, 14 Jun 2004 20:23:39 GMT
 CASE statement syntax query

Quote:

> Is CASE valid now?  AFAIK SPL doesn't/didn't support case statements


> > Hi,

> > How can i get this to work:?

> > create function x(in_stbname integer) returning varchar(10)

> > CASE in_stbname
> > WHEN  1 THEN
> > return "1";
> > WHEN 2 THEN
> > return "2";
> > WHEN 3 THEN
> > return "3";
> > WHEN 4 THEN
> > return "4";
> > ELSE
> > RAISE EXCEPTION 100; --illegal value
> > END CASE

> > end function

> > essentially i want a case statement that processes drop and create
> > table base on the 'in_stbname' value.
> > the above is an example of what i'm trying but i'm getting a syntax
> > error.
> > whats the correct syntax to make this work?

> > thanks.

> > sk

if in_stbname = 1 then
        ...
elif in_stbname = 2 then
        ...
else
        raise exception ...
end if
--
**************************************************************

Orbis                       Tel: +44 208 742 1600
http://www.OrbisUK.com      Fax: +44 208 742 2649


Mon, 14 Jun 2004 21:20:09 GMT
 CASE statement syntax query

Quote:

> Hi,

> How can i get this to work:?

What version of IDS do you have?  CASE is valid with 8.2x+ and none
of the 5/6/7/9.xx releases that I know of.

Art S. Kagel

Quote:
> create function x(in_stbname integer) returning varchar(10)

> CASE in_stbname
> WHEN  1 THEN
> return "1";
> WHEN 2 THEN
> return "2";
> WHEN 3 THEN
> return "3";
> WHEN 4 THEN
> return "4";
> ELSE
> RAISE EXCEPTION 100; --illegal value
> END CASE

> end function

> essentially i want a case statement that processes drop and create
> table base on the 'in_stbname' value.
> the above is an example of what i'm trying but i'm getting a syntax
> error.
> whats the correct syntax to make this work?

> thanks.

> sk



Mon, 14 Jun 2004 21:19:24 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. Case Statement Dependent On Another Case Statement Possible?

2. case statement syntax error in stored procedure?

3. Case statement - invalid syntax

4. Case Statement Syntax????

5. need help w/ syntax for stored procedure w/ case statement

6. Syntax for CASE WHEN GROUPING (statement)

7. Newbie question: Syntax problem with CASE statement

8. why does CASE statement slow query

9. Case Statement column reults being used in the same query

10. Using select queries in case statements

11. Similary query using case end statement ?

12. case statement to query fox/ado


 
Powered by phpBB® Forum Software