If condition in Embedded Sql

247 Views Asked by At

Here is a part code form my embedded SQL program

EXEC SQL IF EXISTS(SELECT * FROM table_name WHERE bool_condition)
BEGIN
...
END;

It gives the error

An unexpected token "IF EXISTS(SELECT * FROM table_name " was found following "BEGIN-OF-STATEMENT". Expected tokens may include: "". SQLSTATE=42601

Can anyone tell what is wrong?

1

There are 1 best solutions below

0
On
IF EXISTS(SELECT * FROM table_name WHERE bool_condition)
EXEC SQL
ELSE
' do something