The SQL Statement |
Top Previous Next |
For exports, an SQL SELECTstatement specifies the data you want to extract from the database and pass to the file. For imports, you can use an INSERT, UPDATE, UPDATE OR INSERT statement to specify the write to the database, or you can call a parameterised executable procedure with EXECUTE PROCEDURE in order to perform the desired DML completely at the server side. For an export, your SELECT can be a call to a selectable procedure that returns the desired data to dbFile. It must be a stored procedure that has been written with a SUSPEND command designed to return one set, being the set that is specified for the output file. Do not try to call an executable procedure using SELECT. Statements for Input For input statements, the standard SQL syntax for specifying unnamed replaceable parameters with a comma-separated list of questionmarks is used. The dbFile parser treats the set of parameters as a group of variables that, by default, are in the same order in the input file. For example, the following statement might be used to load data from a three-field input record in a delimited file into a table called STATES with columns COUNTRY_CD, STATE_CD and STATE_NAME: insert into states ( country_cd, state_cd, state_name ) values (?,?,?) NOTE that statement terminators-such as ISQL's default semicolon-and the ISQL SET TERM statement are not valid in the dbFile environment. dbFile Embedded Field Descriptors dbFile implements some additional syntactic elements that are enclosed in curly braces and embedded into the SQL statement, following the identifier of the column to which the descriptor applies. Multiple attributes for a field are comma-separated. The following example is an element describing some attributes of one incoming field: {position=10, size=2} Such elements, which are required for processing fixed format record input and optional for delimited record input, are stripped out before the DSQL request is submitted to the Firebird engine. The following simple example illustrates the usage of a qualifier element for the same import specified by the previous example: insert into states ( country_cd {position=10, size=2}, state_cd {position=8, size=2}, state_name {position=71, size=35} ) values (?,?,?) NOTE Supported Qualifiers The following table lists the qualifiers that are available when constructing embedded field descriptors in your SQL statements.
|