I have an If Statement block similar to the below which is failing with the error –
PLS-00103: Encountered the symbol "SELECT" when expecting one of the following….
Begin If (select count(*) from Table1) > 0 then dbms_output.put_line('Test'); end if; end;
I have similar Case statement which works fine
select case when (select count(*) from Table1) > 0 then 2 else 1 end from dual
From what i have read in Oracle Documentation the if and when support a Boolean Expression, any ideas whether Subqueries are supported in If Conditions.
Note: The Statements have been simplified, i am not really going to get the count of the entire table, so no optimization suggestions please