[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: How can this be done??



In a message dated 97-01-23 22:19:33 EST, you write:

<< Hi All,
  I have this question. I have a select statement which has an IN clause, for
eg.

 select emp_iid
 from emp
 where dept in ('HR',ENG')

 This is the problem. I would like to have th IN clause parameters to be a
 variable number. I have an upper limit though (say 10) I dont know how many
 different Dept's i might have to include. I tried passing all the depts as a
 comma seperated string. I UNSTRING them into 10 different variables and them
 make them into a string like 'HR','ENG','SALES' (including the ' and , ) say
 $Dept. so now the select clause could look like as
 select emp_iid where dept in ($Dept).
 This apparently does not work. Does anybody have any suggestion for this
kinda
 problem?

 Thanks
 Raja
 raja@wise.com
  >>

Raja,

Why don't you load the departments into a lookup table and reference it every
time you need it.

Fernando Villaamil
Miami Herald Publishing Co.