[ Recorded Database | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]

# referenced_record(+DBRef, -Value)

Succeeds if DBRef is the database reference of a currently recorded term and this term unifies with Value

DBRef
  A database reference.
Value
  Any Prolog term.

## Description

The database reference DBRef must refer to a term that has been recorded in the indexed database. Database references can be obtained from the predicates recorda/3, recordz/3 and recorded/3. If the referenced term has already been erased, referenced_record/2 fails. Otherwise, Value is unified with a copy of the recorded term. Note that database references are not integers.

### Modes and Determinism

- referenced_record(+, -) is semidet

### Fail Conditions

Fails if the referenced term has already been erased

### Exceptions

(4) instantiation fault
  DBRef is not instantiated.
(5) type error
  DBRef is neither a variable nor a database reference.

## Examples

       Success:
       [eclipse]: recordz(beer, paulaner, Ref),
       referenced_record(Ref, X).
       Ref = 1714c8
       X = paulaner
       yes.
       [eclipse]: recorded(beer, _, Ref),
       referenced_record(Ref, X).
       Ref = 1714c8
       X = paulaner     More? (;)
       yes.
       Failure:
       [eclipse]: recorded(beer, _, Ref),
       erase(Ref), referenced_record(Ref, X).
       no (more) solution.
       Error:
       referenced_record(_, Value).         (Error 4)
       referenced_record(123, Value).       (Error 5)

## See Also

recorda / 3, recordz / 3, recorded / 3, erase / 1, referenced_record / 2