Using Multiple SQL Statements in an SQL Action

Multiple SQLs in SQL ActionWhile writing App Engines, we normally write one SQL statement per SQL Action. That is how it is in most of the delivered App Engine. But in certain situations, we may need to put in multiple SQL statements into a single SQL Action.

This can be achieved by using %Execute function.

In your SQL Action, place the %Execute() on the very first line. Below that you start writing your SQL statements one by one. Take care to delimit each SQL statement with a semi colon as the App Engine expects a semi colon between statements within an %Execute function by default.

If you are look to in write a PL/SQL block then you should change the default delimiter from semi colon to a forward slash. This can be done by placing a forward slash like this – %Execute(/)

The sample code below would make things clear.

%Execute(); 
 SQL Statement One;
 SQL Statement Two;
 SQL Statement Last;
 
%Execute(/) 
 SQL Statement One/ 
 SQL Statement Two/
 SQL Statement Last/
Tags: ,
Subscribe to Comments RSS Feed in this post
5 Responses
  1. GOOD ONE

      • helpful

        • @Satyajith – Glad that you found it helpful.

          • I tried the code above, but it doesn’t seem to work if the sql statements are exec commands. Is there anyway to use multiple exec commands in a single sql action?

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*