Wednesday, September 25, 2013

How to Pass Null Values to API - Oracle PLSQL

An attribute value that is not passed in is assumed to have a default of null for a Create API. For an Update API, if a particular attribute value is not passed into the API, then the database retains the existing value. In order to set a database value to null, the calling program must explicitly set the attribute value to one of the following constants, based on the data type of the attribute.
  • FND_API.G_MISS_NUM for NUMBER type.
  • FND_API.G_MISS_CHAR for VARCHAR2 type.
  • FND_API.G_MISS_DATE for DATE type.
These are pre-defined values in the FND_API Package (fndapis.pls)
  • G_MISS_NUM CONSTANT NUMBER:= 9.99E125
  • G_MISS_CHAR CONSTANT VARCHAR2(1):= chr(0)
  • G_MISS_DATE CONSTANT DATE:= TO_DATE('1','j') ;