Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New to Progress; how to define a foreign key

Status
Not open for further replies.

igorios

Programmer
Apr 11, 2004
1
AT
i only got an shallowly aproach now to progress 9.1 and im pining in defining a "simple" foreign key from one table to another! -- thanks for help
 
You can't define foreign key in Progress db because it knows nothing about foreign keys, referential integrity etc.

Relations between tables you should implement "manually"

First you should create index that contains foreign key fields (relations can work without it, but it'll be faster with index).

If you have table Orders that can be CustomerID field.

Then you can say something like:

FOR EACH Order WHERE Order.CustomerID = 123 USE-INDEX xCust:
/*CODE*/
END.

Or if you find the customer first:

FIND FIRST Customer WHERE Customer.CustomerID = 123 NO-LOCK NO-ERROR.

/* assuming that customer was found... */

FOR EACH Order OF Customer USE-INDEX xCust:
/*CODE*/
END.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top