|
Function&Set
|
|||
---|---|---|---|
#18+
Подскажите кто в курсе как сделать чтобы функция позвратила набор данных без курсора(есть какой-то Set). И как прицепить тип %RowType или record на результат - returns users%rowtype не прокатывает ... |
|||
:
Нравится:
Не нравится:
|
|||
18.11.2003, 03:26 |
|
Function&Set
|
|||
---|---|---|---|
#18+
Посмотрите в доках 'Server Programming' => 'Extending SQL' => 'Query Language (SQL) Functions' => 'SQL Functions Returning Sets'. CREATE TABLE foo (fooid int, foosubid int, fooname text); INSERT INTO foo VALUES (1, 1, 'Joe'); INSERT INTO foo VALUES (1, 2, 'Ed'); INSERT INTO foo VALUES (2, 1, 'Mary'); CREATE FUNCTION getfoo(int) RETURNS SETOF foo AS ' SELECT * FROM foo WHERE fooid = $1; ' LANGUAGE SQL; SELECT * FROM getfoo(1) AS t1; fooid | foosubid | fooname -------+----------+--------- 1 | 1 | Joe 1 | 2 | Ed (2 rows) ... |
|||
:
Нравится:
Не нравится:
|
|||
18.11.2003, 13:20 |
|
|
start [/forum/topic.php?fid=53&msg=32327357&tid=2008044]: |
0ms |
get settings: |
10ms |
get forum list: |
12ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
59ms |
get topic data: |
7ms |
get forum data: |
2ms |
get page messages: |
41ms |
get tp. blocked users: |
1ms |
others: | 15ms |
total: | 153ms |
0 / 0 |