| GNADE User's Guide: GNADE, The GNat Ada Database Environment; Version 1.5.0; Document Revision $Revision: 1.42 $ | ||
|---|---|---|
| Prev | Appendix A. Frequently asked questions | Next |
I like to use strings in the WHERE clause of a query, but nothing seems to work.
In such a situation a length indicator is needed. This is done by adding the INDICATOR keyword as shown below.
Example A-1. Using a string in the WHERE clause
EXEC SQL BEGIN DECLARE SECTION END-EXEC
firstname : CHAR(1..80);
..
EXEC SQL END DECLARE SECTION END-EXEC
move( name, firstname );
namelength := INDICATOR_TYPE(name'Legnth);
SELECT
number,
...............
contact_postcode, contact_country
INTO
:stu_number,
...............
:stu_contact_postcode, :stu_contact_country
FROM STUDENT
WHERE name_first = :firstname INDICATOR :namelength
Since GNADE version 1.1.9 the data type VARCHAR has been introduced which already includes the length indicator.