Hi again everyone,
This is kind of the second part to my chr(10) issue.
I have a process that attempts to INSERT but when throws an exception (DUP_VAL_ON_INDEX) I need to detect that a related child record(s) exists. If a child record exists then I have to delete the child record(s) but first I want to capture the records for logging purposes. It is the capture portion that I am trying to impliment under the DUP_VAL_ON_INDEX exception. I do not think this will work because I think the result must be one record but I am not 100% sure. In addition, I am trying to avoid build a CURSOR at the EXCEPTION block. This PL/SQL stuff is relative new/old for me. Meaning I only dig into this stuff once or twice a year so I appreciate your help.
This is what I think may or may not work.
SELECT trans_no || ', ' || plant || ', ' || trans_dt || ', ' || fiscal_yr||chr(10)
INTO SelMsg
FROM other_journal
WHERE ocd_trans_no = gv_ocd_trans_no
The result would look like this
TRANS_NO||','||PLANT||','||TRANS_DT||','||FISCAL_YR||CHR(10)
------------------------------------------------------------------------------------------------------------------------------------
124481, 001, 02/10/01, 2001
124482, 500, 02/10/01, 2001
124483, 001, 02/10/01, 2001
If I can get this result into a variable then I can send it to the log via DBMS_OUTPUT.PUT_LINE.
At least that is my plan.
Any ideas how to do this without a CURSOR build. To be honest, I am not sure if I can do a CURSOR build at the EXCEPTION block.
Thank you very much for your help.
Thank you for all your help
Tom
This is kind of the second part to my chr(10) issue.
I have a process that attempts to INSERT but when throws an exception (DUP_VAL_ON_INDEX) I need to detect that a related child record(s) exists. If a child record exists then I have to delete the child record(s) but first I want to capture the records for logging purposes. It is the capture portion that I am trying to impliment under the DUP_VAL_ON_INDEX exception. I do not think this will work because I think the result must be one record but I am not 100% sure. In addition, I am trying to avoid build a CURSOR at the EXCEPTION block. This PL/SQL stuff is relative new/old for me. Meaning I only dig into this stuff once or twice a year so I appreciate your help.
This is what I think may or may not work.
SELECT trans_no || ', ' || plant || ', ' || trans_dt || ', ' || fiscal_yr||chr(10)
INTO SelMsg
FROM other_journal
WHERE ocd_trans_no = gv_ocd_trans_no
The result would look like this
TRANS_NO||','||PLANT||','||TRANS_DT||','||FISCAL_YR||CHR(10)
------------------------------------------------------------------------------------------------------------------------------------
124481, 001, 02/10/01, 2001
124482, 500, 02/10/01, 2001
124483, 001, 02/10/01, 2001
If I can get this result into a variable then I can send it to the log via DBMS_OUTPUT.PUT_LINE.
At least that is my plan.
Any ideas how to do this without a CURSOR build. To be honest, I am not sure if I can do a CURSOR build at the EXCEPTION block.
Thank you very much for your help.
Thank you for all your help
Tom