| От | Tom Lane |
|---|---|
| Тема | Re: Re: [BUGS] Unnexpected results using to_number() |
| Дата | |
| Msg-id | 124.963238366@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: Re: [BUGS] Unnexpected results using to_number() (Karel Zak <zakkr@zf.jcu.cz>) |
| Список | pgsql-hackers |
Karel Zak <zakkr@zf.jcu.cz> writes:
>> What do you think about raising an error instead of returning NULL?
> Oracle:
> SVRMGR> select to_number('12,454.8-', '') from dual;
> TO_NUMBER(
> ----------
> ORA-01722: invalid number
> I mean that we can use ERROR here too. My original idea was same form for
> to_char and for to_number --- for to_char() Oracle say:
> SVRMGR> select to_char(SYSDATE, '') from dual;
> TO_CHAR(S
> ---------
>
> 1 row selected.
> I not sure here what is better.
Well, I think there is a good reason for the difference in Oracle's
behavior. The second case is presumably returning a zero-length string,
not a NULL, and that is a perfectly valid string. to_number() has no
comparable option, so I think it makes sense for it to raise an error.
regards, tom lane
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера