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 > DB2 create function error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Sep 2009
Posts: 14
DB2 create function error

Hi. Can anyone tell me what's wrong with the following:


create function test.abcdef(c7 char(7)) returns date
language sql
begin
return(
CASE
WHEN c7 = ' ' THEN '0001-01-01'
WHEN c7 = '0000000' THEN '0001-01-01'
WHEN c7 IS NULL THEN '0001-01-01'
ELSE
tsg.century(SUBSTR(c7,1,1))
concat SUBSTR(DIGITS(c7),5,2) concat '-'
concat SUBSTR(DIGITS(c7),1,2) concat '-'
concat SUBSTR(DIGITS(c7),3,2)
END
);
end


Error msg is: SQL -204
Any ideas?
Thanks ..
Reply With Quote
  #2 (permalink)  
Old
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 2,221
how was this executed ?
what about the terminator ;
was this defined at create time ?
check the forum - many entries about this same symptom and terminator ...
__________________
Best Regards, Guy Przytula
Database Software Consultant
Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #3 (permalink)  
Old
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 5,399
SQLCODE -204 means "the object does not exist". May be it's about tsg.century.
__________________
---
"It does not work" is not a valid problem statement.
Reply With Quote
  #4 (permalink)  
Old
Registered User
 
Join Date: Sep 2009
Posts: 14
the create function was created as one step
the terminator ; is for the BEGIN
having defined the function, tried to use it and it failed with the -204 error
Also, tsg.century does exist.
Reply With Quote
  #5 (permalink)  
Old
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 2,221
always specify how the command was executed - the complete message in return ..
any additional info..
__________________
Best Regards, Guy Przytula
Database Software Consultant
Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
Reply

Tags
db2, function, functions

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