Example 1: Using the NAMED MARKERS feature
This example shows that enabling the NAMED MARKERS feature will
allow SQL to promp tfor one value and the displayed Rdb strategy
shows that only one variable is used.
-> SET SQLDA 'ENABLE NAMED MARKERS';
-> SELECT LAST_NAME FROM EMPLOYEES WHERE FIRST_NAME = :F_NAME AND LAST_NAME <>
:F_NAME;
in: [0] typ=449 len=46
out: [0] typ=453 len=14
[SQLDA - reading 1 fields]
-> Alvin
Tables:
0 = EMPLOYEES
Conjunct: (0.FIRST_NAME = <var0>) AND (0.LAST_NAME <> <var0>)
Get Retrieval sequentially of relation 0:EMPLOYEES
0/FIRST_NAME/Varchar(42/46): Alvin
[SQLDA - displaying 1 fields]
0/LAST_NAME: Toliver
[SQLDA - displaying 1 fields]
0/LAST_NAME: Dement
Example 2: Using the PADDING feature
The following example shows that the derived type for the named
parameter MI is a SQLDA_CHAR (453) of length 1. The input data
('AA') is truncated on assignment and the incorrect results are
returned. By adding a small padding the type is changed to SQLDA_
VARCHAR (449) of length 3 and a correct comparison is performed.
-> ATTACH 'filename sql$database';
-> SET SQLDA 'enable named markers, nopadding';
-> SELECT LAST_NAME FROM EMPLOYEES WHERE MIDDLE_INITIAL = :MI;
in: [0] typ=453 len=1
out: [0] typ=449 len=18
[SQLDA - reading 1 fields]
-> AA
[SQLDA - displaying 1 fields]
0/LAST_NAME: Toliver
[SQLDA - displaying 1 fields]
0/LAST_NAME: Lengyel
[SQLDA - displaying 1 fields]
0/LAST_NAME: Robinson
[SQLDA - displaying 1 fields]
0/LAST_NAME: Ames
-> SET SQLDA 'padding 2 characters';
-> SELECT LAST_NAME FROM EMPLOYEES WHERE MIDDLE_INITIAL = :MI;
in: [0] typ=449 len=7
out: [0] typ=449 len=18
[SQLDA - reading 1 fields]
-> AA
-> EXIT;
Enter statement:
Note that the VARCHAR requires an extra 4 bytes for the length
information in the SQLDA2 used by the Dynamic SQL testing
program.