NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
C-5
Considerations—CAST
cannot be a date-time or INTERVAL data type. (To associate a date-time or
INTERVAL data type with a parameter, use the TYPE AS clause described under
PARAMETERS.)
The value you specify for the parameter must be compatible with the data type you
specify with the CAST function.
Considerations—CAST
Null values
If the parameter value is NULL, SQL sets the target value to NULL, regardless of
the data type.
Examples—CAST
The following example uses the CAST function to associate data type NCHAR(5)
with a parameter:
>> CREATE TABLE T (A NCHAR(5));
>> PREPARE S1 FROM
+> "INSERT INTO T VALUES (CAST(? AS NCHAR(5)))";
>> EXECUTE S1 USING N"c1c2c3"; -- This is okay.
>> EXECUTE S1 USING "c1c2c3"; -- This causes an error.
As a result of the type specification, the second of the two EXECUTE statements
causes an error: the character string specified as the parameter value is associated
with an unknown character set, not the system default national character set
specified in the CAST invocation on the INSERT statement.
CATALOG Command
CATALOG is an SQLCI command that sets the default catalog in an SQLCI session.
catalog
is a catalog name (a Guardian subvolume name) with or without a node and volume
qualifier. It cannot be a DEFINE.
If you omit catalog, SQLCI resets the default to the value of the CATALOG
attribute of the =_DEFAULTS DEFINE that SQLCI inherited from the process that
started the session. If you omit the node and volume qualifier, SQLCI uses the
current defaults.
CATALOG [ catalog ] ;