ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / Managing databases / SQL functions
  • Retrieving the value of a column
  • Transferring the content of the query into a table
  • Retrieving Float items on Oracle (via ODBC)
  • Using tabulations in the items
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Automatically associates each column of the query result with a control or with a variable of the application. After executing the SQLAssociate FUNCTIONfunction, it is necessary to browse the result of the query: fields or variables will then be assigned for each record read.
Note This function must be used for "SQLFirst/SQLCol" type runs. For more details on the different modes to loop through a query result, see Types of SQL browse.
Example
ResExec is boolean 
ResExec = SQLExec("SELECT NOMCLI,ADR1,ADR2,VILLE,CP FROM FACT", "REQ2")
IF ResExec = True THEN
	SQLAssociate("REQ2", NomCli, Adr[1], Adr[2], Ville, CodePostal)
	SQLFirst("REQ2")
ELSE
	// Traite erreur
END
SQLClose("REQ2")
Syntax
SQLAssociate(<Query name> , <List of operators>)
<Query name>: Character string
Name of the query created and executed with SQLExec (the name of the query must be enclosed in quotation marks) or executed with SQLExecWDR (with or without quotation marks).
<List of operators>: Character strings, separated by commas
List of control names or variable names that will be automatically associated with the corresponding columns of the query (up to 250). These operators are separated by commas. The order of these operators must correspond to the order of the query columns.
Remarks

Retrieving the value of a column

The value of a column can be retrieved individually by SQLCol.
HFSQL ClassicHFSQL Client/ServerOLE DBODBCNative Connectors (Native Accesses)

Transferring the content of the query into a table

To transfer the entire content of the query into a table, use SQLTable.
ODBCNative Connectors (Native Accesses)

Retrieving Float items on Oracle (via ODBC)

By default, the decimal separator used for the Float items on Oracle is the dot. However, the ODBC driver returns the value by using the comma as decimal separator. The decimal places are lost when the value is assigned to a numeric control.
To avoid this problem, you must configure the decimal separator for the current connection:
// Connexion à la base de données Oracle 
SQLConnect("MaBaseOracle", "User", "Passe", "", "ODBC") 
// Requête pour changer le séparateur décimal 
SQLExec("ALTER SESSION SET NLS_NUMERIC_CHARACTERS ='. '", "ReqTemp")

Using tabulations in the items

The SQL functions are used to insert tabulations into the items of the data files. The management of tabulations depends on the access mode used.
Case 1: Executing an ODBC query:
When executing a query with ODBC, SQLAssociate does not return tabs. To get the value of the items (with Tabs), use SQLFetch/SQLGetCol.
Example: SQLAssociate and the tabulations in the items
The items of the records to retrieve are as follows:
Item 1Item 2
Record 1JohnSmith
Record 2John + tab + MacDoughnut
For the first record:
  • SQLAssociate(Req1, var1, Var2): recovers John and Smith
For the second record:
  • SQLAssociate(Req1, var1, Var2): retrieves John and Mac, but Mac does not match the value in the second field
  • SQLAssociate(Req1, Var1, Var2, Var3): retrieves John, Mac, Doughnut
Case 2: Executing a query using OLEDB, HFSQL or Native Access
SQLAssociate automatically retrieves the tabs in the result items.
Component: wd300hf.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/28/2025

Send a report | Local help