PreviousNextIndex

Record phrase

Identifies the record or records you want to verify using the CAN-FIND function, retrieve with a FIND statement, query with a FOR statement or OPEN QUERY statement, or preselect in a DO or REPEAT block.

The Record phrase syntax describes three kinds of information:

Syntax

{ record [ field-list ] } 
[ constant ] 
[ [ LEFT ] OUTER-JOIN ] 
[ OF table ] 
[ WHERE expression ] 
[ USE-INDEX index ]  
[ USING [ FRAME frame ] field 
    [ AND [ FRAME frame ] field ] ... ] 
[ SHARE-LOCK | EXCLUSIVE-LOCK | NO-LOCK ] 
[ NO-PREFETCH ] 

Note: You can specify the OUTER-JOIN, OF, WHERE, USE-INDEX, and USING options in any order. You cannot use field-list in an OPEN QUERY statement. You cannot use OUTER-JOIN or EXCLUSIVE-LOCK in a CAN-FIND function.
record
field-list
constant
[ LEFT ] OUTER-JOIN
OF table
WHERE expression
USE-INDEX index
USING [ FRAME frame ] field [ AND [ FRAME frame ] field ] . . .
SHARE-LOCK
EXCLUSIVE-LOCK
NO-LOCK
NO-PREFETCH
Examples

In the r-recph.p procedure, there are two Record phrases that make an inner join between the Customer and Order tables.

r-recph.p
FOR EACH Customer FIELDS(CustNum Name CreditLimit) 
  WHERE Customer.CreditLimit GE 50000,  
  EACH Order FIELDS(OrderNum OrderDate Terms) OF Customer: 
  DISPLAY Customer.CustNum Customer.Name Customer.CreditLimit Order.Orderum 
    Order.OrderDate Order.Terms. 
END. 

Using these Record phrases, the FOR EACH block reads a Customer record only if it has a CreditLimit value greater than 50000 and at least one Order record associated with it.

r-recph2.p
REPEAT: 
  FIND NEXT Customer USE-INDEX country-post WHERE Customer.Name BEGINS "S" 
    EXCLUSIVE-LOCK. 
  UPDATE Customer.Name Customer.Country Customer.PostalCode Customer.Phone. 
END. 

In the r-recph2.p procedure, there is one Record phrase:

Customer USE-INDEX country-post WHERE Customer.Name BEGINS "S" EXCLUSIVE-LOCK 

Using the zip index named country-post rather than the CustNum index (the primary index for the Customer table), the FIND statement reads only those Customer records that have a Name that begins with an s. The FIND also places an EXCLUSIVE-LOCK on each record as it is read. This lock is released at the end of the REPEAT block.

In the output of this procedure, all the Customer names begin with s and the customers are displayed in order by country and then postal code.

Notes
See also

DEFINE QUERY statement, DO statement, FIND statement, FOR statement, OPEN QUERY statement, REPEAT statement


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex