Lets you store the missing value for a field with the STORE statement or the MODIFY statement. When a field is referred to as missing, you can think of the field as empty, a field in which no value is stored. In order to use RDB$MISSING, you must have previously defined a missing value for the field when you defined the database. If a field is left blank, or you use RDB$MISSING without having defined a missing value for that field in its field definition, RDML returns an error.
1 – Format
(B)0[mmissing-value = qqq> [4mRDB$MISSING[m qqqqqqqqqqqqqqqqq>qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq<qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x mq> ( qwq> context-var . field-name qqqqqqqqqqqqqqqwqq> ) qqq> tq> relation-name . field-name qqqqqqqqqqqqqu mq> db-handle . relation-name . field-name qj
1.1 – Format arguments
context-var A context variable. A temporary name that you associate with a relation. You define a context variable in a relation clause. For more information see the entry on Context Variables. field-name The name of a field in a relation. For example, once you have defined E as the context variable for the EMPLOYEES relation, E.LAST_NAME is a value expression that refers to a value from the LAST_NAME field of EMPLOYEES. relation-name The name of a relation in the database. db-handle Database handle. A host variable used to refer to a specific database you have invoked. For more information see the entry on the Database Handle clause.
2 – Examples
The following programs demonstrate the use of the RDB$MISSING value expression with the STORE clause. The programs store the specified values for the fields in the DEGREES relation. In these programs, a value for DEGREE_FIELD is not specified; instead, the RDB$MISSING value expression is specified. This does not actually assign a value to the degree field; RDML marks the DEGREE_FIELD as empty and stores nothing in this field. Note that the C program uses the pad_string function to read in the values for the STORE statement. This function pads the values stored in each field with the correct number of trailing blanks to ensure that the length of the values stored match the text size of the field. For more information on pad_string, see Appendix B of the "RDML Reference Manual".
2.1 – C Example
#include <stdio.h> DATABASE PERS = FILENAME "PERSONNEL"; extern void pad_string(); main() { READY PERS; START_TRANSACTION READ_WRITE; STORE D IN DEGREES USING pad_string ("76156", D.EMPLOYEE_ID, sizeof(D.EMPLOYEE_ID)); pad_string ("HVDU" , D.COLLEGE_CODE, sizeof(D.COLLEGE_CODE)); D.YEAR_GIVEN = 1978; pad_string ("BA", D.DEGREE, sizeof(D.DEGREE)); pad_string (RDB$MISSING(D.DEGREE_FIELD),D.DEGREE_FIELD, sizeof(D.DEGREE_FIELD)); END_STORE; ROLLBACK; FINISH; }
2.2 – Pascal Example
program store_missing (input,output); DATABASE PERS = FILENAME 'PERSONNEL'; begin READY PERS; START_TRANSACTION READ_WRITE; STORE D IN DEGREES USING D.EMPLOYEE_ID := '76156'; D.COLLEGE_CODE := 'HVDU'; D.YEAR_GIVEN := 1978; D.DEGREE := 'BA'; D.DEGREE_FIELD := RDB$MISSING(D.DEGREE_FIELD); END_STORE; ROLLBACK; FINISH; end.