Skip to main content

#sqlcompile select

Specifies the data format mode for any subsequent Embedded SQL statements.

Description

This macro preprocessor directive specifies the data format mode for any subsequent Embedded SQL statements. It has the form:

#sqlcompile select=value

where value is one of the following:

  • Display — Formats data for screen and print.

  • Logical — Leaves data in its in-memory format.

  • ODBC — Formats data for presentation via ODBC or JDBC.

  • Runtime — Supports automatic conversion of input data values from a display format (DISPLAY or ODBC) to logical storage format based on the execution-time select mode value. The output values are converted to the current mode.

    For information on getting and setting the execution-time select mode, see SelectMode.

  • Text — Synonym for Display.

  • FDBMS — Allows Embedded SQL to format data the same as FDBMS.

The value of this macro determines the Embedded SQL output data format for SELECT output host variables, and the required input data format for Embedded SQL INSERT, UPDATE, and SELECT input host variables. For details, refer to The Macro Preprocessor.

The following Embedded SQL examples use the different compile modes to return three fields from the Sample.Person table, which are Name (a string field), DOB (a date field), and Home (a list field):

#SQLCOMPILE SELECT=Logical
  &sql(SELECT Name,DOB,Home
       INTO :n,:d,:h
       FROM Sample.Person)
  WRITE "name is: ",n,!
  WRITE "birthdate is: ",d,!
  WRITE "home is: ",h
#SQLCOMPILE SELECT=Display
  &sql(SELECT Name,DOB,Home
       INTO :n,:d,:h
       FROM Sample.Person)
  WRITE "name is: ",n,!
  WRITE "birthdate is: ",d,!
  WRITE "home is: ",h
#SQLCOMPILE SELECT=ODBC
  &sql(SELECT Name,DOB,Home
       INTO :n,:d,:h
       FROM Sample.Person)
  WRITE "name is: ",n,!
  WRITE "birthdate is: ",d,!
  WRITE "home is: ",h
#SQLCOMPILE SELECT=Runtime
  &sql(SELECT Name,DOB,Home
       INTO :n,:d,:h
       FROM Sample.Person)
  WRITE "name is: ",n,!
  WRITE "birthdate is: ",d,!
  WRITE "home is: ",h
FeedbackOpens in a new tab