pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: tolik@aaanet.ru
To: Sivagami . <sivagami@worlddata.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Create Procedure syntax
Date: 27 Oct 2000 10:07:35 +0400
Message-ID: <86snpiu89k.fsf@tolikus.hq.aaanet.ru> (raw)
References: <005401c03f61$a3515d50$43c0f4d1@worlddata.com>

>>>>> "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



view thread (2+ messages)

Message-ID: <86snpiu89k.fsf@tolikus.hq.aaanet.ru>
Permalink:  ../86snpiu89k.fsf@tolikus.hq.aaanet.ru/
Also on:    postgresql.org/message-id/86snpiu89k.fsf@tolikus.hq.aaanet.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tolik@aaanet.ru, sivagami@worlddata.com
  Subject: Re: Create Procedure syntax
  In-Reply-To: <86snpiu89k.fsf@tolikus.hq.aaanet.ru>
  References: <005401c03f61$a3515d50$43c0f4d1@worlddata.com> <86snpiu89k.fsf@tolikus.hq.aaanet.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox