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

Re: Fetching data



why not use loop=1 option in the sqr select?

-----Original Message-----
From: Dray, Adam [mailto:Adam.Dray@PHH.COM]
Sent: Tuesday, October 19, 1999 8: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?