5. Embedded SQL for Ada : Ada Variables and Data Types : Embedded SQL/Ada Declarations : Number Declarations
 
Share this page                  
Number Declarations
An Embedded SQL/Ada number declaration has the following syntax:
identifier {, identifier} :
    constant      := initial_value;
Syntax Notes:
You can only use a number declaration for integer numbers. You cannot declare a floating-point number declaration using this format. If you do, Embedded SQL treats it as an integer number declaration, later causing compiler errors. For example, the preprocessor treats the following two number declarations as integer number declarations, even though the second is a float number declaration:
max_employees: constant := 50000;
 min_salary: constant := 13500.0; -- Treated as INTEGER
In order to declare a constant float declaration, you must use the constant variable syntax. For example, you should declare the second declaration above as:
min_salary: constant Float := 13500.0;
                                 -- Treated as FLOAT
The declared numbers cannot be the targets of Ingres assignments.
The preprocessor does not parse the initial_value. Consequently, the preprocessor accepts any initial value, even if it can later cause an Ada compiler error. For example, Embedded SQL accepts both of the following initializations, even though only the first is a legal Ada number declaration:
no_rows: constant := 0;
bad_num: constant := 123 + "456";
You must not use a single quote in an initial value to specify an Ada attribute. Embedded SQL treats it as the beginning of a string literal and generates an error.