Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2003
    Posts
    3

    Unanswered: SQL Scalar Function

    Hi, im using DB2 V7 and im trying to create a sql scalar function with the following statement:

    CREATE FUNCTION BETRAG(ID CHAR(20))
    RETURNS DECIMAL(09.02)
    LANGUAGE SQL
    NO EXTERNAL ACTION
    RETURN
    SELECT SUM(BETRAG)
    FROM TABELLE I
    WHERE I.ID = ID

    Is it possible to execute this select-statement in this function?

    thanks
    Dennis

  2. #2
    Join Date
    Jun 2002
    Location
    UK
    Posts
    525
    What's the problem?

    CREATE FUNCTION BETRAG(ID CHAR(20))
    --RETURNS DECIMAL(09.02)
    RETURNS DECIMAL(9,2)
    LANGUAGE SQL
    NO EXTERNAL ACTION
    RETURN
    SELECT SUM(BETRAG)
    FROM TABELLE I
    WHERE I.ID = ID

  3. #3
    Join Date
    Aug 2003
    Posts
    3
    The problem is that this statement ist not executable.
    My DB-Administrator says that he is not sure whether OS/390 db2 can do it.
    But i hope now, that anybody here has tested it on os 390.

    Can anybody help me?

  4. #4
    Join Date
    Aug 2003
    Posts
    3
    Hello,
    has anybody tested this statement yet on a os/390 with db2 v7???
    My Db-Admin says, that this statement is not executable, because in
    SQL Scalar Functions are only expressions allowed!!(?)

    thanks
    Dennis

Posting Permissions

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