From: | Erik Wienhold <ewie(at)ewie(dot)name> |
---|---|
To: | gzh <gzhcoder(at)126(dot)com> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Re:Re: psql:t_mstr.sql:994: ERROR: function to_char(numeric) does not exist |
Date: | 2023-04-27 13:20:57 |
Message-ID: | 1680302275.1289710.1682601657505@office.mailbox.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> On 27/04/2023 13:20 CEST gzh <gzhcoder(at)126(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2023-04-27 14:11:22 | Re: psql:t_mstr.sql:994: ERROR: function to_char(numeric) does not exist |
Previous Message | Erik Wienhold | 2023-04-27 12:59:55 | Re: Differential Backups in Windows server |