Are there any way to check SQL syntax before passing the SQL command to input of SQL element
Hello Trinh,
You can test your SQL as described below
You can test your work by clicking the TEST button located at the bottom of the SQL editor. To test it successfully make sure that:
If you have Query Parameters you should first assign a test value in the Test Inputs tab.
Note: If no values are assigned, the query will be tested with empty values.
There is one or more output entities/structures that will match the attributes on the SELECT statement.
Click TEST.
Hope it helps!
Junaid
Hi Junaid,
Thank for your helping
But my scenarios is that Input of SQL tool is SQL command and the SQL command can be changed any time when the program is running. The aim is to check the SQL command syntax while programing is running before pass the changeable SQL command to SQL widget.
Well I am not sure about your use case, I think there is no built in option to check the syntax if command is dynamic in nature. However, if you are accepting the command from end users or any other external source then it might make your application vulnerable to SQL Injection threat. Please refer below document for dynamic SQL
https://success.outsystems.com/documentation/best_practices/development/building_dynamic_sql_statements_the_right_way/
Is the whole sql query will be changed based on user input or its just condition into where clause or order by clause?
You can also check below link for building dynamic query:
Hi Mostafa !
It is whole sql query will be changed based on user input
One of good solutions in this case to create several Advanced SQL Query widget for each case each one has input parameter if needed and this parameter can be changed based on user input.
You can use switch or if condition to redirect execution of your application to required query.
https://www.outsystems.com/forge/component-overview/5900/sql-sandbox-o11