Always use Table aliases for inner / sub-querie s
NOTE : xx_gl_journal_stg.je_header_id doesnt exist, so the below block should throw a compilation error
BUT IT WONT !!!!
BEGIN
UPDATE gl_je_headers
SET attribute6 = nvl(p_batch_id, attribute6)
WHERE je_header_id IN ( SELECT DISTINCT je_header_id
FROM xx_gl_journal_stg
WHERE batch_id = nvl(p_batch_id, batch_id) );
EXCEPTION
WHEN e_exception THEN
xc_err_msg := lc_err_msg;
xn_status := 2;
WHEN OTHERS THEN
xn_status := 2;
xc_err_msg := 'Unexpected error in the BLOCK- '||sqlerrm;
END;
-----------------------------------------------------------------------------------
Solution : The subquery in an update statement should always contain an ALIAS
-----------------------------------------------------------------------------------
No comments:
Post a Comment