René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
Cursors with parameters | ||
create table tbl ( i number, c varchar2(10) ); insert into tbl values(1,'foo'); insert into tbl values(4,'foo'); insert into tbl values(2,'bar'); insert into tbl values(3,'foo'); insert into tbl values(5,'bar'); create or replace function max_of_tbl(val in varchar2) return number as cursor cur(v varchar2) is select max(i) from tbl where c = v; ret number; begin open cur(val); fetch cur into ret; close cur; return ret; end; / Links
See also other types of cursors.
|