plsql 过程语句被忽略

问题描述 投票:0回答:1

我已经烘焙了这个程序,当我尝试运行这个程序时,我有一个ORA-00933,我添加了更新语句,之后错误出现了。在它有工作之前。 问题如何?

    DECLARE 
---values---
   v_sidcount sitetb.sid%type;
   v_sid sitetb.sid%type;
   v_cid sitetb.cid%type := 46;
   v_sptid sitetb.sptid%type := 215;

BEGIN 

---count---
SELECT count(sid) into v_sidcount FROM sitetb
WHERE NOT EXISTS (SELECT sid FROM kam_report_ttn
  WHERE sid = sitetb.sid
) and cid = v_cid and sptid = v_sptid;

---find all data---
SELECT max(sid) into v_sid FROM sitetb
WHERE NOT EXISTS (SELECT sid FROM kam_report_ttn
  WHERE sid = sitetb.sid
) and cid = v_cid and sptid = v_sptid;

---insert into table---
insert into KAM_REPORT_TTN (sid) 
values (v_sid);

---update comments---
UPDATE KAM_REPORT_TTN SET comments = (SELECT addeddate || ', ' || responseperson || ': ' || candidatenote || ' '  FROM candidatetb_extra)
where sid = v_sid order by noteid desc;
UPDATE KAM_REPORT_TTN SET comments2 = (SELECT addeddate || ', ' || responseperson || ': ' || sitenote  || ' '  FROM sitetb_extra)
where sid = v_sid order by noteid desc;



   dbms_output.put_line 
   (v_sid || '/' ||v_sidcount); 
END; 
/  
plsql procedure
1个回答
0
投票

这看起来像您正在尝试通过更新语句应用订单:

order by noteid desc;

我猜你的意思是将其包含在选择子查询中,所以:

UPDATE KAM_REPORT_TTN SET comments = (SELECT addeddate || ', ' || responseperson || ': ' || candidatenote || ' '  FROM candidatetb_extra order by noteid desc)
where sid = v_si

我不确定你的 where 子句是否放在正确的位置。

© www.soinside.com 2019 - 2024. All rights reserved.