Hello everyone,
I am trying to write an sql query that drops a table from an oracle DB if it exists , otherwise it doesn't generate any errors.
I tried with this code :
DECLARE
nb number;
BEGIN
SELECT count *
into nb
FROM tables
WHERE table_name = 'my_table';
IF nb = 1 THEN
EXECUTE IMMEDIATE 'DROP TABLE my_table';
END IF;
END;
--DKU_END_STATEMENT
But it does not work. Can anyone help me please with the right syntax that conveys the goal !
Thank you so very much in advance.