Previous Topic: Retrieve Records Directly by RID

Next Topic: Read Sequentially by RID

Retrieve Records by Key Field

When you know the value for a key field, retrieve a record matching that key field by coding:

&NDBGET dbname FIELD=fieldname VALUE=value FORMAT=fmtname

Code OPT=KGE to return a record where the key field satisfies the coded option. For character or HEX fields, OPT=GENERIC is also supported. Use OPT=KGT for forward, or OPT=KLT for backward, and supply the last key field value as the search argument to simulate sequential reading.

For key fields that are not unique, this technique always returns the record with the lowest RID, from the set of records having the same key field value. The other records cannot be accessed this way.