Re: User Defined Note Order Problem

From: <operationsengineer1(at)yahoo(dot)com>
To: PostGreSQL <pgsql-novice(at)postgresql(dot)org>
Subject: Re: User Defined Note Order Problem
Date: 2005-07-06 18:46:14
Message-ID: 20050706184614.55804.qmail@web33305.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

i've decided this is a good application for a trigger
(i hope this is right - let me know if it isn't).

i want set all the order_number values >=
$user_order_input to order_value + 1.

i added plpsql to my db by using...

createlang plpgsql db_name

i saw a new function in pgadmin3 named
plpgsql_call_handler()

i think my function should look as follows...

CREATE OR REPLACE FUNCTION
func_reorder($user_order_input) RETURNS opaque AS '
BEGIN;
UPDATE tablename
SET order_number = order_number + 1
WHERE order_number >= $user_order_input;
RETURN NEW;
END;
' LANGUAGE 'plpgsql';

do i need to return anything or can i ommit the two
times return is mentioned? i based this function on a
book i have (of course, their example is different
than my needs so it may be apples to oranges).

in pgadmin3, it defaults to CREATE FUNCTION...
instead of CREATE OR REPLACE FUNCTION. is there any
way to change or update this?

will $user_order_input pass into the function given
the example above?

once i nail down the correct syntax for the function,
i can work on the trigger.

tia...

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Van Ingen, Lane 2005-07-06 19:16:56 PostgreSQL User-Defined Global Variables
Previous Message operationsengineer1 2005-07-06 17:36:34 Re: Backups - WAL archiving. problem understanding documentation