[SQL] how to write cursors

2012-04-04 Thread La Chi
hi every one i have created this simple function which returns a column of table , i have used simple SELECT statement , i simply want to know how can i achieve the same task with the help of cursor CREATE OR REPLACE FUNCTION foo(id int) returns table(cust_id int) as $BODY$ BEGIN         retur

[SQL] Cursor Error

2012-04-03 Thread La Chi
Hello every one i have created this function to test cursors , but when i execute this funtion it give me this error , how can i fix this error CREATE OR REPLACE FUNCTION foo(custid int) returns table(userid int) as $BODY$ DECLARE rs cursor for Select customer_name from customer; BEGIN fetch f

[SQL] How to write cursors

2012-04-03 Thread La Chi
Hello everyone, i have created this function in which i simply want to display a column values through a cursor , but unfortunately i am not getting the column values , this function is showing me simple column name but not the  fields in column. CREATE OR REPLACE FUNCTION foo(id int) returns t