Return Query with simple function
| От | dvanatta |
|---|---|
| Тема | Return Query with simple function |
| Дата | |
| Msg-id | 15659266.post@talk.nabble.com обсуждение исходный текст |
| Ответы |
Re: Return Query with simple function
|
| Список | pgsql-general |
I'm new to PostgreSQL, moving over from SQL Server and stored procs to
PostgreSQL 8.3 and it's functions and having some difficulty. With SQL
Server I didn't have to define types and return those types from stored
procs which was convenient. I came across Return Query but can't find much
info on how to use it. I'm hoping Return Query will allow me to NOT have to
define types. I want to do the following but it doesn't work and I don't get
very helpful error info. How should this function be written? Do I have to
define a type and fill it?
CREATE OR REPLACE FUNCTION get_person(PersonId integer)
$BODY$
BEGIN
Return Query
SELECT
p.fname, j.title
FROM person p
Inner join job j
on p.personid = j.personid
WHERE p.personid = PersonID;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE
--
View this message in context: http://www.nabble.com/Return-Query-with-simple-function-tp15659266p15659266.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
В списке pgsql-general по дате отправления: