Search Postgresql Archives

Re turn Query with simple function

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

 



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.


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

[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