KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Nested Begin/End SQL not allowed Error
PRODUCT: 4D | VERSION: 15.x | PLATFORM: Mac & Win
Published On: November 14, 2017

4D allows SQL calls to be made in in standard SQL format inside Begin SQL and End SQL calls. However, in certain situations, coding may attempt to initialize and run another Begin SQL and End SQL call and this is not allowed.

Possible causes of this issue are if a Begin/End SQL stament causes a Table Trigger to run code that also contains a Begin/End SQL stament and another possible cause is if a 4D Project Method being used as a function in the Begin/End SQL statement contains a Begin/End SQL statment.

For Example:

//Method Name: SQLMethod
Begin SQL
    SELECT *
    FROM Table_1

End SQL

//Method Name: TestMethod
ARRAY LONGINT(array_al;0)
Begin SQL
    SELECT ID,{fn SQLMethod() AS Varchar}
    FROM Table_1
    Into :array_al;

End SQL

will generate the following error: