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

Re: Fetching data



Thats one way, but typically I use the LOOPS argument on the begin-Select


Begin-Select loops=1

DataCol         &Data
        Move ...

>From ...
Where...

End-Select

-Mark


-----Original Message-----
From:   Dray, Adam [SMTP:Adam.Dray@PHH.COM]
Sent:   Tuesday, October 19, 1999 10:37 AM
To:     Multiple recipients of list SQR-USERS
Subject:        Fetching data

This falls into the "extremely basic" question category.  I'm a
fairly experienced SQR user, but I haven't really seen other people's
code, so I'm wondering if there is a cleaner solution.


I want to fetch a single element of data from a table, given a key.
Theoretically, the key should be unique, but it might not be.  I
want the first row if it isn't.

Do you typically use a Begin-Select with an Exit-Select inside it?
Like this?

    Begin-Procedure Get-Data ( $key, :$data )
    Begin-Select
    datacolumn  &data
        Let $data = &data
        Exit-Select
    Where keycolumn = $key
    End-Select
    End-Procedure

Is this how people typically do it?