i have this procedur but its runing in a ora-00904, the column sid in the tables are existing without “”.i have also a semilar procedur without the error.
DECLARE
---values---
v_sidcount integer;
v_sid integer;
v_cid integer := 32;
v_sptid integer := 215;
v_sptid0 integer := 32;
v_sptid1 integer := 57;
v_sptid2 integer := 217;
v_sptid3 integer := 218;
v_sitenoteold clob;
v_sitenote clob;
v_candidatenote clob;
BEGIN
---count---
SELECT count(sid) into v_sidcount FROM sitetb
WHERE NOT EXISTS (SELECT sid FROM KAM_REPORT_CEL_HI3GNY2017
WHERE sid = sitetb.sid
) and cid = v_cid and sptid = v_sptid0 or sptid = v_sptid1 or sptid = v_sptid2 or sptid = v_sptid3;
---find all data---
SELECT max(sid) into v_sid FROM sitetb
WHERE NOT EXISTS (SELECT sid FROM KAM_REPORT_CEL_HI3GNY2017
WHERE sid = sitetb.sid
) and cid = v_cid and sptid = v_sptid0 or sptid = v_sptid1 or sptid = v_sptid2 or sptid = v_sptid3;
---insert into table---
insert into KAM_REPORT_CEL_HI3GNY2017 (sid) values (v_sid);
---bake site and cvandidate comments---
INSERT INTO KAM_REPORT_CEL_HI3GNY2017_CANNOTE (cannote_sid,comments) SELECT sid, addeddate ||', '||responseperson||': '||candidatenote||' '
FROM candidatetb_extra where sid = v_sid order by noteid desc;
INSERT INTO KAM_REPORT_CEL_HI3GNY2017_SITENOTE (sitenote_sid,comments) SELECT sid, addeddate ||', '||responseperson||': '|| sitenote|| ' '
FROM sitetb_extra where sid = v_sid order by noteid desc;
select sitenoteold into v_sitenoteold
from sitecandi_note_old where sid = v_sid;
EXCEPTION
WHEN NO_DATA_FOUND THEN
v_sitenoteold := NULL;
SELECT LISTAGG(comments, ', ') into v_candidatenote
FROM KAM_REPORT_CEL_HI3GNY2017_CANNOTE where sid = v_sid;
SELECT LISTAGG(comments, ', ') into v_sitenote
FROM KAM_REPORT_CEL_HI3GNY2017_SITENOTE where sid = v_sid;
update KAM_REPORT_CEL_HI3GNY2017
set CANDI_COMMENTS = v_candidatenote,
SITE_COMMENTS = v_sitenote
where sid = v_sid;
update KAM_REPORT_CEL_HI3GNY2017
set SITE_COMMENTS_OLD = v_sitenoteold
where sid = v_sid;
dbms_output.put_line
(v_sid || '/' ||v_sidcount|| '/' ||v_sitenoteold|| '/' ||v_sitenote|| '/' ||v_candidatenote);
END;
/
ORA-06550: line 40, column 31:
PL/SQL: ORA-00904: “SID”: invalid identifier
ORA-06550: line 39, column 1:
PL/SQL: SQL Statement ignored
ORA-06550: line 47, column 46:
PL/SQL: ORA-00904: “SID”: invalid identifier
ORA-06550: line 46, column 1:
PL/SQL: SQL Statement ignored
ORA-06550: line 49, column 47:
PL/SQL: ORA-00904: “SID”: invalid identifier
ORA-06550: line 48, column 1:
PL/SQL: SQL Statement ignored
Error at Line: 10 Column: 0