pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
TO_CHAR or TO_DATE
2+ messages / 2 participants
[nested] [flat]

* TO_CHAR or TO_DATE
@ 1999-03-31 11:34  Chairudin Sentosa <chairudin@prima.net.id>
  0 siblings, 1 reply; 2+ messages in thread

From: Chairudin Sentosa @ 1999-03-31 11:34 UTC (permalink / raw)
  To: pgsql-sql

Hi,

Is the any similar function to 'to_char' and to_date' from Oracle in
Postgresql?

I have a problem insert only month-year.

create table blah
(id varchar(10),
 month date,
 week int4,
 amount float8
);

insert into blah
(id, month, week, amount)
values
('1','MAR-1999',1,,3000);

I got error message : Bad date external representation MAR-1999

How to do it the right way to insert only month and year?

Regards,
Chai




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [SQL] TO_CHAR or TO_DATE
@ 1999-03-31 14:27  Clark Evans <clark.evans@manhattanproject.com>
  parent: Chairudin Sentosa <chairudin@prima.net.id>
  0 siblings, 0 replies; 2+ messages in thread

From: Clark Evans @ 1999-03-31 14:27 UTC (permalink / raw)
  To: chairudin@prima.net.id; +Cc: pgsql-sql

Chairudin Sentosa wrote:
> How to do it the right way to insert only month and year?

You don't, it is necessary to have a day as well.  Use
the first of the month, and ignore the day in your program.
Thus, insert into table values ( '1-MAR-1999' );

Alternatively, you could create your own type and work out
all the semantics necessary to only manage months.  This sounds
interesting actually, only I would do 'week' rather than month.

Clark



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~1999-03-31 14:27 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-03-31 11:34 TO_CHAR or TO_DATE Chairudin Sentosa <chairudin@prima.net.id>
1999-03-31 14:27 ` Clark Evans <clark.evans@manhattanproject.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox