改成这样了i integer;select count(*) into i from user_tables where table_name='T3';
if i=0 then execute immediate 'CREATE TABLE T3(ID NUMBER NOT NULL, PRICE NUMBER NOT NULL)'; end if;但会说Error on line 2 select count(*) into i from user_tables where table_name='T3'ORA-00905: 缺少关键字
加分再问,不在存储过程里如何实现这样的功能?select count(*) into i from user_tables where table_name='T3'
declare i integer; begin select count(*) into i from user_tables where table_name='T3';
if i=0 then execute immediate 'CREATE TABLE T3(ID NUMBER NOT NULL, PRICE NUMBER NOT NULL)'; end if; end; /
if i=0 then
execute immediate 'CREATE TABLE T3(ID NUMBER NOT NULL, PRICE NUMBER NOT NULL)';
end if;但会说Error on line 2
select count(*) into i from user_tables where table_name='T3'ORA-00905: 缺少关键字
i integer;
begin
select count(*) into i from user_tables where table_name='T3';
if i=0 then
execute immediate 'CREATE TABLE T3(ID NUMBER NOT NULL, PRICE NUMBER NOT NULL)';
end if;
end;
/
declare
......
begin
......
end;