i have baked this procedur and when i try to run this i have a ORA-00933, i have added the update statments and after this the error comes. before it has worket.
how is the issue?
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;
/