@@ -2522,42 +2522,54 @@ Diff:%
25222522 end;
25232523
25242524 procedure xml_error_actual is
2525- c_price CONSTANT NUMBER(20,4):= 1357;
2525+ c_price CONSTANT NUMBER(20,4):= 1357;
25262526 c_user CONSTANT varchar2(30):= 'TEST_USER';
2527- v_actual sys_refcursor;
2528- v_expected sys_refcursor;
2527+ l_actual sys_refcursor;
2528+ l_expected sys_refcursor;
2529+ l_exp_message varchar2(32000);
25292530 begin
2530- open v_actual for
2531+ l_exp_message :='ORA-20218: SQL exception thrown when fetching data from cursor:
2532+ ORA-01722: invalid number
2533+ at "UT3$USER#.TEST_EXPECTATIONS_CURSOR.XML_ERROR_ACTUAL", line 2542 ut3.ut.expect(l_actual).to_equal(l_expected);
2534+ Check the query and data for errors.';
2535+
2536+ open l_actual for
25312537 select cast(null as number(10)) as usd_price_amt, c_user as update_id
25322538 from dual where dummy = 1;
2533- open v_expected for
2539+ open l_expected for
25342540 select c_price as usd_price_amt, c_user as update_id from dual;
25352541
2536- ut3.ut.expect(v_actual).to_equal(v_expected);
2542+ ut3.ut.expect(l_actual).to_equal(l_expected);
2543+ --Line that error relates to in expected messag
25372544
25382545 ut.fail('Expected exception on cursor fetch');
25392546 exception
25402547 when others then
2541- ut.expect(sqlerrm).to_be_like('%ORA-20218: SQL exception thrown when fetching data from cursor:%
2542- %ORA-01722: invalid number%%Check the query and data for errors%');
2548+ ut.expect(sqlerrm).to_equal(l_exp_message);
25432549 end;
25442550
25452551 procedure xml_error_expected is
2546- v_actual sys_refcursor;
2547- v_expected sys_refcursor;
2552+ l_actual sys_refcursor;
2553+ l_expected sys_refcursor;
2554+ l_exp_message varchar2(32000);
25482555 begin
2549- open v_expected for
2556+
2557+ l_exp_message :='ORA-20218: SQL exception thrown when fetching data from cursor:
2558+ ORA-01476: divisor is equal to zero
2559+ at "UT3$USER#.TEST_EXPECTATIONS_CURSOR.XML_ERROR_EXPECTED", line 2567 ut3.ut.expect(l_actual).to_equal(l_expected);
2560+ Check the query and data for errors.';
2561+
2562+ open l_expected for
25502563 select 1/0 as test from dual;
2551- open v_actual for
2564+ open l_actual for
25522565 select 1 as test from dual;
25532566
2554- ut3.ut.expect(v_actual ).to_equal(v_expected );
2567+ ut3.ut.expect(l_actual ).to_equal(l_expected );
25552568
25562569 ut.fail('Expected exception on cursor fetch');
25572570 exception
25582571 when others then
2559- ut.expect(sqlerrm).to_be_like('%ORA-20218: SQL exception thrown when fetching data from cursor:%
2560- %ORA-01476: divisor is equal to zero%Check the query and data for errors%');
2572+ ut.expect(sqlerrm).to_equal(l_exp_message);
25612573 end;
25622574
25632575end;
0 commit comments