Strongly-Typed Refcursor (PowerBuilder Datawindow Clients)

Поиск
Список
Период
Сортировка
От Matt Miller
Тема Strongly-Typed Refcursor (PowerBuilder Datawindow Clients)
Дата
Msg-id 1117130197.4616.9.camel@dbamm01-linux
обсуждение исходный текст
Список pgsql-general
I'd like a function to return a strongly-typed refcursor.  My goal is to
allow callers of the function to know, based on the function's return
type, the number and data types of the columns that it can expect in the
refcursor.  From what I see in plpgsql, all refcursors are allowed to
point to any query at all.

In particular, my caller's environment will be Sybase PowerBuilder, and
the function will be tied to a PowerBuilder datawindow.  In the past
these datawindow clients have used Oracle ref cursors, but we've
preferred that these Oracle ref cursors be strongly typed.  Oracle
defines a strongly-typed ref cursor as one that includes the 'return'
clause in the ref cursor definition.  For example, in Oracle:

----------beginning of code------------------
create or replace package x_pkg is
type x_rec is record (col1 number);
type x_type is ref cursor return x_rec;
end;
/

create or replace function x_func return x_pkg.x_type
as
cur x_pkg.x_type;

begin
open cur for select 1 from dual;
return cur;

end;
/
----------end of code------------------

This code will create a function 'x_func' that must return a ref cursor
whose query contains a single numeric column.  If I 'describe' the
function I will see that the function returns a record that contains a
single numeric column.

How can I write a plpgsql function that behaves similarly?

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Compiling Postgresql 8.0.3 on Solaris 10
Следующее
От: Himanshu Baweja
Дата:
Сообщение: maintenance_work_mem upper limit =1gb??