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 

z/os db2 v9r1 UDF

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


Joined: 05 Nov 2003
Posts: 9
Topics: 7

PostPosted: Fri Jan 28, 2011 2:59 am    Post subject: z/os db2 v9r1 UDF Reply with quote

hello

I have som problems with this create function and the manuals
lack of gpod examples:
Code:

  CREATE FUNCTION TEST.JR40151F                                                 
        ( INP1   SMALLINT                                                       
         ,INP2   INTEGER                                                       
         )                                                                     
        RETURNS  INTEGER                                                       
  LANGUAGE SQL                                                                 
  SPECIFIC TEST.JR40151F                                                       
  NOT DETERMINISTIC                                                             
  READS SQL DATA                                                               
        RETURN  (                                                               
           SELECT                                                               
              COUNT(*)                                                         
           FROM                                                                 
               TEST.JR40000T GRU                                               
              ,TEST.JR40100T BYG                                               
           WHERE                                                               
               GRU.VUR_AAR         = 9999                                       
           AND GRU.KOMMUNENUMMER   = INP1                                       
           AND GRU.EJENDOMSNR      = INP2                                       
           AND GRU.OBJTYPE         = 1                                         
           AND BYG.FK_GRUND_ID     = GRU.GRUND_ID                               
           AND BYG.OBJTYPE         = 1                                         
           AND BYG.BYG_ANVEND_KODE < 910 );                                     
---------+---------+---------+---------+---------+---------+---------+---------+
DSNT408I SQLCODE = -214, ERROR:  AN EXPRESSION IN THE FOLLOWING POSITION, OR   
         STARTING WITH 0 IN THE RETURN CLAUSE IS NOT VALID.  REASON CODE = 6   
DSNT418I SQLSTATE   = 42822 SQLSTATE RETURN CODE                               
DSNT415I SQLERRP    = DSNXOP1 SQL PROCEDURE DETECTING ERROR                     
DSNT416I SQLERRD    = -140 0  0  -1  0  0 SQL DIAGNOSTIC INFORMATION           
DSNT416I SQLERRD    = X'FFFFFF74'  X'00000000'  X'00000000'  X'FFFFFFFF'       
         X'00000000'  X'00000000' SQL DIAGNOSTIC INFORMATION             


kind regards joergensen
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Jan 28, 2011 7:41 am    Post subject: Reply with quote

why don't you start with the description of the -214 sqlcode ?

or see what datatype COUNT returns?
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
joergensen
Beginner


Joined: 05 Nov 2003
Posts: 9
Topics: 7

PostPosted: Sun Jan 30, 2011 8:47 am    Post subject: Reply with quote

count returns integer and the sqlcode=-214 is something about full-select, but difficult to understand

kind regards Ib
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Mon Jan 31, 2011 4:24 am    Post subject: Reply with quote

count returns a large integer (BIGINT).
_________________
Dick Brenholtz
American living in Varel, Germany
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