Hi, everyone
Here is my function:
create or replace function get_road_brief_by_id(id number)
return road_brief_tab as
iden number(6,0);
Name char(200);
Code char(200);
tab road_brief_tab := road_brief_tab();
cursor cur is select "ID", "Name", "Code" from XUXUEHAN."tbl_Road" where "ID" = id;
begin
open cur;
LOOP
fetch cur into iden, Name, Code;
tab.extend;
tab(tab.count) := road_brief(iden, Name, Code);
exit when cur%NOTFOUND;
END LOOP;
return tab;
end;
I intend to select only those records with "ID" equal to the paramter id. However, when I call it, it returns all the records. Where did I go wrong?
Thanks