CREATE TABLE if it doesn't already exist
518780Mar 12 2007 — edited Mar 12 2007Hi everyone,
I have recently started to work with Oracle and PL/SQL.
I find this a little difficult as I was used to SQL Server before.
In SQL Server you can write a script like this:
if exists(select * from sysobjects where type = 'U' and name = 'test_table')
drop table test_table
go
/*
** type U is for a user table.
*/
create table test_table(...)
go
This script obviously checks if "test_table" exists, drops it if it does exist, and then re-creates it.
How do I re-write this code in PL/SQL?
I'm sure it's easy, but I can't see it.
Many thanks.
Ovidiu