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 > issue in invoking UDF from db2 procedure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-22-10, 15:27
sj.j sj.j is offline
Registered User
 
Join Date: Mar 2009
Posts: 4
issue in invoking UDF from db2 procedure

I am getting below error with right arguments

"No authorized routine named "SRCHYRORMNTH" of type "FUNCTION" having compatible arguments was found"

The invoking statemnet looks like

SELECT name,,,, from tablename
WHERE ABS.SRCHYRORMNTH('Y','L',1324485520) = 2010


The function looks like

CREATE FUNCTION "ABS"."SRCHYRORMNTH" (v_Type CHAR(1),
v_DateType CHAR(1),
v_LONGVAL INTEGER )
RETURNS INTEGER
LANGUAGE SQL

BEGIN ATOMIC

DECLARE v_DAYOFLONGVAL INTEGER;

DECLARE v_YearMonth INTEGER;

// function logic

RETURN v_YearMonth;

END

Please let me know if i am missing something.

Any help would be appreciated!!
Jash
Reply With Quote
  #2 (permalink)  
Old 12-23-10, 00:35
db2usr db2usr is offline
Registered User
 
Join Date: Dec 2010
Posts: 3
issue in invoking UDF from db2 procedure

While you are calling the function in the select statement, explicitly typecast the data.

SELECT name,,,, from tablename
WHERE ABS.SRCHYRORMNTH(char('Y'),char('L'),int(132448552 0)) = 2010
Reply With Quote
  #3 (permalink)  
Old 12-23-10, 08:38
sj.j sj.j is offline
Registered User
 
Join Date: Mar 2009
Posts: 4
issue in invoking UDF from db2 stored procedure

Hi,

Thank you for the reply!!

I did found and tried the casting in another way as below

SELECT name,,,, from tablename
WHERE ABS.SRCHYRORMNTH(CAST('Y') as CHAR, CAST('L') as CHAR,CAST(1324485520) as INT) = 2010

Thanks again for your reply and time!!
jash
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