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

RE: [sqr-users] SQR logic in SQL



Eric,

I suggest that you place more of the WHERE clause in your Dynamic SQL
Variable.
For example:

  if $input_car_type != ''
    let $AND = ' AND         C.TYPE IN (' || $input_car_type || ')'
  else
    let $AND = ''
  end-if 

begin-select
[list of columns]
FROM  CAR  C,
      YEAR Y,
WHERE C.FAST > 150
[$AND]
end-select
  

-----Original Message-----
From: sqr-users-bounces+ginabencke=forestcity.net@sqrug.org
[mailto:sqr-users-bounces+ginabencke=forestcity.net@sqrug.org] On Behalf
Of DICKMAN, ERIC C.
Sent: Monday, June 28, 2004 11:29 AM
To: sqr-users@sqrug.org
Subject: [sqr-users] SQR logic in SQL


> Hello Everyone,
> 
> I am fairly new to the programming language of SQR.  I am attempting 
> to dynamically populate some SQL values in SQR and when the value does

> not exist it creates problems the SQL (returns nothing).  Is it 
> possible to put SQR logic around the SQL. I created an example below 
> of SQR logic in SQL Is it possible to do something like that or is 
> there another was to handle this problem in the SQR?  The CARYEAR 
> value is '' (no parameter entered by the user) many times, because the

> values in passed in from a Search page.
> 
> I pass in the follow variables:
> CARTYPE = ('Mustang','Corvette','Accord','Ranger')
> CARYEAR = ('')
> 
> ask {CARTYPE}
> ask {CARYEAR}
> 
> move  '{CARTYPE}'                 to $input_car_type
> move  '{CARYEAR}'                 to #input_car_year 
> 
> SELECT *
> FROM  CAR  C,
>       YEAR Y,
> WHERE       C.FAST > 150
> AND         C.TYPE IN ([$input_car_type])
> 
> if $input_car_year  <> '' 
>  AND         Y.YEAR IN ([#input_car_year])
> end-if
> 
Thanks,

Eric 


NOTE: The Texas Department of Protective and Regulatory Services (TDPRS)
has changed its name to the Department of Family and Protective
Services(DFPS) resulting in the following e-mail address format change
for all employees: firstname.lastname@dfps.state.tx.us 

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org http://www.sqrug.org/mailman/listinfo/sqr-users



_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users