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

Re: Multiple parameter for WHERE clause



Anne,

What I generally do for optional WHERE parameters is to initialize them all
as '1=1', then if the user has entered a parameter, I update the variable
assignment.

Let $where1 = '1=1'
Let $where2 = '1=1'
Let $where3= '1=1'

If ISNULL($userparam1)=0
  LET $where1 = 'NAME = ' || '''' || $userparam1 || ''''
end-if

begin-select
column1        &col1

>From Tables
Where [$where1]
and [$where2]
and [$where3]

David L Smith
IBM Global Services