declare i number;
begin
select count(*) into i from user_tables where table_name = 'LOGINUSER'; //判断是否存在table,类似于SQL,详见我的SQLSERVER模块
if i = 0 then
execute immediate 'Create Table LOGINUSER(Id number,
UserName nvarchar2(255),
Password varchar2(255),
Role number)
';
end if;
end;
/
declare i number;
begin
select count(*) into i from all_sequences where SEQUENCE_NAME = 'LOGINUSERID_SEQ'; //类似与定义SQL中的 ID int identify(1,1);
if i = 0 then
execute immediate 'create sequence LOGINUSERID_SEQ
minvalue 1
maxvalue 999999999999999999999999999
start with 1
increment by 1
nocache
';
end if;
end;
/