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

using a dynamic in select



OK SQR guru's- I have used dynamic variables in many ways, but this one is
a challange.  I am selecting the field names from the metadata and putting
them into a variable.  I need to then be able to use that dynamic variable
in a select statement- here is the code:

let $FIELDNAME = 'NV.' || $RECFIELDNAME

(sets up my fieldname with the table alias it will be using in the select)

then:

begin-select

[$FIELDNAME] &OLDVALUE

FROM [$FROM_AUDITRECNAME] NV
WHERE &AD.EMPLID = NV.EMPLID
and &AD.AUDIT_ACTN = NV.AUDIT_ACTN
and &astamp = NV.AUDIT_STAMP

yet, the [$FIELDNAME] won't work, I get an error "Invalid &pseudonym
'Type=' data-type specified for a begin-select column-variable.  Valid
types are: CHAR, TEXT, DATE, NUMBER'

I can not take the brackets from around the dynamic variable or it will
select the value I am passing, not use that value to form my select
statement.

Does anyone have any suggestions, or has anyone done anything like this?

Denise Goin
Paramount Studios