Search Postgresql Archives

Re: Problem creating stored procedure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux