Kbase P24601: How to select the first record with SQL-89?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  06/05/2003 |
|
Status: Unverified
GOAL:
How to select the first record with SQL-89?
FACT(s) (Environment):
Progress 9.x
FIX:
To fetch only the first record from a given SQL-89 SELECT statement, use the following code:
DEFINE VARIABLE vCustNum AS INTEGER NO-UNDO.
DEFINE VARIABLE vBalance AS DECIMAL NO-UNDO.
DEFINE VARIABLE vCreditLimit AS DECIMAL NO-UNDO.
DECLARE C01 CURSOR FOR SELECT CustNum, Balance, CreditLimit FROM CUSTOMER.
OPEN C01.
FETCH C01 INTO vCustNum, vBalance, vCreditLimit.
DISPLAY vCustNum vBalance vCreditLimit.
CLOSE C01.