How to retrieve multiple rows via lookup?
Posted: Thu Oct 14, 2004 3:44 pm
Need help to resolve a problem. We have a sequential file that contains the "partial" key for a table. We would like to do a lookup to the table and fetch every rows (0 to many) that matches this partial key. Is this possible? Here is any example,
Seq file contains, let say, Employee Last Name and DOB,
Smith, 01/01/80
Lee, 08/15/60
.
.
In the EMP table, the columns are
Last Name (part of the key)
DOB (part of the key)
First Name (part of the key)
.
.
And data in the EMP table would look like,
Smith John 01/01/80 ......
Smith James 02/02/82 .....
Smith Jenny 03/03/84 ....
Lee Betty 05/01/60 ....
Lee Brenda 04/04/62 ....
For 1st record in Seq file (Smith), we need to retrieve 3 records (John, James and Jenny). For 2nd record in Seq file (Lee), we need to get 2 records (Betty and Brenda). More of an "explicit cursor" situation.
Is this possible? If yes, any suggestions?
Thank you everyone,
Kevin
Seq file contains, let say, Employee Last Name and DOB,
Smith, 01/01/80
Lee, 08/15/60
.
.
In the EMP table, the columns are
Last Name (part of the key)
DOB (part of the key)
First Name (part of the key)
.
.
And data in the EMP table would look like,
Smith John 01/01/80 ......
Smith James 02/02/82 .....
Smith Jenny 03/03/84 ....
Lee Betty 05/01/60 ....
Lee Brenda 04/04/62 ....
For 1st record in Seq file (Smith), we need to retrieve 3 records (John, James and Jenny). For 2nd record in Seq file (Lee), we need to get 2 records (Betty and Brenda). More of an "explicit cursor" situation.
Is this possible? If yes, any suggestions?
Thank you everyone,
Kevin