Re: Problem creating stored procedure - Mailing list pgsql-general

From Michael Fuhr
Subject Re: Problem creating stored procedure
Date
Msg-id 20051227180438.GA70453@winnie.fuhr.org
Whole thread Raw
In response to Problem creating stored procedure  ("Ted Byers" <r.ted.byers@rogers.com>)
List pgsql-general
On Tue, Dec 27, 2005 at 12:41:44PM -0500, Ted Byers wrote:
> I am puzzled.  Can ayone explain why I get an error from Postgres
> on this simple stored procedure?

There are several mistakes in the code you posted:

* PostgreSQL doesn't have a CREATE PROCEDURE command.  Use CREATE
  FUNCTION.

* You didn't declare a return type or any OUT or INOUT parameters.

* You didn't quote the function body.

* Several statements are missing terminating semicolons.

* You wrote "SELECT int" instead of "SELECT INTO".

* You wrote "INSERT INTO addys(...)" instead of providing a column
  list.  If this is the actual code then it's a syntax error, and
  if it's not the actual code then we need to see what you're
  really doing.

* You wrote plpgsql code but declared the function to be sql.

> Judging from the examples in the manual (around page 600), my
> procedure ought to be fine, but clearly Postgres doesn't like it.

What section of the manual are you looking at, and for what version
of PostgreSQL (many of us use the online documentation so page
numbers don't mean anything)?  Are you mixing Oracle syntax with
PL/pgSQL syntax?

--
Michael Fuhr

pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: copy csv eclosed by analog quotes problem superuser ?
Next
From: David Rysdam
Date:
Subject: EXPLAIN ANALYZE output