菜鸟求助,写了一个存储过程,报错提示:pls:object is invailid ;pl/sqlstatement ignored

qq_16852171 2014-06-26 03:15:36

--创建存储过程
create or replace procedure test1
as
begin
insert into lj_串号变更
(稽核人,
受理人,
用户名称,
号码,
号码状态,
号码受理时间,
串号,
机型,
号码录入状态,
录入时间,
录入订单号,
gxdate)
(select b.jhr 稽核人,b.bm 部门,b.empee_name 受理人,c.prod_inst_name 用户名称,c.acc_nbr 号码,c.prod_inst_id,c.status_cd 号码状态,c.create_date 号码受理时间,
a.res_inst_nbr 串号,d.mkt_res_name 机型,to_char(a.res_prd_inst_stas,'9999') 号码录入状态,a.mod_date 录入时间,a.order_id 录入订单号,to_char(sysdate, 'yyyymmdd')
from crm1.tb_prd_res_prd_inst_551@ldc2ch a,
LW_LJ_EMPEE b,
crm20_ins1.prod_inst_551@ldc2ch c,
crmshare1.tb_mkt_res@ldc2ch d,
crm20_ins1.customer_order_551@ldc2ch e
where e.staff_id=b.empee_id
and a.obj_inst_id=c.prod_inst_id(+)
and a.order_id=e.cust_order_id
and a.res_id=d.mkt_res_id
and TRUNC(a.mod_date)=TRUNC(sysdate-1)
union
select b.jhr 稽核人,b.bm 部门,b.empee_name 受理人,c.prod_inst_name 用户名称,c.acc_nbr 号码,c.prod_inst_id,c.status_cd 号码状态,c.create_date 号码受理时间,
a.term_key 串号,d.mkt_res_name 机型,a.state 号码录入状态,a.mod_date 录入时间,a.acpt_order 录入订单号,to_char(sysdate, 'yyyymmdd')
from CRM_CSP2.TB_MKT_INT_TERMINAL@ldc2ch a,
LW_LJ_EMPEE b,
crm20_ins1.prod_inst_551@ldc2ch c,
crmshare1.tb_mkt_res@ldc2ch d,
crm20_ins1.customer_order_551@ldc2ch e
where a.acpt_order=e.cust_order_id
and e.staff_id=b.empee_id
and a.obj_id=c.prod_inst_id(+)
and a.term_type=d.mkt_res_Code
and TRUNC(a.mod_date)=TRUNC(sysdate-1)
and a.state='1002');
commit;
EXCEPTION
WHEN OTHERS THEN
common_idap.insert_execlog('test1', '执行报错!' || SQLERRM);

END;
END test1;
/
-- 调用过程测试
begin
test1;
end;


运行调用过程就报错,
...全文
584 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Define_ling 2014-07-02
  • 打赏
  • 举报
回复
CREATE OR REPLACE PROCEDURE PROC_T_BT_REPORT_Test IS

BEGIN
  begin
    --notice_sub_no 字段number 类型
   -- insert into define_test (notice_sub_no) (select 1 from dual); --执行结果:正确插入数据
    insert into define_test (notice_sub_no) (select 'a' from dual); --执行结果:输出执行报错
    commit;
  EXCEPTION
    WHEN OTHERS THEN
      dbms_output.put_line('执行报错!');
  END;

END PROC_T_BT_REPORT_Test;
qq_16852171 2014-06-26
  • 打赏
  • 举报
回复
create or replace procedure test1 is begin insert into lj_串号变更 (稽核人, 受理人, 用户名称, 号码, 号码状态, 号码受理时间, 串号, 机型, 号码录入状态, 录入时间, 录入订单号, gxdate) select b.jhr 稽核人,b.bm 部门,b.empee_name 受理人,c.prod_inst_name 用户名称,c.acc_nbr 号码,c.prod_inst_id,c.status_cd 号码状态,c.create_date 号码受理时间, a.res_inst_nbr 串号,d.mkt_res_name 机型,to_char(a.res_prd_inst_stas,'9999') 号码录入状态,a.mod_date 录入时间,a.order_id 录入订单号,to_char(sysdate, 'yyyymmdd') from crm1.tb_prd_res_prd_inst_551@ldc2ch a, LW_LJ_EMPEE b, crm20_ins1.prod_inst_551@ldc2ch c, crmshare1.tb_mkt_res@ldc2ch d, crm20_ins1.customer_order_551@ldc2ch e where e.staff_id=b.empee_id and a.obj_inst_id=c.prod_inst_id(+) and a.order_id=e.cust_order_id and a.res_id=d.mkt_res_id and TRUNC(a.mod_date)=TRUNC(sysdate-1) ; END ; / -- 调用过程测试 begin test1; end; 我改成这样了,居然还提示上述错误!!
c_sdn_shang_bu_qi 2014-06-26
  • 打赏
  • 举报
回复
把倒数第二个end;去掉 然后insert into 后面的第一个(select的(去掉 也就是 insert into table() select * from table; 这样的写法

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧