Problems with TOraLoader and floating point values if using Oracle (german locale settings); ORA-01722: invalid number
Posted: Mon 22 May 2006 09:47
Oracle 9.2.0.7 (german)
Delphi 7
When trying to insert rows of type NUMBER/FLOAT into a table using TOraLoader, an exception "ORA-01722" occurs.
I think I found the reason: If Oracle uses english locale settings (decimal separator = . (dot)) then it works. In our case the locale settings for Oracle are german (decimal separator = , (comma)).
The problem, I think, is that TOraLoader.PutColumnData _always_ uses . (dot) as decimal separator:
TOraLoader.PutColumnData, lines 487-494:
If I remove the decimal-separator code like this:
it works fine, since my Windows locale settings correspond to the locale settings of Oracle.
Of course this is not the fix, since Oracle can have different locale settings than the OS.
Wouldn't be the best solution to get the Oracle locale settings and use them for the conversion? If so, can you please tell me if this will be fixed for the next release?
If you will not fix this, can you show me a workaround?
thanks,
Alexander
Delphi 7
When trying to insert rows of type NUMBER/FLOAT into a table using TOraLoader, an exception "ORA-01722" occurs.
I think I found the reason: If Oracle uses english locale settings (decimal separator = . (dot)) then it works. In our case the locale settings for Oracle are german (decimal separator = , (comma)).
The problem, I think, is that TOraLoader.PutColumnData _always_ uses . (dot) as decimal separator:
TOraLoader.PutColumnData, lines 487-494:
Code: Select all
varDouble,varSingle,varCurrency: begin
OldDecimalSeparator := DecimalSeparator;
DecimalSeparator := '.';
Str := FloatToStr(Value);
DecimalSeparator := OldDecimalSeparator[1];
Code: Select all
varDouble,varSingle,varCurrency: begin
Str := FloatToStr(Value);
Of course this is not the fix, since Oracle can have different locale settings than the OS.
Wouldn't be the best solution to get the Oracle locale settings and use them for the conversion? If so, can you please tell me if this will be fixed for the next release?
If you will not fix this, can you show me a workaround?
thanks,
Alexander