SQL/MX 3.1 Programming Manual for C and COBOL (H06.23+, J06.12+)
Host Variables in C/C++ Programs
HP NonStop SQL/MX Release 3.1 Programming Manual for C and COBOL—663854-001
3-24
Date-Time and Interval Data
exists for single-precision Tandem REAL and FLOAT in IEEE floating-point format, the
conversion to IEEE DOUBLE preserves the precision and the exponent.
If you want a small floating-point data type with a smaller exponent and less storage,
consider declaring the host variables as float. If you want more exponent and a
larger precision, consider declaring the host variables as double or float(p).
For more information on floating-point formats, see the SQL/MX Reference Manual.
Date-Time and Interval Data
Use the following for date-time and interval data types:
For SQL/MP DATETIME data types that are not equivalent to DATE, TIME, or
TIMESTAMP, you are still required to declare a character array host variable and use
the CAST function for input to and output from date-time or interval columns, similar to
SQL/MX Release 1.8, which does not support ANSI-99 date-time host variables.
DATE Representation
You can insert or retrieve date-time values in any of three formats, independently of the
SQL column definition. For example, you can specify formats such as 09/15/1993,
1993-09-15, or 15.09.1993. You control the display format by inserting the value in the
format you want and retrieving the value by using the DATEFORMAT function. See the
DATEFORMAT function in the SQL/MX Reference Manual.
For example, if a table in the database has this column definition:
HIRE_DATE DATE
The host variable representation for December 22, 1988, in DEFAULT format is:
A DATE host variable in DEFAULT format is represented as an 11-character string,
including 10 characters—with hyphens (-) as field separators—plus a character (empty
space) for a null terminator.
Selecting Standard Date-Time Values
To retrieve standard date-time values (DATE, TIME, or TIMESTAMP, or the SQL/MP
DATETIME equivalents) from the database, declare a date-time (DATE, TIME, or
DATE Represents a date.
TIME Represents a time.
TIMESTAMP Represents a timestamp.
INTERVAL Represents a duration of time as a year-month or day-time
interval.
1 9 8 8 1 2 2 2
Year Separator Month Separator Day
Null










