View Single Post

   
  #1 (permalink)  
Old 04-09-2008, 07:51 AM
Cyphos
 
Posts: n/a
Default How to use parameters in stored procedures?

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

Reply With Quote