in Oracle, try this one.
declare
isThere varchar2(1);
begin
select 'Y' into isThere
from user_tables
where table_name = 'MYTABLE';
if isThere = 'Y' then
truncate table MYTABLE;
else
create table MYTABLE (....);
end if;
end;
it won't work. An error will be generated if more than
one table have the same name under different schemas.
declare
isThere varchar2(1) := 'N';
begin
select 'Y' into isThere
from dual
where exists
(select null from all_tables
where table_name = 'ABC');
if isThere = 'Y' then
dbms_output.put_line('exists');
end if;
exception
when no_data_found then
dbms_output.put_line('not exists');
end;