Re: Create Procedure syntax

Поиск
Список
Период
Сортировка
От tolik@aaanet.ru (Anatoly K. Lasareff)
Тема Re: Create Procedure syntax
Дата
Msg-id 86snpiu89k.fsf@tolikus.hq.aaanet.ru
обсуждение исходный текст
Ответ на Create Procedure syntax  ("Sivagami ." <sivagami@worlddata.com>)
Список pgsql-admin
>>>>> "S" == Sivagami  <sivagami@worlddata.com> writes:

 S> [1  <text/plain; iso-8859-1 (quoted-printable)>]
 S> Hi,

 S> I have 3 simple questions:

 S> 1.  What is the exact syntax to create a procedure?

CREATE FUNCTION name ( [ ftype [, ...] ] )
    RETURNS rtype
    AS definition
    LANGUAGE 'langname'
    [ WITH ( attribute [, ...] ) ]
CREATE FUNCTION name ( [ ftype [, ...] ] )
    RETURNS rtype
    AS obj_file , link_symbol
    LANGUAGE 'C'
    [ WITH ( attribute [, ...] ) ]

There are _no_ procedures in Postgres, functions only! This syntax is
taken from "PostgreSQL User's Guide".


 S> 2.  How can I print something to my screen ,e..g, the value of a
variable in a stored procedure.

You can use 'raise notice' in plpgsql functions:

---------------------------------------
Aborting and messages

    As indicated in the above examples there is a RAISE statement that can throw messages into the Postgres elog
    mechanism.

    RAISE level format'' [, identifier [...]];


    Inside the format, "%" is used as a placeholder for the subsequent comma-separated identifiers. Possible levels
    are DEBUG (silently suppressed in production running databases), NOTICE (written into the database log and
    forwarded to the client application) and EXCEPTION (written into the database log and aborting the transaction).
---------------------------------------

--
Anatoly K. Lasareff                 Email:    tolik@aaanet.ru
http://tolikus.hq.aaanet.ru:8080    Phone:      (8632)-710071

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

Предыдущее
От: "Sivagami ."
Дата:
Сообщение: Create Procedure syntax
Следующее
От: Georges Martin
Дата:
Сообщение: Re: Postgres and Macintosh Clients