Re: Re:Re: psql:t_mstr.sql:994: ERROR: function to_char(numeric) does not exist

Поиск
Список
Период
Сортировка
От Erik Wienhold
Тема Re: Re:Re: psql:t_mstr.sql:994: ERROR: function to_char(numeric) does not exist
Дата
Msg-id 1680302275.1289710.1682601657505@office.mailbox.org
обсуждение исходный текст
Ответ на Re:Re: psql:t_mstr.sql:994: ERROR: function to_char(numeric) does not exist  (gzh <gzhcoder@126.com>)
Список pgsql-general
> On 27/04/2023 13:20 CEST gzh <gzhcoder@126.com> wrote:
>
> When the return type is set to oracle.date, there are hours, minutes, and
> seconds of the date value in the SQL execution result.
> Why is there such a difference and how to solve it?

orafce defines oracle.date as timestamp(0) [0] because Oracle's DATE type has
a precision of one second [1].  That's the point of orafce: to provide Oracle
compatibility.

You can cast oracle.date to pg_catalog.date but then you're in Postgres
territory again.  Depends on what you want to achieve.  If it's just formatting
use oracle.to_char:

    SELECT oracle.to_char('2023-04-27'::oracle.date, 'YYYY-MM-DD');

[0] https://github.com/orafce/orafce/blob/VERSION_3_24_4/orafce--3.24.sql#L343
[1] https://oracle-base.com/articles/misc/oracle-dates-timestamps-and-intervals#date

--
Erik



В списке pgsql-general по дате отправления:

Предыдущее
От: Erik Wienhold
Дата:
Сообщение: Re: Differential Backups in Windows server
Следующее
От: Tom Lane
Дата:
Сообщение: Re: psql:t_mstr.sql:994: ERROR: function to_char(numeric) does not exist