DirectSQL Example

Not all operations on ODBC databases can be done using the read from table and write to table statements. More flexibility is offered using the intrinsic procedure DirectSQL.

The following small example illustrates an alternative for Write to Table ... in insert mode:

1Procedure pr_fillTable {
2    Body: {
3        for ( i_a, i_d ) do
4            DirectSql( sp_datasource,
5                formatString("INSERT INTO AD (a,d,p,s,e) values ('%e','%e',%i,'%s','%e')",
6                    i_a, i_d, p_data(i_a,i_d), sp_data(i_a, i_d), ep_data(i_a, i_d) ) );
7        endfor ;
8    }


  • line 4: Call to DirectSQL using an existing ODBC connection.

  • line 5: A SQL INSERT statement following the SQL syntax . AD is the name of a table here.

  • line 6: To pass numeric data (p_data), string data (sp_data), and element data (ep_data), just fill in the data using FormatString().