Re: [SQL] Date

From: Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il>
To: Chairudin Sentosa Harjo <tsg(at)dnet(dot)net(dot)id>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] Date
Date: 1998-07-08 09:52:38
Message-ID: l03110706b1c8f014f080@[147.233.159.109]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

At 12:10 +0300 on 8/7/98, Chairudin Sentosa Harjo wrote:

> I need help with date.
>
> create table blah
> (
> custnum int,
> startdate date,
> enddate date
> );
>
> How do I get the "real date" to insert to startdate when
> the data is entered?
>
> insert into blah
> (custnum, startdate, enddate)
> values
> (001,???,'NULL');
>
> I need a way to fill in the '???' field.
> In oracle I could use
> select sysdate from dual;

First, I recommend that you use datetime, not date. Date is a limited type,
and has less options.

That said, you can use either:

insert into blah
(custnum, startdate, enddate)
values
(001, 'now', null);

Or

values
(001, current_date, null);

See the manpage "pgbuiltin".

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma

In response to

  • Date at 1998-07-08 09:10:41 from Chairudin Sentosa Harjo

Browse pgsql-sql by date

  From Date Subject
Next Message Roman Volkoff 1998-07-09 11:05:06 unsubscribe
Previous Message Chairudin Sentosa Harjo 1998-07-08 09:10:41 Date