NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
D-29
Using DEFINEs From SQLCI
Using DEFINEs From SQLCI
The following rules apply to the use of DEFINEs in SQLCI:
Make sure DEFMODE is set. To inherit DEFINEs from the process that starts
SQLCI, such as TACL or the OSS shell, set DEFMODE ON before you start
SQLCI. To avoid inheriting DEFINEs, set DEFMODE OFF before you start SQLCI,
then set it ON within SQLCI.
DEFINEs that you create during an SQLCI session remain in effect until you alter
them, delete them, or end the SQLCI session. DEFINEs you inherit from another
process and then modify with SQLCI commands revert to their previous attribute
values (that is, the values they had when you started SQLCI) when you end the
SQLCI session. Any changes you make to inherited attributes within the SQLCI
session apply only until you exit SQLCI.
Except for statements compiled with PREPARE, SQLCI resolves DEFINE names in
a statement at the time you enter the statement.
If you use PREPARE to compile an SQLCI statement when a CONTROL QUERY
BIND NAMES AT EXECUTION directive is not in effect, SQLCI resolves
DEFINE names in the statement when you enter the PREPARE, using the DEFINE
values at that time. Subsequent executions of the statement use the PREPARE-time
DEFINE values.
If you use PREPARE to compile an SQLCI statement when a CONTROL QUERY
BIND NAMES AT EXECUTION directive is in effect, SQLCI resolves DEFINE
names in the statement when you execute the statement, using the DEFINE values at
that time. (Note that CONTROL QUERY BIND NAMES AT EXECUTION TIME
must be in effect at PREPARE-time to cause execution-time DEFINE resolution;
whether it is in effect at execution-time makes no difference.)
Using DEFINEs With SQL Programs
The following rules apply to the use of DEFINEs in SQL statements within programs:
DEFINEs required for explicit compilation
You use TACL or OSS shell commands to supply DEFINEs at compilation for
DEFINE names used in preprocessor or host language statements and in the
SQLCOMP or c89 command. For example, if you use DEFINE names in INVOKE
statements for an SQL program that is executable from Guardian, you use TACL
commands to supply corresponding DEFINEs at preprocessor or host language
compilation.
DEFINESETATTR Alters the value of an attribute in the working set, or resets
the attribute
DEFINESETLIKE Sets all attributes of the working set to match those of an
existing DEFINE
DEFINEVALIDATEWORK Checks the working set for consistency and completeness