Re: first try at postgres functions
От | Robert Wimmer |
---|---|
Тема | Re: first try at postgres functions |
Дата | |
Msg-id | BAY10-F54F0DDA9691EB11D1F0035D0B00@phx.gbl обсуждение исходный текст |
Ответ на | first try at postgres functions ("Kevin B." <db@ke5in.com>) |
Список | pgsql-novice |
the correct syntax is CREATE OR REPLACE FUNCTION test1() RETURNS INTEGER AS ' BEGIN RETURN 1; END; ' LANGUAGE 'plpgsql'; you have to be aware of different things. - the syntax of the language itself is a little bit like pascal. - sometimes the errorcodes are not very helpfull. - be beware of the quotes. you must quote the "code block" 'BEGIN .... END;' - you have to double quote strings inside the block. there are usefull examples in the docs > >Hi, >I'm not sure why this does not work. > >create or replace function test1() returns int as ' > return 1; >' LANGUAGE 'plpgsql'; > >select test1(); > >-------------------------------------------------------- > >I also tried this: > >create or replace function test1() returns int as ' > select 1; >' LANGUAGE 'plpgsql'; > >select test1(); > > >---------------------------(end of broadcast)--------------------------- >TIP 6: Have you searched our list archives? > > http://archives.postgresql.org _________________________________________________________________ Flexibilität in Ihrem Hotmail-Konto - mehr Möglichkeiten für Ihre E-Mails! http://join.msn.com/?pgmarket=de-at&DI=1031&XAPID=1581
В списке pgsql-novice по дате отправления: