If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > have any tools or utilities that show me the text of procedure or funtion or triggers

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-19-06, 11:47
M_RAS M_RAS is offline
Registered User
 
Join Date: Sep 2003
Location: canada
Posts: 230
have any tools or utilities that show me the text of procedure or funtion or triggers

I am using db2 v8.2.2 and aix 5.2

I used db2 syscat.routine and select BODY columns but did not show me anything and it was empty, please help
Reply With Quote
  #2 (permalink)  
Old 10-19-06, 12:30
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Select text from syscat.routines should give you the text for SQL routines.
If theay are not SQL routines, there is no way to query the DB to get this that I know of.

Andy
Reply With Quote
  #3 (permalink)  
Old 10-19-06, 12:39
M_RAS M_RAS is offline
Registered User
 
Join Date: Sep 2003
Location: canada
Posts: 230
Quote:
Originally Posted by ARWinner
Select text from syscat.routines should give you the text for SQL routines.
If theay are not SQL routines, there is no way to query the DB to get this that I know of.

Andy
As you know TEXT is clob column and I know I have UDF like:

create function xxxxxx(4000) for bit data)
returns varchar(4000)
specific cbchr
external name 'yyyyyy!bbbb'
language C
parameter style DB2SQL
not variant
fenced
not null call
no sql
no external action
no scratchpad
no final call;


I expect to see this body, how can I see that?
Reply With Quote
  #4 (permalink)  
Old 10-19-06, 12:45
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Here is an example using the CLP:

LCAD-->select text from syscat.routines where routinename = 'UDF_NAME'

TEXT








------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
CREATE FUNCTION PRODUCTION.UDF_NAME(LAST VARCHAR(25), FIRST VARCHAR(20), MIDDLE VARCHAR(15), SUFFIX VARCHAR(10))
RETURNS VARCHAR(75) LANGUAGE SQL DETERMINISTIC NO EXTERNAL ACTION CALLED ON NULL INPUT
BEGIN ATOMIC
DECLARE OUTTEXT VARCHAR(75);

SET OUTTEXT = '';

IF (LAST IS NOT NULL)
THEN SET OUTTEXT = RTRIM(LAST) || ', ';
END IF;

IF (FIRST IS NOT NULL)
THEN SET OUTTEXT = OUTTEXT || RTRIM(FIRST) || ' ';
END IF;

IF (MIDDLE IS NOT NULL)
THEN SET OUTTEXT = OUTTEXT || RTRIM(MIDDLE) || ' ';
END IF;

IF (SUFFIX IS NOT NULL)
THEN SET OUTTEXT = OUTTEXT || RTRIM(SUFFIX);
END IF;

RETURN OUTTEXT;
END








1 record(s) selected.

LCAD-->

Andy
Reply With Quote
  #5 (permalink)  
Old 10-19-06, 12:56
M_RAS M_RAS is offline
Registered User
 
Join Date: Sep 2003
Location: canada
Posts: 230
Quote:
Originally Posted by ARWinner
Here is an example using the CLP:

LCAD-->select text from syscat.routines where routinename = 'UDF_NAME'

TEXT








------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
CREATE FUNCTION PRODUCTION.UDF_NAME(LAST VARCHAR(25), FIRST VARCHAR(20), MIDDLE VARCHAR(15), SUFFIX VARCHAR(10))
RETURNS VARCHAR(75) LANGUAGE SQL DETERMINISTIC NO EXTERNAL ACTION CALLED ON NULL INPUT
BEGIN ATOMIC
DECLARE OUTTEXT VARCHAR(75);

SET OUTTEXT = '';

IF (LAST IS NOT NULL)
THEN SET OUTTEXT = RTRIM(LAST) || ', ';
END IF;

IF (FIRST IS NOT NULL)
THEN SET OUTTEXT = OUTTEXT || RTRIM(FIRST) || ' ';
END IF;

IF (MIDDLE IS NOT NULL)
THEN SET OUTTEXT = OUTTEXT || RTRIM(MIDDLE) || ' ';
END IF;

IF (SUFFIX IS NOT NULL)
THEN SET OUTTEXT = OUTTEXT || RTRIM(SUFFIX);
END IF;

RETURN OUTTEXT;
END








1 record(s) selected.

LCAD-->

Andy
it does not show me the body of my UFD because the language is c but yours is SQL, am I right ? is there any way I can see the bodies of my UDF or SP.

Thank you so much for your help.
Reply With Quote
  #6 (permalink)  
Old 10-19-06, 13:09
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
As I stated in my first reply, you cannot get the text of non-SQL routines from syscat. You maybe able to derive the "CREATE FUNCTION" statement from syscat.routines.

Andy
Reply With Quote
  #7 (permalink)  
Old 10-19-06, 13:14
M_RAS M_RAS is offline
Registered User
 
Join Date: Sep 2003
Location: canada
Posts: 230
Quote:
Originally Posted by ARWinner
As I stated in my first reply, you cannot get the text of non-SQL routines from syscat. You maybe able to derive the "CREATE FUNCTION" statement from syscat.routines.

Andy
Thank you so much Andy for your help.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On