VMS Help  —  SQLPRE72  Host Language Variable Declarations
    The SQL precompiler recognizes only a subset of valid host
    language variable declarations. If you refer to a variable
    declaration that SQL does not recognize in an embedded SQL
    statement, the precompiler generates a fatal error when it
    encounters that reference.

    Oracle Rdb databases and the various host languages supported
    by the SQL precompiler do not necessarily support the same set
    of data types. The precompiler recognizes host language variable
    declarations that are equivalent to SQL data types plus a subset
    of other host language variable declarations.

    o  For host language variable declarations of data types that are
       equivalent to SQL data types, the precompiler passes values
       directly between the database and the host language variable.

    o  Host language floating point data types will be interpreted as
       having representations as determined by the /FLOAT qualifier
       on the precompiler command line and individual language
       rules. These rules are discussed in the host language-specific
       sections that follow. In these sections, selects will be shown
       from a table defined as follows:

       CREATE TABLE TESTTBL (
           KEYFIELD CHAR(10) PRIMARY KEY,
           FLOAT1   REAL,
           FLOAT2   DOUBLE PRECISION);

    o  For each host language, the precompiler also supports a
       limited number of host language variable declarations that
       do not correspond to SQL data types. SQL converts database
       values to the host language data type and host language values
       to the supported data type. SQL makes this conversion only for
       a subset of valid host language declarations.

       The following table shows the date-time data types that the
       precompiler supplies.

    Table 6 Precompiler Date-Time Data Mapping

    Module Language
    and Interactive
    SQL                Precompiler

    DATE               SQL_DATE
    DATE_ANSI          SQL_DATE_ANSI
    DATE_VMS           SQL_DATE_VMS
    TIME               SQL_TIME
    TIMESTAMP          SQL_TIMESTAMP
    INTERVAL YEAR      SQL_INTERVAL (YEAR)
    INTERVAL YEAR TO   SQL_INTERVAL (YEAR TO MONTH)
    MONTH
    INTERVAL MONTH     SQL_INTERVAL (MONTH)
    INTERVAL DAY       SQL_INTERVAL (DAY)
    INTERVAL DAY TO    SQL_INTERVAL (DAY TO HOUR)
    HOUR
    INTERVAL DAY TO    SQL_INTERVAL (DAY TO MINUTE)
    MINUTE
    INTERVAL DAY TO    SQL_INTERVAL (DAY TO SECOND)
    SECOND
    INTERVAL HOUR      SQL_INTERVAL (HOUR)
    INTERVAL HOUR TO   SQL_INTERVAL (HOUR TO MINUTE)
    MINUTE
    INTERVAL HOUR TO   SQL_INTERVAL (HOUR TO SECOND)
    SECOND
    INTERVAL MINUTE    SQL_INTERVAL (MINUTE)
    INTERVAL MINUTE    SQL_INTERVAL (MINUTE TO SECOND)
    TO SECOND
    INTERVAL SECOND    SQL_INTERVAL (SECOND)

    o  For all other host language variable declarations, the
       precompiler generates an error when it encounters a reference
       to them in embedded SQL statements.

                                   NOTE

       The ANSI/ISO SQL standard specifies that variables used
       in embedded SQL statements must be declared within a
       pair of embedded SQL BEGIN DECLARE . . . END DECLARE
       statements. The Oracle Rdb SQL precompiler does not enforce
       this restriction. If you use the BEGIN DECLARE . . . END
       DECLARE statements, SQL generates a warning message when
       it encounters a variable declared outside of a BEGIN
       DECLARE . . . END DECLARE block.

       If ANSI/ISO SQL compliance is important for your
       application, you should include all declarations for
       variables used in embedded SQL statements within a BEGIN
       DECLARE . . . END DECLARE block. See the Oracle Rdb SQL
       Reference Manual on the SQL module language for more
       information on the BEGIN DECLARE statement.

    If you do not declare character variables using syntax that
    specifies a character set or by defining the RDB$CHARACTER_SET
    logical name, the SQL precompiler uses the UNSPECIFIED character
    set. When you use the UNSPECIFIED character set, the precompiler
    does not check to see if the character set of the variables
    matches the character sets of the database. For more information
    regarding the logical name, see the Oracle Rdb SQL Reference
    Manual.

    The RDB$CHARACTER_SET logical name is deprecated and will not be
    supported in a future release.
Additional Information: explode extract
Character Parameters Ada Variables C Variables COBOL Variables FORTRAN Variables Pascal Variables PLI Variables
Close Help