cursors and only loop over one of them?
Situation: 2 Queries, one is for salaried people, one is for Hourly. Both RETURN the same data, get the same processing.
But I want the code to be able to look at the person BEFORE opening the specific cursor?
Just open the the cursor you need in an if. Or use a query for the cursor to make that cursor using dynamic SQL statements. if person = 'idiot' then query := 'select * from table1 where person = $1'; else query := 'select * from table2 where person = $1'; end if; open cur_person for execute query using person;
Обсуждают сегодня