NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
D-16
DAYOFWEEK Function
DAYOFWEEK Function
DAYOFWEEK is a function that reads a date-time expression and returns a type
INTEGER value in the range 1 through 7 that represents the day of the week expressed
by the date-time value. The value 1 represents Sunday, 2 represents Monday, and so
forth.
date-time-expression
is an expression that evaluates to a value of type DATETIME, DATE, TIME, or
TIMESTAMP.
Examples—DAYOFWEEK
The following function call returns an integer that represents the day of the week
from a date-time value in the START_DATE column of a table named PROJECTS:
SELECT DAYOFWEEK(START_DATE) FROM PROJECTS
WHERE PROJECT_NAME = "920";
If the row selected looks like the following:
PROJECT_NAME START_DATE END_DATE WAIT_TIME
------------ ---------------- ---------------- ---------
920 1993-02-24:20:30 1995-03-21:20:30 20
the value returned is 1, representing Sunday.
DCL (Data Control Language) Statements
DCL (Data Control Language) is the set of SQL statements and directives that control
parallel processing, name resolution, and performance-related considerations such as
access paths, join methods, and locks and cursors. The following table summarizes the
DCL statements and directives.
DAYOFWEEK ( date-time-expression )
DCL Statements and Directives
CONTROL EXECUTOR
Directive
Enables or disables parallel processing of queries
CONTROL QUERY
Directive
Specifies whether to resolve names at execution or SQL startup,
whether to consider use of hash joins, and whether to optimize
queries for few or many rows returned
CONTROL TABLE
Directive
Controls locks, opens, buffers, access paths, join methods, and
join sequences