dbTalk Databases Forums  

Do UDF's (SQL) have packages?

comp.databases.ibm-db2 comp.databases.ibm-db2


Discuss Do UDF's (SQL) have packages? in the comp.databases.ibm-db2 forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mark A
 
Posts: n/a

Default Do UDF's (SQL) have packages? - 04-11-2011 , 01:03 PM






I am using DB2 9.5 FP7 on Linux. I can't find the packages for some
application written UDF's (SQL). Do SQL UDF's have packages?

Also, if a column length is changed via "alter table xxxxx alter column
xxxxx reset datatype xxxxxx" (for example from CHAR(4) to CHAR(6)), I know
the package associated with a SP that uses that table column is marked
invalid (for automatic rebind at next execution). But does the SP or UDF
itself need to get recreated, or just the package get rebound? I see a VALID
column in syscat.routines, but it seems to be the same info as in the
syscat.packages (referring to status of package, not the routine itself).

Reply With Quote
  #2  
Old   
Serge Rielau
 
Posts: n/a

Default Re: Do UDF's (SQL) have packages? - 04-11-2011 , 02:41 PM






On 4/11/2011 2:03 PM, Mark A wrote:
Quote:
I am using DB2 9.5 FP7 on Linux. I can't find the packages for some
application written UDF's (SQL). Do SQL UDF's have packages?

Also, if a column length is changed via "alter table xxxxx alter column
xxxxx reset datatype xxxxxx" (for example from CHAR(4) to CHAR(6)), I know
the package associated with a SP that uses that table column is marked
invalid (for automatic rebind at next execution). But does the SP or UDF
itself need to get recreated, or just the package get rebound? I see a VALID
column in syscat.routines, but it seems to be the same info as in the
syscat.packages (referring to status of package, not the routine itself).


If a UDF has a body of: (BEGIN ATOMIC... END or only RETURN) and it is
NOT in a MODULE then the UDF has no package. It is an "inline SQL UDF"
If it is BGEIN .. nED (no ATOMIC) then teh UDF is "compiled" and it has
a package just like an SQL Procedure.
The same is true for triggers and anonymous blocks.
In DB2 9.7 altering table generally results in invalidation of the
routine itself because the change may have cascading effects (there may
be exceptions/optimizations but I don't know them offhand if they exist).
Dropping an index by contrast will only invalidate the package.

I have blogged about SQL UDF (see below)
In yet another shameless plug there is a Profiler on the Oracle2DB2Wiki
which you may find useful when doing SQL Routines.
It's "work in progress"....

Cheers
Serge


--
Serge Rielau
SQL Architect DB2 for LUW, IBM Toronto Lab
Blog: tinyurl.com/SQLTips4DB2
Wiki: tinyurl.com/Oracle2DB2Wiki
Twitter: srielau

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.