帮我检查一下这个存储过程建表语句的错误 declare num number; begin select COUNT(1) into num from ALL_TABLES where TABLE_NAME = upper('PI_STAFF_BUSI') ; if num=0 then execute immediate 'create table PI_STAFF_BUSI (PI_ID varchar(200) null, PI_NAME varchar(200) null, OP_ID NUMBER(12) null, ORG_ID NUMBER(12) null, REGION_ID varchar(6) null, PI_TYPE NUMBER(12) null, FINISH_VALUE NUMBER(12) null, CREATE_DATE date null, SYNC_DATE date null, EXT_A varchar(4000) null, EXT_B varchar(4000) null, EXT_C varchar(4000) null); ' ; end if; end;
时间: 2024-03-27 16:41:19 浏览: 54
sql.rar_exec select_select_sql select from exec_普通sql大全
这个存储过程建表语句的错误在于在if语句块中,execute immediate语句的末尾缺少分号。应该在语句的最后添加一个分号,如下所示:
```
declare
num number;
begin
select COUNT(1) into num from ALL_TABLES where TABLE_NAME = upper('PI_STAFF_BUSI');
if num = 0 then
execute immediate 'create table PI_STAFF_BUSI (
PI_ID varchar(200) null,
PI_NAME varchar(200) null,
OP_ID NUMBER(12) null,
ORG_ID NUMBER(12) null,
REGION_ID varchar(6) null,
PI_TYPE NUMBER(12) null,
FINISH_VALUE NUMBER(12) null,
CREATE_DATE date null,
SYNC_DATE date null,
EXT_A varchar(4000) null,
EXT_B varchar(4000) null,
EXT_C varchar(4000) null
)';
end if;
end;
```
修改后,存储过程就可以成功执行了。
阅读全文