declare
ac_num accounts_table.account_id%type:=1;
begin
IF EXISTS (SELECT account_id FROM accounts_table WHERE account_id= ac_num) THEN
dbms_output.put_line('exists');
else
dbms_output.put_line('not exists');
end if;
end;
Getting error like this
ORA-06550: line 4, column 4: PLS-00204: function or pseudo-column 'EXISTS' may be used inside a SQL statement only ORA-06550: line 4, column 1: PL/SQL: Statement ignored 2. ac_num accounts_table.account_id%type:=1; 3. begin 4. IF EXISTS (SELECT account_id FROM accounts_table WHERE account_id= ac_num) >THEN 5. dbms_output.put_line('exists'); 6. else
I need to check 1 in already present in accounts_table
if then print "exist" else "not exist".