f$SQLReadTable (f$SQLLiesTabelle)
f$SQLReadTable (f$SQLLiesTabelle)
With this function, as many data records as desired are read into an indexed parameter group. The name of the parameter group must be entered without an index. If the parameter group is not indexed, only one data record is read. If the columns in the table and the parameters in the parameter group are not the same, only the parameters for which there is a column of the same name are filled. Zero values in the database result in the parameter being set to NOVAL. Data records are read until they cannot be found anymore or until the maximum index for the parameter group is reached.
You specify the data records to be read via a parameter group with search targets (SearchPG). This parameter group must be defined with the type name for the parameter group that describes the database table. The values in this parameter group are used as a search target (with "equal"). A parameter in NOVAL state does not activate a restriction of the search. Searching with placeholders ("wildcards") is not possible here. If this parameter group is Noval, all data records are read.
The results of the search can be sorted by entering sorting criteria.
Note: since it takes time to make the connection, a new connection should not be established for every SQL function.
Syntax: | Status = f$SQLReadTable (Channel,'Table',SearchPG ,'Order' , DstPG , 'NameCount' , Mode ) | ||
| Argument | Type | Meaning |
| Channel | Integer | Channel number for the SQL connection |
| Table | String | Name of the table or view from which data is to be read |
| SearchPG | String | Name of the parameter group containing the search criteria. If all data records are to be read, an empty string (") can also be used. |
| Order | String | Entry for columns according to which the results are sorted. If a non-existent name is used, no data is read. If the results are not to be sorted, an empty string (") can be entered. |
| DstPG | String | The name of the indexed parameter group to be filled. |
| NameCount | String | The name of the parameter to which the count of data records read is written. |
| Mode | Integer | Managing parameter group changes: 0 : no action Note: the adjustment/definition of the parameter groups only occurs in the current function execution. The definition of the parameter group is not changed in the development system. 10 : the first index in the PG after the count of data records read is set to UNDEF. 11 - like 1 + the first index in the PG after the count of data records read is set to UNDEF. 12 - like 2 + the first index in the PG after the count of data records read is set to UNDEF. |
Result: | Integer | Error status: 0 :command was resolved correctly -1 :no data record found -2 :even more data records found -3 :the parameter group was not found -9999: the SQL command was not successful. In this case, the error status and error description can be calculated using: f$SQLError. | |
Example: | p$TDV:SMPAPI:Check_ODBC() f$PGNoVal( 'Address_s' ) Status = f$SQLReadTable (Handle, 'V_Address', 'Address_s' , 'Company1', 'Address_I', 'Number', 10) | ||