NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
I-19
INTERVAL Data Type
The following example inserts a DATETIME value into the TIME_SHIPPED
column:
INSERT INTO SHIPMENTS (TIME_SHIPPED)
VALUES ( DATETIME "1988-10-22:08:15" YEAR TO MINUTE );
The following example inserts a DATE value into the BIRTHDATE column of the
PERSONNEL table:
INSERT INTO PERSONNEL (BIRTHDATE)
VALUES ( DATE "1940-10-09" );
The following example inserts DATETIME and INTERVAL values:
INSERT INTO PROJECTS
VALUES ("945", DATETIME "1989-10-20" YEAR TO DAY,
DATETIME "1990-10-21" YEAR TO DAY,
INTERVAL "30" DAY);
In the following example, CUSTLIST is a protection view of all columns of the
CUSTOMER table except the credit rating.
Suppose that one of your suppliers has become a customer. If you can use the same
number for both the customer and supplier numbers, you can select the supplier
information from the SUPPLIER table and insert it in the CUSTOMER table
through the CUSTLIST view. This operation works because the columns of the
SUPPLIER table contain values that correspond to the columns of the CUSTLIST
view. If you want a credit rating that is different from the default, you must update
the row.
VOLUME $VOL1.SALES;
INSERT INTO CUSTLIST
( SELECT * FROM INVENT.SUPPLIER WHERE SUPPNUM = 10 );
UPDATE CUSTOMER SET CREDIT = "A4" WHERE CUSTNUM = 10;
INTERVAL Data Type
INTERVAL values represent durations of time in year-month units (years and months),
in day-time units (days, hours, minutes, seconds, and fractions of a second), or in
subsets of those units.