Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

If statement inside SQL Statement Info Editor

Level 1
Level 1

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     .



2 Replies

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 :



Level 5
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.