Array in SQL Cursor



IBM's flagship relational database management system

Array in SQL Cursor

Postby kakamansai » Tue Aug 30, 2011 3:53 pm

If we have few values which needs to excluded from the selection and if the values are changing every time, can we use Array name in WHERE cluase of sql, after reading the valuese in to array in COBOL program?

Select * from <table name>
where col1 not in (:ws-array-name)

Throwing the error ws-array-name as UNUSABLE or UNDECLARED HOST VARIABLE
kakamansai
 
Posts: 1
Joined: Tue Aug 30, 2011 3:34 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Array in SQL Cursor

Postby GuyC » Tue Aug 30, 2011 8:21 pm

I think each elementary item is required to have a name.
I haven't compiled it, but something like this :
01  HV-INLIST.                                 
   05  HV-INLIST1              PIC X(3)    VALUE SPACE.
   05  HV-INLIST2              PIC X(3)    VALUE SPACE.
   05  HV-INLIST3              PIC X(3)    VALUE SPACE.
01 HV-TABLE REDEFINES HV-INLIST.
    05  HV-TABLE-ELEMENT OCCURS 3 PIC X(3).


exec sql
   Select * from <table name>
   where col1 not in (:HV-INLIST)
end-exec
I can explain it to you, but i can not understand it for you.
GuyC
 
Posts: 315
Joined: Tue Aug 11, 2009 3:23 pm
Has thanked: 1 time
Been thanked: 4 times


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post