add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table TAB(ID int)
declare
t NUMBER;
w NUMBER;
begin
-- checking if table exists
select count(*) into t from ALL_TABLES where TABLE_NAME='TAB';

-- checking if column does not exist
select count(*) into w
from ALL_TAB_COLUMNS
where TABLE_NAME='TAB' AND COLUMN_NAME = 'COLUMN_1';

if (t>0) AND (w=0) then
EXECUTE IMMEDIATE 'alter table TAB add COLUMN_1 varchar(20)';
end if;
end;
/
1 rows affected
select * from TAB