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".
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 – 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.