kylinsoong 发表于 2013-1-29 15:26:54

Oracle

Usually we need to check the table is exist or not before create a new table, In Mysql database, that's very easy, 'cause mysql default sql statement support exist check, But in Oracle it's quite complicated. the following is a solution to validate the table is existable before create it in Oracle Platform:
Assuming APPVersion table already exist in database through the following sql statement:
create table AppVersion (NAME varchar2(30) primary key not null,VERSION varchar2(30) not null,INSTALLED DATE not null);The Following PL/SQL can implement exist validation before create  table APPVersion duplicated:
DECLAREBEGIN   EXECUTE IMMEDIATE 'DROP TABLE APPVERSION';EXCEPTION WHEN OTHERS THEN NULL;COMMIT;END;/ 
页: [1]
查看完整版本: Oracle