PreviousNextIndex

CREATE statement

Creates a record in a table, sets all the fields in the record to their default initial values, and moves a copy of the record to the record buffer.

Data movement

Syntax

CREATE record 
  [ USING { ROWID ( nrow ) | RECID ( nrec ) } ] [ NO-ERROR ] 

record
USING { ROWID ( nrow ) | RECID ( nrec ) }
NO-ERROR
Example

The following example creates a record in the order file for each pass through the loop and then updates the record. It also creates an order-line record.

r-create.p
REPEAT: 
  CREATE Order. 
  UPDATE Order.OrderNum Order.CustNum  
    VALIDATE(CAN-FIND(Customer OF Order), "Customer does not exist") 
    Order.CustNum Order.OrderDate. 
  REPEAT: 
    CREATE OrderLine. 
    OrderLine.OrderNum = Order.OrderNnum. 
    UPDATE OrderLine.LineNum OrderLine.ItemNum  
      VALIDATE(CAN-FIND(Item OF OrderLine), "Item does not exist") 
      OrderLine.Qty OrderLine.Price. 
  END. 
END. 

This procedure adds Orders and OrderLines to the database. Because the user supplies an order number when updating the order record, that order number is assigned (=) to the OrderNum field of the OrderLine record when the OrderLine record is created.

Notes
See also

INSERT statement, NEW function (record buffers)


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex