467,168 Members | 1,035 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,168 developers. It's quick & easy.

T-SQL to DB2 UDB SQL-PL conversion...

How can I convert the following T-SQL construct to SQL-PL?

if @ParameterType not in ('p1', 'p2', 'p3', 'p4', 'p4', 'p5')
begin
print 'good parameter'
end
else
begin
print 'bad parameter'
end

I want to avoid using a nested if...then....elseif..., if possible. I
am newbie to DB2 UDB.

Mar 28 '06 #1
  • viewed: 1691
Share:
2 Replies
you can't print in DB2 UDB. You will have to insert your debug
statements in some table and then do a select on that or you can do a
select on sysibm.sysdummy1 table and use a out parameter to print it.

DB2 UDB stored procedures do not support printing.

regards,
dotyet
ga*********@yahoo.com wrote:
How can I convert the following T-SQL construct to SQL-PL?

if @ParameterType not in ('p1', 'p2', 'p3', 'p4', 'p4', 'p5')
begin
print 'good parameter'
end
else
begin
print 'bad parameter'
end

I want to avoid using a nested if...then....elseif..., if possible. I
am newbie to DB2 UDB.


Mar 28 '06 #2
ga*********@yahoo.com wrote:
How can I convert the following T-SQL construct to SQL-PL?

if @ParameterType not in ('p1', 'p2', 'p3', 'p4', 'p4', 'p5')
begin
print 'good parameter'
end
else
begin
print 'bad parameter'
end


CASE
WHEN parameterType NOT IN ('p1', 'p2', 'p3', 'p4', 'p4', 'p5')
THEN 'good parameter'
ELSE 'bad parameter'
END

This is an expression that returns a VARCHAR value. Whatever you do with
this value is up to you. You could either insert it into a table, return
it to the application via a SELECT statement, send it to a UDF to be
written to a file (http://tinyurl.com/agvaw) or whatever else you might
come up with.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Apr 3 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Steve | last post: by
2 posts views Thread by Steve | last post: by
1 post views Thread by Ixnay | last post: by
2 posts views Thread by dynoweb | last post: by
1 post views Thread by TOM GUGGER | last post: by
16 posts views Thread by David Lozzi | last post: by
7 posts views Thread by Filips Benoit | last post: by
3 posts views Thread by lenygold via DBMonster.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.