注册

存储过程创建表并插入数据问题

fang 2023/08/25 690 2

为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】:
【操作系统】:
【CPU】:
【问题描述】*:

create or replace procedure atmp ()
as
begin
execute immediate 'drop table if exists test';
execute immediate 'create table test (id int,name varchar(50))';
insert into test values (1,'aa'),(2,'bb');
commit;
end;
创建存储过程,提示无效的对象
image.png
image.png

当手工执行之后
drop table if exists test;
create table test (id int,name varchar(50));
insert into test values (1,'aa'),(2,'bb');
commit;
可以创建成功,但调用时提示定义被修改
image.png
image.png

全部如下这样写可以,但几十个存储过程,一个存储过程有很多这样的
create or replace procedure atmp ()
as
begin
execute immediate 'drop table if exists test';
execute immediate 'create table test (id int,name varchar(50))';
execute immediate 'insert into test values (1,''aa''),(2,''bb'')';
commit;
end;

回答 0
暂无回答
扫一扫
联系客服