6.2 Setting the PLVision Date Mask

Chapter 6
PLV: Top-Level Constants and Functions
 

6.2 Setting the PL/Vision Date Mask

To standardize the way that date information is displayed inside PL/Vision, the PLV package maintains a PL/Vision date mask. This mask is used in the p, PLVtrc, PLVtab, and PLVlog packages to convert dates to strings.

The default date mask for PL/Vision is stored in the c_datemask constant and has this value:

FMMonth DD, YYYY HH24:MI:SS

The FM prefix is a toggle that requests suppression of all padded blanks and zeroes.

You can change the date mask with a call to set_datemask, whose header is:

PROCEDURE set_datemask (datemask_in IN VARCHAR2 := c_datemask)

Since the default value for set_datemask is the default date mask for PL/Vision, you can also reset the date mask to the default by calling set_datemask without any arguments.

You can retrieve the date mask (which is to say, you can use the date mask yourself) by calling the datemask function:

FUNCTION datemask RETURN VARCHAR2;

The following calls to set_datemask and the datemask function illustrate the behavior of these programs.

SQL> exec p.l(sysdate); May 17, 1996 13:41:56

Change the date mask to show only month and year:

SQL> exec PLV.set_datemask ('Month YYYY'); SQL> exec p.l(sysdate); May       1996

Change the date mask to suppress those extra spaces:

SQL> exec PLV.set_datemask ('fmMonth YYYY'); SQL> exec p.l(sysdate); May 1996

Now return the date mask back to the default:

SQL> exec PLV.set_datemask SQL> exec p.l(sysdate); May 17, 1996 13:42:37

The following query uses the datemask function inside SQL to view the date and time of stored information (the PLV package makes this function accessible in SQL by including a RESTRICT_REFERENCES pragma):

SQL> SELECT TO_CHAR (hiredate, PLV.datemask)   2    FROM emp   3   WHERE deptno = 10; TO_CHAR(HIREDATE,PLV.DATEMASK) -------------------------------------------------- November 17, 1981 09:18:44 June 9, 1981 11:11:32 January 23, 1982 17:01:00


6.1 Null Substitution Value6.3 Assertion Routines

Copyright (c) 2000 O'Reilly & Associates. All rights reserved.



Advanced Oracle PL. SQL Programming with Packages
Advanced Oracle Pl/Sql: Programming With Packages (Nutshell Handbook)
ISBN: B00006AVR6
EAN: N/A
Year: 1995
Pages: 195
Authors: Steven Feuerstein, Debby Russell
BUY ON AMAZON

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net