Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Sub query base on security table
I am using oracle9i.
I am seeking tips on following:
I have a table with million rows. I want to restrict the rows by
user_id.
Eg.,
The main table has following structure:
tbl_a (year,entity,dept,bal)
And the security table has following structure: tbl_s(login_id,entity1,entity2,entity3)
The rows in main table is restricted based on the values in security
table.
E.g,
the values in main table are as:
2005,A,HR,200 2005,B,IT,100 2006,A,HR,20
abc,A,C,E efg,B,D,F xyz,C,H,K
The user 'abc' can only allow to see the rows that 'entity' in the main
table should match with 'entity1' or
'entity2' or 'entity3' in the security table
I write query as:
SELECT * from tbl_a where exists
(SELECT * from tbl_s where login_id=USER)
but it returns all the rows without restriction.
Your advice and tips are highly appreciated.
Thks. Received on Tue Oct 24 2006 - 22:26:46 CDT
![]() |
![]() |