home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

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


Previous: 6.1 Null Substitution Value Advanced Oracle PL/SQL Programming with Packages Next: 6.3 Assertion Routines
6.1 Null Substitution Value Book Index 6.3 Assertion Routines

The Oracle Library Navigation

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

Library Home Oracle PL/SQL Programming, 2nd. Ed. Guide to Oracle 8i Features Oracle Built-in Packages Advanced PL/SQL Programming with Packages Oracle Web Applications Oracle PL/SQL Language Pocket Reference Oracle PL/SQL Built-ins Pocket Reference










??????????????@Mail.ru