MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

create UDF, but invoke failed.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
videlord
Beginner


Joined: 09 Dec 2004
Posts: 147
Topics: 19

PostPosted: Fri Apr 27, 2007 12:57 pm    Post subject: create UDF, but invoke failed. Reply with quote

I created a function, but when i try to invoke it, i got SQLCODE = -440
it's really wierd.
e.g. The DDL:

Code:
CREATE FUNCTION MYTEST (CHAR(12), CHAR(4), CHAR(4), CHAR(8)) RETURNS   
  CHAR(10) SPECIFIC FT_F_GET_BK_CURR EXTERNAL NAME 'ABCTEST' LANGUAGE   
  C NOT DETERMINISTIC PARAMETER STYLE DB2SQL FENCED RETURNS NULL ON     
  NULL INPUT READS SQL DATA NO EXTERNAL ACTION SCRATCHPAD NO FINAL     
  CALL DISALLOW PARALLEL NO DBINFO NO collid  WLM ENVIRONMENT           
  DBDGWLM4 ASUTIME NO LIMIT STAY RESIDENT NO PROGRAM TYPE MAIN         
  SECURITY DB2 STOP AFTER SYSTEM DEFAULT FAILURES INHERIT SPECIAL       
  REGISTERS;   


the create succeed, and I can query it from sysibm.sysroutines catalog table, the schema is my ID.

But when i try invoke the function, e.g. SQL:
Code:
SELECT MYTEST('AAA','BBB','CCC','DDD') FROM SYSIBM.SYSDUMMY1;


it return:
Code:
SQLCODE = -440, ERROR:  NO FUNCTION BY THE NAME MYTEST HAVING   
COMPATIBLE ARGUMENTS WAS FOUND IN THE CURRENT PATH             

Does anyone have idea about it? Anything wrong with the CREATE FUNCTION DDL?
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri Apr 27, 2007 1:40 pm    Post subject: Reply with quote

I dunno but you define your p1st parm as CHAR(12) but only supply a CHAR(3) parm and so on for the other parameters. Just a guess, but SQL can be picky.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Fri Apr 27, 2007 1:51 pm    Post subject: Reply with quote

videlord,

You might wanna check this which talks about qualified vs Unqualified funtions

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNSQH11/2.19.2?SHELF=&DT=20010718164132&CASE=

Kolusu
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
videlord
Beginner


Joined: 09 Dec 2004
Posts: 147
Topics: 19

PostPosted: Fri Apr 27, 2007 2:35 pm    Post subject: Reply with quote

I found the resean
If I change all function parameters from CHAR to VARCHAR,
it will work.

but it's really stupied why DB2 can't find the function for CHAR parameter
even I can't invoke it by
Code:
SELECT MYTEST('123456789012','BBBB',
                     'CCCC','12345678')
                  FROM SYSIBM.SYSDUMMY1;


i know dynamical SQL will read the string parameter as VARCHAR, but when I invoke the funtion in program (the parameter will be the host language variable), it will failed at BIND too.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group