Skip site navigation (1) Skip section navigation (2)

Help on some SQL command...

From: Ang Sei Heng <joanna(at)leopard(dot)cybersource(dot)com(dot)sg>
To: pgsql-sql(at)postgresql(dot)org
Subject: Help on some SQL command...
Date: 2000-08-16 08:11:17
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
Hello to all the SQL gurus...

I have this little table:

test1 (
        id char(8) primary key,
        name char(20),
        create_date timestamp

Now, the create_date need to be updated
to date and time whenever id is being
inserted or updated.

Is there a way in SQL that I can do this

I try the following command using 'trigger'

CREATE_TRIGGER test1_autodate 
        test1 FOR EACH ROW EXECUTE update("test1")

CREATE FUNCTION update(char *) RETURNS int4
    AS 'UPDATE $1 set date="now"'
    LANGUAGE 'sql';

But realized 'char *' is not allow... Is there a
way to solve this?

Or Am I the right track in solving this problem?

Hope someone can help me... thanks.

Sei Heng


pgsql-sql by date

Next:From: Kovacs Zoltan SandorDate: 2000-08-16 09:21:46
Subject: Re: returning a recordset with pl/pgsql
Previous:From: mike.baroukhDate: 2000-08-16 06:59:08
Subject: lo_export and files permissions

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group