简单的ORACLE 存储过程 哪里错了?
建立这个存储过程的目的是: 根据变量建立试图 (这个是错的改怎么改)
create or replace procedure tuxing(v_type1 varchar2)
as
begin
drop view tb1;
create view tb1
as
(
select case v_type1 when '集团' then obj01 else obj02 end ABC
, sum(obj04), sum(obj06) from table1 group by obj01)
end
tuxing ;
----------------------
还有就是我想用语句运行该过程 是 写代码 exec tuxing(集团) 吗?
------解决方案--------------------首先给用系统用户自己授权
grant drop any view,create any view to <用户>;
其次ddl必须用动态方式执行
begin
execute immediate 'drop view xxxx';
execute immediate 'create view xxxx as select case dummy when dummy then dummy else dummy end d from dual';
end;