This is a discussion on T-SQL to DB2 UDB SQL-PL conversion... within the DB2 forums, part of the Database Server Software category; --> How can I convert the following T-SQL construct to SQL-PL? if @ParameterType not in ('p1', 'p2', 'p3', 'p4', 'p4', ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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. |
| |||
| 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 gaurigirish@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. |
| ||||
| gaurigirish@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 |