Why output structure type is required for sql when delete or update query fetched?



As I have used SQL query to run for Delete or Update.

There is no need to any output result for this. But outsystem shows that structure must be set.


Can anyone let me know what would be output structure or how it is required in case of delete or update? 

Hi Manish,

You are right there is no need of output parameter in case of DELETE. But in Outsystems SQL queries always have 2 output params, even query don't return any result. Please refer this : https://success.outsystems.com/Documentation/11/Developing_an_Application/Use_Data/Query_Data/SQL_Queries

So if your query in not returning any result in above case you can define a entity/structure of same type, like in your case entity is Customer.

Thanks.

vikas sharma wrote:

Hi Manish,

You are right there is no need of output parameter in case of DELETE. But in Outsystems SQL queries always have 2 output params, even query don't return any result. Please refer this : https://success.outsystems.com/Documentation/11/Developing_an_Application/Use_Data/Query_Data/SQL_Queries

So if your query in not returning any result in above case you can define a entity/structure of same type, like in your case entity is Customer.

Thanks.


For the Update and Delete query I am not able to set the second output which is SQL1.Count in the below diagram.

It shows the error that only select statement can use Count as a output parameter.

What do you say about that..




Hi Manish,

Update/ delete command do not return any value but for advance query you can create your own structure having single attribute of boolean type or Integer type that it and you can use it in any update/delete advance sql.

Regards,

Manish Jawla

Hi Manish,

In your case its not showing error, it will show only warning message. Because as on given link mentioned that irrespective of query type in Outsystems always return list and count. But as for Update or Delete there will not be any list in actual so its only showing warning not an error. 

Also, in case of Delete & Update, when you know that there is nothing in count then why you trying to assign those values.

Please check below screen shot there is not any error. As mentioned on above given link "Output Structure is needed even if your SQL statement does not return any results." so its giving warning only that there is not any select statement in query so there will be no list and no count so run time error may occur. But it requires because Outsystems  enforce to have output structure. Hopefully its clear to you now.


Output parameter

SQL in OutSystems queries always have two output parameters, even when the query executed does not return a result:

  • List: The list with the result returned by the query. The list is empty if there are no results.
  • Count: The number of records returned by the query without considering the SQL Max Records property.

Output Structure is mandatory. You need to define the structure (data types of the columns) that your query returns. 

To more info, see this document.

Cheers,