pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Herouth Maoz <herouth@oumail.openu.ac.il>
To: Chairudin Sentosa Harjo <tsg@dnet.net.id>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Date
Date: Wed, 8 Jul 1998 12:52:38 +0300
Message-ID: <l03110706b1c8f014f080@[147.233.159.109]> (raw)
In-Reply-To: <35A33791.3D908698@dnet.net.id>
References: <3.0.1.32.19980626150540.006ab3dc@rr.pathlink.com>
	<3.0.1.32.19980626164554.006ac384@rr.pathlink.com>

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





view thread (20+ messages)  latest in thread

Message-ID: <l03110706b1c8f014f080@[147.233.159.109]>
Permalink:  ../l03110706b1c8f014f080@%5B147.233.159.109%5D/
Also on:    postgresql.org/message-id/l03110706b1c8f014f080@[147.233.159.109]

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: herouth@oumail.openu.ac.il, tsg@dnet.net.id
  Subject: Re: [SQL] Date
  In-Reply-To: <l03110706b1c8f014f080@[147.233.159.109]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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