Creates the temporary definition of a dictionary or domain table. list (ACL) for the table. The following sections explain how to declare dictionary and domain tables. Format To declare a dictionary table use the following syntax: DECLARE TABLE table-name [QUERY_HEADER [IS] "header-segment"[/...]] [EDIT_STRING [IS] edit-string] [USING] code-field : translation-field [,] {"code-1" } { "translation-1" } {code-1 }: { translation-1 }[,] { } { } [ {"code-2" } {"translation-2" } ] [ {code-2 }: {translation-2 } ][,] [ { } { } ] . . . . . . [ { "translation-n" } ] [ ELSE {translation-n } ] [ { } ] END_TABLE To declare a domain table use the following syntax: DECLARE TABLE table-name FROM [DOMAIN] domain-name [QUERY_HEADER [IS] "header-segment"[/...]] [EDIT_STRING [IS] edit-string] [USING] code-field : translation-field [,] [ { "translation-string" } ] [ ELSE {translation-string } ] [ { } ] END_TABLE
1 – Arguments
table-name Is the name of the dictionary table being defined. It must be a simple name. "code" : "translation" Is a code-and-translation pair. You must separate each pair with a colon. The comma after each pair is optional. If the code or translation conforms to the rules for DEC DATATRIEVE names given in the DEC DATATRIEVE User's Guide, you do not have to enclose it in quotation marks. However, DEC DATATRIEVE converts to uppercase any lowercase letters in an unquoted code or translation. If the code or translation does not conform to the rules for DEC DATATRIEVE names (especially if it contains any spaces), or if you want to preserve lowercase letters, you must enclose the code or translation in quotation marks (" ") and follow the rules for character string literals. ELSE "translation" Is the translation to be used if you specify a code not defined in the dictionary table. The rules for specifying this translation string are the same as those for codes and translations. END_TABLE Ends the dictionary table definition.
2 – Examples
The following example declares a table of department codes and specifies a query header for the translations of the table: DTR> DECLARE TABLE DEPT_TABLE DFN> QUERY_HEADER IS "Responsible"/"Department" DFN> CE : "Commercial Engineering" DFN> PE : "Plant Engineering" DFN> CS : "Customer Support" DFN> RD : "Research and Development" DFN> SD : "Sales Department" DFN> ELSE "UNKNOWN DEPARTMENT" DFN> END_TABLE DTR> DTR> print "John belongs to " | ( "RD" via DEPT_TABLE ) ; John belongs to Research and Development The following example declares a table with a translation for each possible rig and includes an edit string in the definition that displays the translation in a 10 character wide column: DTR> DECLARE TABLE RIGGING DFN> EDIT_STRING IS T(10) DFN> QUERY_HEADER "TYPE OF"/"RIGGING" DFN> SLOOP : "ONE MAST" DFN> KETCH : "TWO MASTS, BIG ONE IN FRONT" DFN> YAWL : "SIMILAR TO KETCH" DFN> MS : "SAILS AND A BIG MOTOR" DFN> ELSE "SOMETHING ELSE" DFN> END_TABLE DTR> PRINT "KETCH" VIA RIGGING TYPE OF RIGGING TWO MASTS, BIG ONE IN FRONT DTR> The following example shows how to declare a domain table that returns the price of a yacht when you enter a value for LENGTH_ OVER_ALL. The example specifies a query header and an edit string for the translation field: DTR> DECLARE TABLE LOA_PRICE_TABLE DFN> FROM CDD$TOP.DTR$LIB.DEMO.YACHTS DFN> QUERY_HEADER IS "SAMPLE"/"PRICE" DFN> EDIT_STRING IS $$$,$$$ DFN> USING LOA : PRICE DFN> ELSE "NO BOATS IN STOCK WITH THAT LOA." DFN> END_TABLE DTR> PRINT 26 VIA LOA_PRICE_TABLE SAMPLE PRICE $17,900 DTR>