Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

If statement inside SQL Statement Info Editor

Avatar

Former Community Member

Hi There,

I'm trying to make a conditional insert statement in the process designer using "SQL Statement Info Editor". And I'm getting "Invalid SQL statement".

Is there any alternative to implement this or is it just a syntax error to what I'm doing?

This is just an example of the issue, if I remove the if statement it will work.

SQL Statment Info Editor.jpg     .

Thanks,

Ali.

2 Replies

Avatar

Employee Advisor

To the best of my knowledge, the IF statement can be used in Stored Procedures Language and then called by JDBC but not directly as above. Here is one workaround but vendor specific : http://www.itjungle.com/fhg/fhg071608-story02.html

Thanks,

Wasil

Avatar

Level 5

If the conditional SQL is critical to your logic, vs. splitting the SQL into 2 activities/calls,

Then you may want to look at using Java inside an ExecuteScript activity.

You usually have more flexibility using a prepareStatement, but you need to be sure to trap and handle and errors.

Mark