CodeListing 2: The policy function for getting authorized cust_ids

create or replace function get_sel_cust_id
(
   p_schema in varchar2,
   p_table in varchar2
)
   return varchar2
as
   l_retstr varchar2(2000);
begin
   if (p_schema = user) then
      l_retstr := null;
   else
      for cust_rec in
      (
         select cust_id
         from access_policy
         where am_name = USER
         and access_type = 'S'
      ) loop
         l_retstr := l_retstr||','||cust_rec.cust_id;
      end loop;
      l_retstr := ltrim(l_retstr,',');
      l_retstr := 'CUST_ID IN ('||l_retstr||')';
   end if;
   return l_retstr;
end;

E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy