if any > < symbols inside an sql script. Any workaround
BEGIN
FOR t1 IN
(SELECT ID
FROM EMP
)
LOOP
update EMP set ID=ID+1 where id=t1.id and 1 <>2 ;
COMMIT;
END LOOP;
DBMS_OUTPUT.PUT_LINE('SUCCESS');
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
DBMS_OUTPUT.PUT_LINE('ERROR - ' || sqlerrm);
END;
/
I had the same issue in one of my use cases. I wrapped the SQL script inside <![CDATA[]]> tag, it worked for me.
CDATA stands for Character Data and it means that the data in between these strings includes data that could be interpreted as XML markup, but should not be.
May be you can give it a try as below:
`<![CDATA[
BEGIN FOR t1 IN (SELECT ID FROM EMP ) LOOP update EMP set ID=ID+1 where id=t1.id and 1 <>2 ; COMMIT; END LOOP; DBMS_OUTPUT.PUT_LINE(‘SUCCESS’); EXCEPTION WHEN OTHERS THEN ROLLBACK; DBMS_OUTPUT.PUT_LINE('ERROR - ’ || sqlerrm); END;
]]>`
Please check the SQL script I copied doesn’t miss anything which is expected before giving it a try.