Results 1 to 5 of 5
  1. #1
    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 ..

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,274
    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

  3. #3
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,447
    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.

  4. #4
    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.

  5. #5
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,274
    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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •