docs.intersystems.com
InterSystems IRIS Data Platform 2019.2  /  InterSystems SQL Reference

InterSystems SQL Reference
%OID
Previous section           Next section
InterSystems: The power behind what matters   
Search:  


A scalar function that returns OID of an ID field.
Synopsis
%OID(id_field)
Arguments
id_field The field name of an ID field, or a reference field.
Description
%OID takes a field name and returns the fully formedOID (object ID) for the object. The field must be either an ID field or areference field (a foreign key field). Specifying any other type of fieldin id_field generates an SQLCODE -1 error.
Examples
The following example shows %OID used with a reference field:
SELECT Name, Spouse, %OID(Spouse)
FROM Sample.Person
WHERE Spouse IS NOT NULL
The following Embedded SQL example shows %OID used with a reference field:
  &sql(SELECT Name, Spouse, %OID(Spouse)
       INTO :n,:s,:soid
       FROM Sample.Person)
  WRITE !,"Name is:",n
  WRITE !,"Spouse name is:",s
  WRITE !,"Spouse OID is:",soid
See Also


Previous section           Next section
Send us comments on this page
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-08-23 06:48:00