Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> IF in PL/SQL-Block
Hi all,
I have a simple problem but can't get it fixed.
I want to execute an DELETE-statement only if a certain table (order)
exists.
The following PL/SQL-Block in an .sql-file runs always into the IF
-body.
What is wrong with it?
DECLARE
amount NUMBER;
BEGIN
amount := 0; -- only database, which includes the table 'order' SELECT count(*) INTO amount FROM all_tables WHERE lower(table_name) = 'order'; IF amount = 1 THEN DELETE FROM order WHERE delivered = 0; COMMIT; END IF;
Carsten Received on Tue Dec 27 2005 - 06:41:18 CST
![]() |
![]() |