Oracle 创建存储过程报错:无效create命令 5
createtoreplaceprocedureP_lm_km_mzassl_sumnumber(10);begincreatetablelm_km_mz_newasse...
create to replace procedure P_lm_km_mz
as
sl_sum number(10);
begin
create table lm_km_mz_new as select b.mk,a.mz,b.mc,b.sl,b.daohrq,b.qnet_ar,b.stad
from lm_km_mz a, zgdt.vwfmsview@RM.REGRESS.RDBMS.DEV.US.ORACLE.COM b
where b.daohrq=to_char(sysdate-1)
and a.mk=b.mk;
select sum(c.SL) into sl_sum from lm_km_mz_new c;
--drop table lm_km_mz_new;
dbms_output.putline('当前来煤总量为:',||sl_sum);
end P_lm_km_mz; 展开
as
sl_sum number(10);
begin
create table lm_km_mz_new as select b.mk,a.mz,b.mc,b.sl,b.daohrq,b.qnet_ar,b.stad
from lm_km_mz a, zgdt.vwfmsview@RM.REGRESS.RDBMS.DEV.US.ORACLE.COM b
where b.daohrq=to_char(sysdate-1)
and a.mk=b.mk;
select sum(c.SL) into sl_sum from lm_km_mz_new c;
--drop table lm_km_mz_new;
dbms_output.putline('当前来煤总量为:',||sl_sum);
end P_lm_km_mz; 展开
3个回答
展开全部
create to replace procedure P_lm_km_mz 应该是create or replace
更多追问追答
追答
create or replace procedure P_lm_km_mz as
sl_sum number(10);
v_sql varchar2(4000);
begin
v_sql := ' create or procedure table lm_km_mz_new as select b.mk,a.mz,b.mc,b.sl,b.daohrq,b.qnet_ar,b.stad
from lm_km_mz a, zgdt.vwfmsview@RM.REGRESS.RDBMS.DEV.US.ORACLE.COM b
where b.daohrq=to_char(sysdate-1)
and a.mk=b.mk;';
execute immediate v_sql;
v_sql := 'select sum(c.SL) into sl_sum from lm_km_mz_new c';
execute immediate v_sql;
dbms_output.put_line('当前来煤总量为:' || sl_sum);
end P_lm_km_mz;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
or replace啊!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
应该是create or replace吧!另外你的用户有creaet 存储过程的权限吗?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询