← 输入框|github.com|刷新
Skip to content

Number precision when selecting from dual #907

Closed

Description

@lwasylow

When running a tests like this

create or replace PACKAGE ut_sample_test IS

   --%suite(Sample Test Suite)
   --%tags(suite1)

   --%test(Compare Ref Cursors)
   --%tags(test1)
   PROCEDURE ut_refcursors1;

END ut_sample_test;
/

create or replace PACKAGE BODY ut_sample_test IS

   PROCEDURE ut_refcursors1 IS
      v_actual   SYS_REFCURSOR;
      v_expected SYS_REFCURSOR;
   BEGIN
    open v_expected for select 12345 as test from dual;
    open v_actual   for select 12345 as test from dual;

      ut.expect(v_actual).to_equal(v_expected);
   END;

END ut_sample_test;
/

it fails with
ORA-01438: value larger than specified precision allowed for this column ORA-06512: at "UT3.UT_DATA_VALUE_REFCURSOR", line 332 ORA-06512: at "UT3.UT_DATA_VALUE_REFCURSOR", line 380 ORA-06512: at "UT3.UT_EQUAL", line 225 ORA-06512: at "UT3.UT_EXPECTATION", line 26 ORA-06512: at "UT3.UT_EXPECTATION", line 138 ORA-06512: at "UT3.UT_SAMPLE_TEST", line 10

This is due to ut_compound_helper.generate_xmltab_stmt and dbms_sql.describe_columns3 for some reason it set max column len to 4 , precision to 0 and scale to -127 when selecting from dual.

Solution is if the type is NUMBER then use a precision and scale instead of max_col_len.

Activity

  1. self-assigned this
    on Apr 26, 2019
  2. lwasylow commented on Apr 26, 2019

    @lwasylow
    MemberAuthor

    In this scenario I think issue is with dbms package as showing precision as zero where allowed is 1..38 we should check if precision is positive and apply then otherwise type mark as number with no precision and scale

  3. added this to the v3.1.7 milestone on Apr 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions