Re: Trigger on Update

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: sunithab(at)travelpost(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Trigger on Update
Date: 2005-07-15 18:11:27
Message-ID: 42D7FC4F.5030000@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> Anybody know what is the syntax I have to use in update statement.
>

Try using now() instead of CURRENT_DATE.

>
>
> CREATE TRIGGER "trg_update_note_updated_date" AFTER UPDATE
> ON "property"."note" FOR EACH ROW
> EXECUTE PROCEDURE "property"."update_note_updated_date_trg"();
>
>
> CREATE OR REPLACE FUNCTION "property"."update_note_updated_date_trg" ()
> RETURNS trigger AS
> $body$
> begin
> /* New function body */
> UPDATE property.note SET updated_date=CURRENT_DATE
> WHERE note_id = NEW. note_id;
> return null;
> end;
> $body$
> LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;

--
Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240
PostgreSQL Replication, Consulting, Custom Programming, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message mark reid 2005-07-15 18:16:42 Re: Trigger on Update
Previous Message sunithab 2005-07-15 18:07:38 Trigger on Update