Formatting Variables

You can control the case, length, quoting, and other aspects of the format of values resolved from variables

The variable formatting options are the following:

Option

Description

.L

Lower-case characters

.U

Upper-case characters

.F

Combined with L or U, applies conversion to first character

.q

Enclose the variable between single quotes if it is not already.

.Q

Enclose the variable between double quotes if it is not already.

.T

Removes blank spaces

.H

Converts number to hexadecimal

.c

Upper-case first letter and lower-case next letters

.n

Maximum length where n is the number of characters

nJ

Justifies to fixed length where n is the number of characters

-nJ

Right justify variable text to fixed length where n is the number of characters

width

Copies the specified minimum number of characters to the output buffer

.[-]precision

Copies the specified maximum number of characters to the output buffer

M

Extracts a portion of the variable name, this option uses the width and precision parameters to identify the portion to extract

You embed formatting options in variable syntax as follows:

%[[?][-][width][.[-]precision][c][H][F][U|L][T][M][q][Q]:]<varname>%

For example:

%.L:TABLE%

The table below shows formatted variables and their results in a script for the table EMPLOYEE.

Template statement with variable

Resulting script statement

create trigger %TABLE%

create trigger EMPLOYEE

create trigger %.L:TABLE%

create trigger employee

create trigger %.U:TABLE%

create trigger EMPLOYEE

create trigger %.4:TABLE%

create trigger EMPL

create trigger %.4L:TABLE%

create trigger empl