32
Views
7
Comments
How to check SQL syntax
Question

Are there any way to check SQL syntax before passing the SQL command to input of SQL element

2024-12-18 16-06-42
Junaid Syed

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:

  1. 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.

  2. There is one or more output entities/structures that will match the attributes on the SELECT statement.

  3. Click TEST.


Hope it helps!

Junaid


UserImage.jpg
Trinh Trung

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.

2024-12-18 16-06-42
Junaid Syed

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/

Junaid

2020-11-25 10-45-32
Mostafa Othman
Champion

Hello Trinh,

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:

https://success.outsystems.com/documentation/best_practices/development/building_dynamic_sql_statements_the_right_way/

UserImage.jpg
Trinh Trung

Hi Mostafa !

It is whole sql query will be changed based on user input 


2020-11-25 10-45-32
Mostafa Othman
Champion

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.

2025-01-09 14-56-57
IQ78

https://www.outsystems.com/forge/component-overview/5900/sql-sandbox-o11

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.