An alphanumeric or a national value can be used in:
Assignments:
(see section "Assignment rules")Functions:
An alphanumeric or a national value can be used in the aggregate functions COUNT(), MIN() and MAX(), in numeric functions and in string functions.Concatenation:
Two alphanumeric values can be concatenated to create a single alphanumeric value; two national values can be concatenated to create a single national value. See section "Compatibility between data types".Predicates:
An alphanumeric or a national value can be used in comparisons with another value or with a derived column, in range queries, in element queries and in pattern comparisons. All the values concerned must be either alphanumeric values or national values, see the section "Compatibility between data types". The rules governing comparisons are described in the section "Comparison of two rows".
Functions, expressions and predicates are described in detail in the chapter "Compound language constructs".
Alphanumeric literals in the form X'...' must not be used in SET CATALOG, SET SCHEMA, SET SESSION AUTHORIZATION statements or in the GLOBAL descriptor.
Examples
Enter first and last name in the CUSTOMERS table:
|
INSERT INTO customers (cust_num, company, street, zip)
VALUES (100,Siemens AG,"Otto-Hahn-Ring 6",81739)
This is an error: strings must be enclosed in single quotes.
Search for the names of the tables, the authorization identifiers and the privileges for which the current authorization identifier has a table privilege:
CREATE VIEW privileged AS SELECT TABLE_NAME, GRANTEE, PRIVILEGE_TYPE
FROM INFORMATION_SCHEMA.TABLE_PRIVILEGES WHERE GRANTOR = UTIUNIV
Define the table BOOKS with the VARCHAR column TITLE and enter values:
CREATE TABLE books (order_number INTEGER, title VARCHAR(50)) COMMIT WORK INSERT INTO books VALUES (3456, 'Not Now Bernard') INSERT INTO books VALUES (5777, 'Lullabies') INSERT INTO books VALUES (7888, 'This is a very long title with more than fifty characters')
The last title is not entered. An error message is issued.
Enter additional information on the contact person Mary Davis in the CONTACTS table:
UPDATE contacts set contact_info=('Ms. Davis is ' 'on leave from ' '1.8 to 31.10') where contact_num=40
The following is incorrect:
UPDATE contacts set contact_info= ('Ms. Davis is ' 'on leave ' 'from 1.8 to 31.10') where contact_num=40
At least one of the separators between the substrings must be a transition to the next line.
Comparing strings
| is true is falsch |
Define the MANUALS table with the NCHAR columns LANGUAGE and TITLE and enter
CREATE TABLE manuals (ord_num INTEGER, language NCHAR(20), title NCHAR(30)) COMMIT WORK INSERT INTO manuals VALUES (1001, N'Deutsch', N'Betriebsanleitung'), (1002, N'English', N'Operating Manual'), (1003, U&'Fran\00E7ais', N'Manuel d''utilisation'), (1004, U&'Espa\00F1ol', N'Manual de instrucciones'), (1005, N'Italiano', N'Istruzioni per l''uso'), (1006, NX'039503BB03BB03B703BD03B903BA03AC', NX'039F03B403B703B303AF03B503C2002003BB' '03B503B903C403BF03C503C103B303AF03B103C2') |
The LANGUAGE and TITLE titles then contain the following national values:
LANGUAGE TITLE Deutsch Betriebsanleitung English Operating Manual Français Manuel d'utilisation Español Manual de instrucciones Italiano Istruzioni per l'uso ΕλληνικάΟδηγίες λειτουργίας