Ronaldo Felipe
Ronaldo Felipe

Reputation: 402

APEX sum different fields on a form

I want to create a page item display only that sums 2 other page itens on a form.

P1_A is a number field with a mask of currency. P1_B is a display only field based on a database query that returns a single value.

My P1_C is a display only field that I am trying to use as a source the following query: select :P1_A+:P1_B from dual;

However, this is my result :

Error computing item source value for page item P1_C.

ORA-01722: número inválido
Technical Info (only visible for developers)

    is_internal_error: true
    apex_error_code: WWV_FLOW_FORMS.ITEM_SOURCE_ERR
    ora_sqlcode: -1722
    ora_sqlerrm: ORA-01722: número inválido
    component.type: APEX_APPLICATION_PAGE_ITEMS
    component.id: 283302822642071708
    component.name: P1_C
    error_backtrace:

    ORA-06512: em "SYS.DBMS_SYS_SQL", line 1942
    ORA-06512: em "SYS.WWV_DBMS_SQL", line 1334
    ORA-06512: em "SYS.WWV_DBMS_SQL", line 1358
    ORA-06512: em "SYS.WWV_DBMS_SQL", line 1375
    ORA-06512: em "APEX_040100.WWV_FLOW_DYNAMIC_EXEC", line 776
    ORA-06512: em "APEX_040100.WWV_FLOW_FORMS", line 580

I believe it has been caused by the currency format, but I can not remove it. So, what did I miss to avoid this error?

Upvotes: 2

Views: 2035

Answers (1)

Olafur Tryggvason
Olafur Tryggvason

Reputation: 4874

Just convert the text (P1_A) to number when using it in the sum calculations.

Example: TO_NUMBER('$94 567,00', 'L999G999D00', NLS_NUMERIC_CHARACTERS ', ')

Upvotes: 1

Related Questions