Can a PL/PgSQL function return a cursor?

Поиск
Список
Период
Сортировка
От Jeff Duffy
Тема Can a PL/PgSQL function return a cursor?
Дата
Msg-id 01011403014000.01201@cairhien
обсуждение исходный текст
Список pgsql-general
 I have not had any luck getting a PL/PgSQL function that returns a
cursor to compile. I've tried writing this in several forms, for
instance;

CREATE FUNCTION getcursor()
RETURNS cursor
AS
  'BEGIN
    DECLARE testcursor CURSOR FOR
      SELECT * FROM test_table;
    RETURN testcursor;
  END;'
LANGUAGE 'plpgsql';


but the parser always complains:

 ERROR:  parser: parse error at or near "cursor"

I assume this means that cursor is not a valid return type for PL/PgSQL
functions? The point of this is to map queries that return large
results sets to cursors for use in Java (through the ResultSet type).

 I'm using 7.0.3 on Red Hat 7.0.

Jeff



--
Errors have occurred.
We won't tell you where or why.
Lazy programmers.
        -- Hacking haiku

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

Предыдущее
От: "Muhammad Rusydi"
Дата:
Сообщение: update field table.....
Следующее
От: "Dan Langille"
Дата:
Сообщение: getting number of rows updated within a procedure