pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Create Procedure syntax
2+ messages / 2 participants
[nested] [flat]

* Create Procedure syntax
@ 2000-10-26 15:30  Sivagami . <sivagami@worlddata.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Sivagami . @ 2000-10-26 15:30 UTC (permalink / raw)
  To: pgsql-admin

Hi,

I have 3 simple questions:

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

2.  How can I print something to my screen ,e..g, the value of a variable in a stored procedure.
     Something similar to DBMS_OUTPUT.PUT_LINE in Oracle??

3.  Also, is there any dynamic discussion forum for PGSQL, where I post a query, and anyone can reply me back and I can see the reply immediately in the forum.

Thanks to anyone who can guide me in the right direction.
Shiva.

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Create Procedure syntax
@ 2000-10-27 06:07  Anatoly K. Lasareff <tolik@aaanet.ru>
  parent: Sivagami . <sivagami@worlddata.com>
  0 siblings, 0 replies; 2+ messages in thread

From: tolik@aaanet.ru @ 2000-10-27 06:07 UTC (permalink / raw)
  To: Sivagami . <sivagami@worlddata.com>; +Cc: 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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2000-10-27 06:07 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-10-26 15:30 Create Procedure syntax Sivagami . <sivagami@worlddata.com>
2000-10-27 06:07 ` Anatoly K. Lasareff <tolik@aaanet.ru>

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