注册 登录
编程论坛 Oracle论坛

一个存储过程的编译错误,急呀..各位大虾帮忙呀?

yiranmuder 发布于 2010-08-19 18:41, 882 次点击
CREATE OR REPLACE PROCEDURE test(inv_id in NUMBER,storehouse_id in NUMBER,tag in varchar2) AS
   BEGIN
   BEGIN
       IF tag='国家基本药品'
       then  
       DECLARE CURSOR cursorA IS select distinct(a.m_id) from store a,medicine b where a.storehouse_id=storehouse_id and  a.m_id= b.m_id and b.basic_tag='是' and b.special_tag_id='3';
       END IF;
       IF tag ='非国家基本药品'
       then  
       DECLARE CURSOR cursorA IS select distinct(a.m_id) from store a,medicine b where a.storehouse_id=storehouse_id and  a.m_id= b.m_id and b.basic_tag='否' and b.special_tag_id='3';
       END IF;
       IF tag='消耗材料'
       then  
       DECLARE CURSOR cursorA IS select distinct(a.m_id) from store a,medicine b where a.storehouse_id=storehouse_id and  a.m_id= b.m_id  and b.special_tag_id='21';
       END IF;
       IF tag='特殊药品'
       then  
       DECLARE CURSOR cursorA IS select distinct(a.m_id) from store a,medicine b where a.storehouse_id=storehouse_id and  a.m_id= b.m_id  and b.special_tag_id not in('3','21');
       END IF;     
     END;
     END;



错误提示: 第八行pls-001103出现'end'需要在下列情况之一......
1 回复
#2
yiranmuder2010-08-20 08:27
自己先顶一个

可否通过传入参数控制存储过程变量的定义呀?
有什么方法呀?
1