Re: User Defined Note Order Problem

Поиск
Список
Период
Сортировка
От
Тема Re: User Defined Note Order Problem
Дата
Msg-id 20050706184614.55804.qmail@web33305.mail.mud.yahoo.com
обсуждение исходный текст
Ответ на User Defined Note Order Problem  (<operationsengineer1@yahoo.com>)
Список 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

В списке pgsql-novice по дате отправления:

Предыдущее
От:
Дата:
Сообщение: Re: Backups - WAL archiving. problem understanding documentation
Следующее
От: "Van Ingen, Lane"
Дата:
Сообщение: PostgreSQL User-Defined Global Variables