SQL/MP Report Writer Guide
Table Of Contents
- What’s New in This Manual
- About This Manual
- 1 Introduction to the NonStop SQL/MP Report Writer
- 2 Using SQLCI and the Report Writer
- 3 Selecting Data for a Report
- 4 Customizing a Report
- Defining the Layout
- Specifying the Items in a Detail Line
- Naming Select List and Detail Line Items
- Organizing Rows Into Break Groups
- Labeling Information
- Formatting Data Values
- Formatting Dates and Times
- Using TACL to Pass Parameters
- Conditional Printing of Items or Line Entries
- Redefining Special Characters
- Calculating Totals
- Calculating Subtotals
- Printing Double-Byte Characters
- A Comparison of the Report Writer and the Enform Language
- Index

Customizing a Report
HP NonStop SQL/MP Report Writer Guide—527213-001
4-40
Formatting Dates and Times
Date and Time Values
A report can contain dates and times selected from columns of the following data
types: DATETIME, DATE, TIME, or TIMESTAMP. You can also use date-time literals or
expressions to generate dates and times for a report. For a complete description of
date-time data types and literals, see the
SQL/MP Reference Manual.
You can compute a date and time by using the COMPUTE_TIMESTAMP,
CURRENT_TIMESTAMP, or CURRENT function.
•
The COMPUTE_TIMESTAMP function produces a Julian timestamp (sometimes
called a Guardian timestamp) for the date and, optionally, the time you specify:
COMPUTE_TIMESTAMP (6/18/2000 05:20:30:000:000)
or
COMPUTE_TIMESTAMP (6/18/2000)
The data type of a Julian timestamp is LARGEINT.
•
The CURRENT_TIMESTAMP function produces a Julian timestamp for the current
date and time at the time the line containing CURRENT_TIMESTAMP is printed.
For example, if you use CURRENT_TIMESTAMP in the report title and the report
footing, the time portion of the values might differ. The data type of the result is
LARGEINT.
COMPUTE_TIMESTAMP and CURRENT_TIMESTAMP are report writer functions
and can be used only in report command print lists and in the SET PARAM and
EXECUTE commands. For an example of using the SET PARAM command, see
Using Parameters With SELECT Commands
on page 3-23.
•
The CURRENT function produces a timestamp for the current date and time. The
result is a value of data type TIMESTAMP. Each time you execute a SELECT
command, a TIMESTAMP value is generated and saved until you execute another
SELECT command. Regardless of where you specify CURRENT, the date and
time returned is based on the TIMESTAMP value generated when the previous
SELECT command was executed.
You can use the CURRENT function (and all other NonStop SQL/MP date-time
functions) anywhere that an SQL expression is allowed. Functions can be used
with the SELECT command, the value list of an INSERT or the UPDATE
command, and a report command print list. You cannot use the CURRENT function
in a SET PARAM or EXECUTE command. For descriptions of the SQL date-time
functions, see the
SQL/MP Reference Manual.
You might also store a date as a numeric value but not as a timestamp. See Formats
for Dates Stored as Binary Values on page 4-44.