How to use parameters in stored procedures?

From: "Cyphos" <mweichert(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How to use parameters in stored procedures?
Date: 2006-01-13 17:53:29
Message-ID: 1137174809.411619.194260@f14g2000cwb.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi guys,

I'm very new to PostgresSQL, coming from MS SQL. I'm trying to write a
function that will select a row from a location:

CREATE FUNCTION SelectLocation(IN "myLocationID" int4) RETURNS
"Location"
LANGUAGE 'sql' AS
$BODY$
SELECT
"LocationID",
"Name",
"PhoneNumber",
"FaxNumber",
"EmailAddress",
"StreetAddress",
"City",
"Province",
"PostalCode"
FROM "Location"
WHERE "LocationID" = "myLocationID"
ORDER BY "Name";
$BODY$

I get an error that the column myLocationID doesn't exist. I'm sure
it's something simple, but I can't figure it out.

Also too, why do I have to quote columns and tables?

Thanks guys,
Mike

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2006-01-13 17:53:54 Re: Plans for 8.2?
Previous Message Joshua D. Drake 2006-01-13 17:51:25 Re: PostgreSQL Top 10 Wishlist