Unix Technical Forum

ORACLE MIGRATION - CASE Statements.

This is a discussion on ORACLE MIGRATION - CASE Statements. within the DB2 forums, part of the Database Server Software category; --> All. We have LOT of variables declared in the Oracle package as ORACLE CONSTANTS like, v_test CONSTANT INTEGER=1; When ...


Go Back   Unix Technical Forum > Database Server Software > DB2

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 04:08 AM
db2sysc@yahoo.com
 
Posts: n/a
Default ORACLE MIGRATION - CASE Statements.

All.

We have LOT of variables declared in the Oracle package as ORACLE
CONSTANTS like,

v_test CONSTANT INTEGER=1;


When converting to DB2, MTK changes each of these CONSTANTs into
functions. This typically increased the count of the functions.

create function v_test()
return int
....
....
return 1


Instead of SO MANY functions in DB2, we have written one single
function with CASE statements for each constant value

select CASE WHEN 'TESTING' THEN 1
WHEN 'CODING' THEN 2

.....
.....
END

Is there any performance implications in doing the above? having
multiple CASE statements in a single function? or shld we go for DGTT?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 04:08 AM
Serge Rielau
 
Posts: n/a
Default Re: ORACLE MIGRATION - CASE Statements.

db2sysc@yahoo.com wrote:
> All.
>
> We have LOT of variables declared in the Oracle package as ORACLE
> CONSTANTS like,
>
> v_test CONSTANT INTEGER=1;
>
>
> When converting to DB2, MTK changes each of these CONSTANTs into
> functions. This typically increased the count of the functions.
>
> create function v_test()
> return int
> ...
> ...
> return 1
>
>
> Instead of SO MANY functions in DB2, we have written one single
> function with CASE statements for each constant value
>
> select CASE WHEN 'TESTING' THEN 1
> WHEN 'CODING' THEN 2
>
> ....
> ....
> END
>
> Is there any performance implications in doing the above? having
> multiple CASE statements in a single function? or shld we go for DGTT?
>

These MTK dudes are quite inventive....
I don't see a problem with the functions.
Especially since this is static SQL the function will have the same
encapuslating effectand performance characteristics as the package
CONSTANT in Oracle.
If you went with a runtime solution (like using a CASE expression or
doing a select from a table) you will hurt performance.
You will need to do enough tuning after the migration as is...

Cheers
Serge

PS: Did I point you to my artcicles? If not search for my last name on
www.ibm.com. You will find references to a profiler and an article on
tracing and tuning. Get familiar with both.

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:38 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com