Initializing help system before first use

# SQLdataframe

Purpose
Retrieve a dataframe of an SQL query.
Synopsis
`procedure SQLdataframe(query: string|text, dfrm: array(R:range, C:set of string))`
Arguments

query | SQL query
dfrm | An array to receive the dataframe

Example
The example shows how to populate an array of type any from a join of two tables.

    declarations
      DFT:array(RT:range,CST:set of string) of text
      DFA:array(RA:range,CSA:set of string) of any
    end-declarations
    SQLdataframe("select * from mytesttable", DFT)
    writeln("Field indices: ", CST)

    SQLdataframe("select * from mytesttable inner join anothertable " +
                 "on id=customer", DFA)
    writeln("Field indices: ", CSA)
    writeln("Number of data records (rows): ", RA.size)

Further information
1. This procedure retrieves the dataframe associated to an SQL query: lines of the result set are numbered starting from 1 (index set R) and columns (index set C) are named after the corresponding column names of the result set (if a column has no name a unique identifier is generated by the routine), the type of the output array is expected to be compatible with the columns of the result set.
2. The routine supports union types (like any), this will be the preferred approach when getting the dataframe from a query for which no type information is available. Otherwise the data received from the database is cast to the type of the provided array (this may lead to invalid data for instance if the database returns some textual information while the array if of a numerical type).
Related topics
SQLexecute
Parent Topic Procedures and functions

© 2001-2026 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.