By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,334 Members | 1,266 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,334 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.