Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Db2 Triggers and UDF's

Status
Not open for further replies.

pravin100

Programmer
Apr 24, 2001
1
IN
Hello,

Can we call UDF's( User defined functions ) from Triggers?
IF so can we write SQL statements within UDF's which will be called from Triggers.This problem arises because there are many conditions to be checked ( IF ,CASE etc.) and based on these conditions records are to be inserted in another table through a trigger.
 
You can call UDF's from triggers ... this was the method used to generate the equivalent of identity columns before db2 (UDB) started supporting identity columns and sequences.
See the samples directory for an example of a UDF library.
I don't believe you can imbed sql in a UDF, although I havn't tried.
 
You can create UDFs in SQL the syntax is described in the documentation.
I hope it works...
Unix was made by and for smart people.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top