View previous topic :: View next topic
|
Author |
Message |
vinu78
Active User
Joined: 02 Oct 2008 Posts: 179 Location: India
|
|
|
|
Hi All,
I have the DB2 column field in the table TABLEA as follows:
Code: |
NAME AGE DEPT_CD
RAJ 35 100,200,300 |
I would like to fetch each of the values of DEPT_CD till comma and then search for matching occurrence in another array
The search can be done on this table TABLEA based on NAME (RAJ) and would like to fetch each of the DEPT_CD values 100, 200 and 300.
Can any one of you please help ?
Thanks
Vinu |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
Pease clarify everything that you posted. The title does not seem to match your question. You say you have one column containing values name, age and dept. Dept would appear to be a comma separated list. You want to fetch
each dept value 'until comma' so what about the last one - there is no comma. You want to use that dept value as a key into 'another array' - where is this array? Is it really an array or is it a DB2 table or a COBOL table? |
|
Back to top |
|
|
vinu78
Active User
Joined: 02 Oct 2008 Posts: 179 Location: India
|
|
|
|
Hi Nic,
Sorry for the misunderstanding.
Yes last value is not suffixed with comma.
I would like to extract each of the values from DEPT_CD and then later I will use this values in another array (that is second part).
As first part, I would like to extract these values 100, 200 and 300 which is stored in DEPT_CD in separate variables.
Thanks
Vinu |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
What is stopping you from SELECTing DEPT_CD into a suitably sized variable and REDEFINEing a table on that variable? |
|
Back to top |
|
|
|