[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Dynamic Column Substitution
- Subject: Re: Dynamic Column Substitution
- From: mike@rmf41.usace.army.mil (Mike R. Stone)
- Date: Fri, 22 Sep 1995 23:54:47 -0600
>
> Hello,
>
> I am trying to dynamically substitute a column name in an SQR 'Select'
> statement and get the following error message:
>
> *****************
> SQLBase SQLCOM error 915 in cursor 2:
> Invalid constant
> following an example from the SQR manual. Any suggestions?
>
> if '{file_type}' = 'CALLINFO'
> let $call_id = 'callinfo.call_id'
> else
> if '{file_type}' = 'CALLINFO_HIST'
> let $call_id = 'callinfo_hist.call_id'
> end-if
> end-if
> begin-select
>
> [$call_id] &call_id=char ***** This seems to be the
> line with the problem
>
> print &call_id (+1,1)
> Marcie Hague
> MicroSim Corporation
>
Try the DECODE statement to return values from alternate columns:
DECODE('$call_id','callinfo.call_id',callinfo.call_id,callinfo_hist.call_id)
&call_id
A B C D
if A matches B return C else return D for this selection.
We are using something similar to this in many places.
Mike Stone Advanced Technology Systems, Huntsville, Al