Connecting Tech Pros Worldwide Help | Site Map

Can postgres functions return multiple values???

Newbie
 
Join Date: May 2008
Posts: 27
#1: Jun 4 '08
hi.. i have a function which has 5 out parameters... can i return those in a postgre function...
Moderator
 
Join Date: Dec 2006
Location: Europe
Posts: 292
#2: Jun 4 '08

re: Can postgres functions return multiple values???


of course you can using OUT parameters. If you don't know how put you function/problem here and i'll try to help you.
Newbie
 
Join Date: May 2008
Posts: 27
#3: Jun 4 '08

re: Can postgres functions return multiple values???


thank u so much.. i ll do that
Newbie
 
Join Date: May 2008
Posts: 27
#4: Jun 5 '08

re: Can postgres functions return multiple values???


i ll paste an orcale procedure here... i have to convert it into a postgres function...


CREATE OR REPLACE PROCEDURE ORCHCTADDDOCUMENT
(p_inxml IN OUT CLOB,
p_bravainfos OUT VARCHAR2,
p_duptitles OUT VARCHAR2,
p_outxml OUT CLOB,
p_outdocids OUT VARCHAR2
)
AS





will this declaration work in postgresql????
Moderator
 
Join Date: Dec 2006
Location: Europe
Posts: 292
#5: Jun 5 '08

re: Can postgres functions return multiple values???


Expand|Select|Wrap|Line Numbers
  1. CREATE OR REPLACE PROCEDURE ORCHCTADDDOCUMENT
  2. (IN OUT p_inxml CLOB,
  3. OUT p_bravainfos VARCHAR2,
  4. OUT p_duptitles VARCHAR2,
  5. OUT p_outxml CLOB,
  6. OUT p_outdocids VARCHAR2
  7. )
  8. AS
  9.  
but you must change datatypes, there are no varchar2 and clob in postgresql

Quote:

Originally Posted by ravysters

i ll paste an orcale procedure here... i have to convert it into a postgres function...


CREATE OR REPLACE PROCEDURE ORCHCTADDDOCUMENT
(p_inxml IN OUT CLOB,
p_bravainfos OUT VARCHAR2,
p_duptitles OUT VARCHAR2,
p_outxml OUT CLOB,
p_outdocids OUT VARCHAR2
)
AS





will this declaration work in postgresql????

Newbie
 
Join Date: May 2008
Posts: 27
#6: Jun 5 '08

re: Can postgres functions return multiple values???


ya ya... i change them.... is there a row count function in postgres and is there a writetoCLOB funciton in postgres
Moderator
 
Join Date: Dec 2006
Location: Europe
Posts: 292
#7: Jun 5 '08

re: Can postgres functions return multiple values???


Quote:

Originally Posted by ravysters

ya ya... i change them.... is there a row count function in postgres and is there a writetoCLOB funciton in postgres

To count rows you can use agregate function COUNT(*). There isn't CLOB type in Postgres so there is no writetoCLOB function. If I'm right you can implement CLOB with varchar.
Newbie
 
Join Date: May 2008
Posts: 27
#8: Jun 5 '08

re: Can postgres functions return multiple values???


oh ok ok..thanks for all the help... it was really helpful.. thank u very much
Reply