![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, There has been many communication on the exists command on newsgroups, web sites... but I could not find anything close to this (below) that it can be possible with MS SQL. I am migrating databases and scripts from SQL to Oracle and I am trying to make things as simple as possible. Is there a simple way with oracle that does the same thing as the script below in SQL? I am testing if the table 'tablename' exists in the schema and if no create it. IF OBJECT_ID('tablename') is null CREATE TABLE tablename ( id int not null, name nvarchar(10) null ) go Thanks in advance for your help |
#3
| |||
| |||
|
|
"Wilfrid" <grille11 (AT) yahoo (DOT) com> a écrit dans le message de news: 49807732$0$10060$426a74cc (AT) news (DOT) free.fr... | IF OBJECT_ID('tablename') is null | CREATE TABLE tablename | ( | id int not null, | name nvarchar(10) null | ) | go | | Thanks in advance for your help | | Check if it is in user_tables |
|
Regards Michel HTH |
#4
| |||
| |||
|
|
Michel Cadot schrieb am 28.01.2009 in 49808224$0$24227$426a7... (AT) news (DOT) free.fr>: "Wilfrid" <grill... (AT) yahoo (DOT) com> a écrit dans le message de news: 49807732$0$10060$426a7... (AT) news (DOT) free.fr... | IF OBJECT_ID('tablename') is null | CREATE TABLE tablename | ( | id int not null, | name nvarchar(10) null | ) | go | | Thanks in advance for your help | | Check if it is in user_tables that means something like select * * * * count(*) COUNT_OF_TABLES from * * * * user_tables UT * * * * --ALL_TABLES A where * * * * UT.TABLE_NAME=&MyTable * * * * --A.TABLE_NAME=&MyTable * * * * --and * * * * --A.OWNER=&MySchema COUNT_OF_TABLES is 0 or 1 I do not know whether you want to do it manually, by any script language or if you want to write a GUI for that, but if you use one of that * queries you will find out what you want. also try out SELECT * FROM DICTIONARY WHERE upper(COMMENTS) like '%TABLE%' to find out more Regards Michel HTH Andreas -- wenn email, dann AndreasMosmann <bei> web <punkt> de |
#5
| |||
| |||
|
|
Hello, There has been many communication on the exists command on newsgroups, web sites... but I could not find anything close to this (below) that it can be possible with MS SQL. I am migrating databases and scripts from SQL to Oracle and I am trying to make things as simple as possible. Is there a simple way with oracle that does the same thing as the script below in SQL? I am testing if the table 'tablename' exists in the schema and if no create it. IF OBJECT_ID('tablename') is null CREATE TABLE tablename ( id int not null, name nvarchar(10) null ) go Thanks in advance for your help |
![]() |
| Thread Tools | |
| Display Modes | |
| |