编译SP的时候提示PLS-00103:出现符号错误‘;’语句如下,请大伙指点
create or replace procedure zybp(product in varchar2) is
num number;
begin
select count(1) into num from user_tables where table_name = 'zybp';
if num>0 then
drop table zybp;
end if;
create table zybp as
select fitemno from pmscpartt where fpditemno=product and sysdate between fvaliddte and finvaliddte and fitemno not in
(select fchilditemno from strctm where  sysdate between fstrvaliddte and fstrinvaliddte and
fparentitemno not in(select product from dual
union all
select fpmcode from pmstrctm where fitemno=product
union all
select fchilditemno from strctm a,itemm b where a.fchilditemno=b.fitemno
and b.fitemtyp in ('PH','M') and fparentitemno =product
union all
select fchilditemno from strctm a,itemm b where a.fchilditemno=b.fitemno
and b.fitemtyp in ('PH','M') and fparentitemno in
(select fchilditemno from strctm a,itemm b where a.fchilditemno=b.fitemno
and b.fitemtyp in ('PH','M') and fparentitemno =product)));
end;

解决方案 »

  1.   

    oracle的procedure中不能直接执行ddl语句,比如alter table,drop table;truncate table等。
    需要用
    execute immeidate 'drop table zybp';
    代替你procedure中的语句
    drop table zybp;
      

  2.   

    create的情况类似,你可以选择在procedure之外先行创建table之后insert,或者也用动态sql执行。
      

  3.   


     execute immeidate 'drop table zybp';
      

  4.   

    也可以用dbms_utility.exec_ddl_statement这个函数代替execute immediate