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

Re: Lookup table key



Greg,

> In SQR v4, can multiple columns be used as the key on a lookup table?  I
> know multiple columns can be returned via the
> '||' operator, but I need a lookup table to return (1) value based on two
> others.  Has anyone done this?

Suppose I have a table EMP with character columns LAST_NAME,
FIRST_NAME, and SSN.  Further, the table EMP contains a row
with the values 'Ontko' , 'Ray' , and '123-45-6789', respectively.

The following program prints '123-45-6789' when run:

begin-setup
load-lookup
   name=emp
   table=emp
   key='last_name||'', ''||first_name'
   return_value=ssn
end-setup

begin-program
do main
end-program

begin-procedure main
lookup emp 'Ontko, Ray' $ssn
show $ssn
end-procedure

Ray
----------------------------------------------------------------------
Ray Ontko       |  Ray Ontko & Co  |  "RO&C: data movers and shakers."
rayo@ontko.com  |  Richmond, In    |  See us at http://www.ontko.com/