In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1. Establish the main user test table test data sub-user
--Master Data User
create user mainuser identified by oracle;
grant connect,resource to mainuser;
--wh sub-user
create user whuser identified by oracle;
grant connect,resource to whuser;
--SW Sub-users
create user swuser identified by oracle;
grant connect,resource to swuser;
--Test sheets and data
create table mainuser.maintab(name varchar2(20),salary number(8,2),DEP_ID number(8,2));
insert into mainuser.maintab values('whuser',5000,1);
insert into mainuser.maintab values('swuser',3000,2);
--Table Assign Permission
grant select on mainuser.maintab to whuser;
grant select on mainuser.maintab to swuser;
2. establishing control function
create or replace function main_fun
(owner varchar2,objname varchar2) return varchar2
is
v_where_clause varchar2(2000);
begin
v_where_clause :=' upper(name)=' || '''' || sys_context('userenv','session_user') || '''';
return v_where_clause;
end;
/
3. Create rls strategy
BEGIN
dbms_rls.add_policy(object_schema => 'mainuser',
object_name => 'maintab',
policy_name => 'main_rlw',
function_schema =>'mainuser',
policy_function => 'main_fun',
statement_types =>'select',
sec_relevant_cols=>'salary');
END;
/
4. verification
SQL> connect swuser/oracle
Connected.
SQL> select * from mainuser.maintab;
NAME SALARY DEP_ID
-------------------- ---------- ----------
swuser 3000 2
SQL> connect whuser/oracle
Connected.
SQL> select * from mainuser.maintab;
NAME SALARY DEP_ID
-------------------- ---------- ----------
whuser 5000 1
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.