Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Invalid number when using different languages

Adennis-OracleNov 12 2008 — edited Nov 12 2008
I am having a problem with an invalid number when I have the application set up to use different languages

I have on my page one item :P10_ITEM

I populate this item with a before header process

declare

CURSOR c_test_cursor (cp_id IN NUMBER) IS
SELECT to_number(salary)
FROM test_a
WHERE id = cp_id;

begin

:P10_ITEM := null;

OPEN c_test_cursor(1);
FETCH c_test_cursor
INTO :P10_ITEM;
CLOSE c_test_cursor;

end;

I have set up my application to derive the language from the users browser, this is so users in different countries can view the application with the correct formatting. The salary field in my test table is a varchar2 and it has 2500.50 as the value.

When I am using my browser with the language set as English the page displays fine.
When I change the language of my browser to German I get an ORA-01722: invalid number error.

To get around this I have to change the select to:
SELECT to_number(replace(salary,'.',','))
FROM test_a
WHERE id = cp_id;

Which then means that when I switch back to using the browser in English I will get the same error.

I realize I can conditionally run processes based on the browser language, but that would mean going through the application and duplicating each process.

What other options do I have?

Thanks
Adam
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 10 2008
Added on Nov 12 2008
2 comments
521 views