Re: Question about stored procedures

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Question about stored procedures
Date: 2006-06-12 09:15:28
Message-ID: 20060612091528.GC30300@webserv.wug-glas.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

am 12.06.2006, um 10:58:04 +0200 mailte Greg folgendes:
> >From what I understand, a stored procedure in pgSQL is actually a function
> that returns rows? Am I correct?

Yes and no, if a function returns multiple rows, than is this a SRF (Set
Returning Function)

http://www.postgresql.org/docs/current/static/xfunc-sql.html#XFUNC-SQL-TABLE-FUNCTIONS
http://www.varlena.com/GeneralBits/26

>
> Can somebody show me the syntax for a basic stored procedure that takes an
> argument?

http://www.postgresql.org/docs/8.1/interactive/plpgsql-declarations.html
there are examples. Read this.

> i.e I would like the query to be "select name, email from users where userid
> = @userid"

If you want to execute dynamic querys, read

http://www.postgresql.org/docs/8.1/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN

> Sorry for the easy question but I looked at the docs and just can't seem to

Read again.

Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47215, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Devrim GUNDUZ 2006-06-12 09:32:49 Re: Easy SQL Question
Previous Message Shoaib Mir 2006-06-12 09:01:44 Re: Easy SQL Question