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 ...

Get Advanced Oracle PL/SQL Programming with Packages now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.