when i try to execute the following query i am getting the desired output but with error bind variable does not exist. could someone advise to fix this error
Error :
Error report -
ORA-01006: bind variable does not exist
ORA-06512: at line 25
01006. 00000 - "bind variable does not exist"
Query :
SET SERVEROUTPUT ON
DECLARE
v_sql varchar2(5000);
v_sql2 varchar2(5000);
v_prj_id varchar2(4000):='B00781728,B00781628,B00781611,A43670001';
v_event varchar2(5000) := 'CORE_DTS_INTERNAL';
BEGIN
FOR i IN (SELECT trim(regexp_substr(v_prj_id, '[^,]+', 1, LEVEL)) l
FROM dual
CONNECT BY LEVEL <= regexp_count(v_prj_id, ',') + 1
) LOOP
v_sql := v_sql || 'select '''|| i.l ||''' AS "PRJ_ID", EVENT, email,modified_by,modified from ' || i.l || '.SI_Recipient WHERE EVENT = ''' ||V_EVENT ||''' UNION ALL ' || chr(10);
END LOOP;
v_sql2 := RTRIM(v_sql, 'UNION ALL ' || chr(10) ) ;
Dbms_Output.Put_Line (v_sql2);
EXECUTE IMMEDIATE V_SQL2 USING V_EVENT;
END;
/