you can do this with a function that returns a refcursor.
(lookup refcursor in the docs)

you would call it something like this

select mycursorfunct();
fetch all from return_cursor;

In this example I hardcode the name return cursor and then call both lines from a transaction.

you could also retrieve the name of the cursor into a variable, then do something like(this is delphi code)

connection.starttransaction;
try
query1.sql.add('select mycursorfunct();');
query1.open;
refcursorname:= query1.fieldbyname('mycursofunct').asstring;
query1.close;
query1.sql.add('fetch all from '+refcursorname);
query1.open;


finally
    connection.commit;
end;


You won't be able to do it exactly like M$ SQL server, but you can do something equivelent with a couple extra lines of code.

A refcursor takes a couple of more lines of code on the client, but you don't have to use a type or a record.

If you need a actual test function, let me know.


hope this helps,

Tony Caduto
http://www.amsoftwaredesign.com
Home of PG Lightning Admin for Postgresql 8.x



CREATE PROCEDURE test(
 @lookup char(50))
WITH ENCRYPTION AS BEGIN

-- ... a bunch of code to do some lookup, and then ...

SELECT
  @Result1 AS Result1,
  @Result2 AS Result2,
  @Result3 AS Result3,
  @Result4 AS Result4

END
GO





---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

              http://www.postgresql.org/docs/faq

Reply via email to