Help with column-level RLS

So I've started trying column-level RLS. But I don't know how to write the Function. Can somebody help?
I want users in the same office and dept to see full details about the employees in their office, but masked fname, lname, salary of employees in other offices and depts.
-- Table:
'emp' contains columns: fname, lname, address, city, office, dept, position, salary
'user' contains columns: username, office, dept
-- Policy:
BEGIN
DBMS_RLS.ADD_POLICY(object_schema=>'appschema',
object_name=>'emp',
policy_name=>'emp_privacy_policy',
function_schema=>'appschema',
policy_function=>'emp_privacy',
sec_relevant_cols=>'lname, fname, salary',
sec_relevant_cols_opt=>dbms_rls.ALL_ROWS);
END;
-- Function:
CREATE OR REPLACE FUNCTION emp_privacy (username IN VARCHAR2, office IN VARCHAR2, dept IN VARCHAR2)
RETURN VARCHAR2 AS
con VARCHAR2 (200);
BEGIN
con := 'dept = (select dept from USER where username = nvl(v(''APP_USER''),USER) AND office = (select office from USER where username = nvl(v(''APP_USER''),USER)';
RETURN (con);
END emp_privacy;

Look at the demos in Morgan's Library under DBMS_FGAC at www.psoug.org.
Then just follow the examples to build your own.

Similar Messages

  • Please help with column float problem in IE8

    Hi there,
    Sorry to be so pushy - but I am desperate for help!!
    Having serious problems with my site in some PC's showing Internet Explorer 8. My right column floated right is moving down the page underneath the left column..
    It shows fine on IE8 on my PC - however on my clients PC (vista with IE8) it is showing up as mentioned above. Is there a fix for this.
    Here is my link http://www.dooks.com/pgs/welcome.html
    The css is all there! If you need anything please let me know as I need to get this sorted - I have had serious issues with this site that I have never had before with other sites and am starting to think there is a bug in my software. I redid the index page and this one page (linked above) to see what my problems are - so help with query v appreciated.
    Many thanks,
    Karen

    Lawrence_Cramer wrote:
    A point to keep in mind is that IE8 is still in Beta.
    Not anymore.
    http://www.microsoft.com/Presspass/press/2009/mar09/03-18IE8AvailablePR.mspx
    "REDMOND, Wash. — March 18, 2009 — Today Microsoft Corp. announced the availability of Windows Internet Explorer 8, the new Web browser that offers..."
    Mark A. Boyd
    Keep-On-Learnin' :-)

  • Help with Skip Level dimensions in OWB 10.2 (Paris)

    Hi all,
    I'm trying to understand how to set up and use a skip level dimension in OWB 10.2. A simplified version of my hierarchy would be:
    Plant - Equipment - Assembly - Item
    Where Some Items connect directly to equipment and others connect to assemblies. How sould I define this in the Dimension wizard or editor in OWB?
    Can I create a single dimension hierarchy and in the Item level put Skip Level as "Equipment"?
    OR
    Do I need 2 hierarchies - one Plant-Equipment-Assembly-Item and the other Plant-Equipment-Item?
    There is an example in the Users guide that created 2 hierarchies -
    TOTAL-GROUP-PRODUCT and TOTAL-PRODUCT
    In the example, they show the PRODUCT in TOTAL-PRODUCT setting the skip level field. I don't understand why that is necessary if it is 2 seperate hierarchies.
    Any help/guidance would be appreciated!
    Thanks,
    Mike

    Hi Donna,
    Perhaps JP can expand on his answer. In my case, I did go the route of seperate hierarchies. It is a bit of work defining multiple hierarchies and my example was much simplified. We actually have about 8 levels in the primary hierarchy and 6 levels in the second. It does work well with the cubes by using 2 roles for the dimension - one for each hierarchy.
    I saw that truly "ragged hierarchies" or "level hierarchies" can be defined in OWB and deployed as MOLAP but MOLAP has quite a few drawbacks - no SCDs and requires analytic workspaces etc. I haven't done anything with these yet.
    Our data is a classic manufacturing Bill of Material so the level hierarchy would be the easiest to manage, though I'm not sure how easy it would be to report on! I do want to shield my end-users from CONNECT-BY madness.

  • Need help with folder level javascript to automate "save button" on a fillable form

    I have been racking my brain for the past 6 hours trying to get a simple save button to work.
    Background: I am using Acrobat Pro 11 to create a save button on a fillable form. My intent is for the end users (my team of 3, whos computers I have access to) to be able to fill out the form, click save, and have the filename appended with date and other info and saved to a local folder on their machine.
    I am attempting to take the default form name i.e. Support Call Log.pdf and have three of the feilds within the form generate a new file name. --> Support Call Log_Brad_121_2015
    End users will fill out the form using adobe viwer X.
    Instead of putting the code that I have tried, modified, and tried again and again. I would like to ask for a fresh start and then see if I can locate my error after. I need to know what to put in my folder level script, line for line.
    I also need to know the correct syntax and format to establish a new file name with the extracted feild data, saved to the same exact file path as the original document.
    Any and all help will be greatly appreciated, I am about to go crazy!!!

    Didn't let me do it, invalid. So, here is what I have now changed my button code to:
    //get field value
    var fv1 = getField("Technician:").value;
    var fv2 = getField("Date Received:").value;
    var fv3 = getField("Unit Number:").value;
    // Split Path into an array so it is easy to work with
    var aMyPath = this.path.split("/");
    // Remove old file name
    aMyPath.pop();
    var NewFileName = "Support Call Log" + "_" + fv1 + "_" + fv2 + "_" + fv3 + ".pdf";
    NewFileName = NewFileName.replace(/[\s\!\?\<\>\'\"\*\/\\\=\?\^\`\{\}\|\~]+/g, "_");
    aMyPath.push(NewFileName);
    //save
    mySaveAs(this,aMyPath.join("/"));
    Im still getting the error dialogue box, and nothing shows in my javascript debugger window when I click the button. Seems to be something goofy with my Folder level script:
    var mySaveAs = app.trustedFunction(
         function(oDoc, cPath, cFlName)
              cPath = cPath.replace(/([^/})$/, "$1/");
              try{
                   oDoc.saveas(cPath + cFlName);
                   catch(e){
                                  app.alert("Error During Save");

  • Need help with column formatting (see image)

    I am trying to make a spreadsheet that calculates proportional image sizes of a fixed original size. I have it set up so you enter an original size on the left (see image below) and the spreadsheet calculates the proportional sizes on the right (in the pink column). I would like to know how to get Appleworks to re-list the proportional sizes while omitting the size pairs that = 0. Basically i want to display the proportional sizes in a new column without the zeros. This way the proportional sizes list is much smaller and easier to read.
    Thanks for any help
    morgan
    g5   Mac OS X (10.4)  
    g5   Mac OS X (10.4)  
    g5   Mac OS X (10.4)  

    Part 2
    The method indicated in your original spreadsheet, and after the refinements suggested earlier, is essentially a sieve—calculate all the values, then strain out the chaff (ie. the results with non-integer values for one or both dimensions).
    A more efficient approach is to calculate and display only the cases where both dimensions are integers.
    Here's one way. You may want to move some of the calculations and revise the formulas accordingly.
    Data Entry:
    Cells B4 and C4 are used for data entry, as in the original.
    Initial calculation: Find the LCF (largest common factor) Columns J, K, L and cell M1.
    J1: =(B$4/ROW())=INT(B$4/ROW())
    K1: =(C$4/ROW())=INT(C$4/ROW())
    L1: =IF(J1+K1=2,ROW(),"")
    Fill these three columns down to the largest short side dimension you expect to use (ie. if you'll use 39 x 78 inch original images, fill down to row 39).
    What the formulas do:
    J1: The ROW() function returns the number of the row in which the formula is located. B$4/ROW() divides the number in B4 by the number of the row. INT(B$4/ROW()) does the same division, then strips off any fractional part of the result. The second = sign is a comparison operator. The formula compares the results of the parts on each side of the sign and, if they are equal, returns TRUE (or 1), and if they are not equal, returns FALSE (or 0).
    For the example (6), the formula would return TRUE in rows 1, 2, 3 and 6, marking the four factors of 6.
    K1: Does the same, but for the number in C4.
    For the example (8), the formula returns TRUE in rows 1, 2, 4 and 8, marking the four factors of 8.
    L1: This IF() formula checks for common factors. If the cells in both columns (J and K) in a particular row contain TRUE (ie. the number of that row is a factor of both the number in B4 and the number in C4), then the sum of the two cells will be 2 (TRUE=1, FALSE=0, TRUE + TRUE = 2), and the formula will return the result of the ROW() function (ie. the number of the row). For any other result, the formula will return 'empty' (ie. what's between the two double quotes "" ).
    For the example, cells L1 and L2 will contain 1 and 2 respectively; the rest of the cells in column L will be empty.
    M1: =MAX(L1..L39)
    M1: This formula completes the search by picking off and returning the greatest number in column L, or the Largest Common Factor for the two numbers. Adjust the second cell reference in the formula to reflect the largest original image size you'll use.
    Final Calculations
    D4: =B$4/$M$1*(ROW()-3)
    E4: =C$4/$M$1*(ROW()-3)
    D4: The formula divides the number in B4 by the LCF determined above to determine the size increment that will give integer results for both dimensions of the final image(s). It then multiplies that increment by 1 in row 4, by 2 in row 5, by 3 in row 6, and so on, for as many rows as you wish. The -3 in the second part of the formula is an offset to make the value of the multiplier three less than the row in which the formula is located.
    E4: Same formula, but acting on the number in C4.
    The first five results for the example ( 6 and 8) are:
    3 4
    6 8
    9 12
    12 16
    15 20
    and for a 4 x 6 initial image:
    2 3
    4 6
    6 9
    8 12
    10 15
    Regards,
    Barry

  • Help with Column Link

    Using APEX 3.2.1
    I have an updatable report where I have a column link (using edit icon) on one field. This is a 4000 char field so I want to go to another page where the users can easily read and/or update the field. This works and the field can be updated on the new page (with submit). However, when you branch back to the original page after the submit and then modify another field, you get the error
    Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-20001: ORA-20001: Current version of data in database has changed since user initiated update process. current checksum = "1E30D234E78C21CE2B8BC54798889D9C", item checksum = "0E8201F749D53031EB3F3C557B50D387".,
    Even if I get out of the updatable report or log off and on in, I still get the error. I thought maybe I could just bring the field value back to the originating page and do a submit from there, but not able to bring the value back without doing a submit.
    Any ideas/help would be really appreciated!
    Thanks,
    Sandie

    Hi ,
    y dont u create the another field in the chhild table and dont use it in this table ,
    or create view and mintain a foriegn with child and parent relation and then create the master detail form ,
    as in ur case the report is displayed iwth older value hence given error when page is submited .
    Else
    u can use the functions md5 etc.,, to mainatain the consistency.
    Regards,
    Nandini

  • Need help with recording level!

    Hi,
    I am writing a tune on Garage Band. I have recorded several tracks. A few with hardware, a few with soft synths. I find I cannot adjust the recording level with the slider now (soft synth parts only). It seriously needs to be reduced, otherwise it sounds terrible. The slider simply wont move. Something must be wrong. Any ideas?
    HELP!

    Ratty, at some point you must have set a point on the volume curve by accident, that and/or setting a pan curve point are the only two things that will disable the volume (and pan) controls)
    Good to hear the issue is no longer a problem. Have Fun --Hang B-)>

  • JTable - Help with column names and rowselection

    Hi,
    Is there anyone that can help me. I have successfully been able to load a JTable from an MS access database using vectors. I am now trying to find out how to hardcode the column names into the JTable as a string.
    Can anyone please also show me some code on how to be able update a value in a cell (from ''N'' to ''Y'') by double clicking on that row.
    How can I make all the other columns non-editable.
    Here is my code:
         private JTable getJTable() {
              Vector columnNames = new Vector();
    Vector data = new Vector();
    try
    // Connect to the Database
    String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
    // String url = "jdbc:odbc:Teenergy"; // if using ODBC Data Source name
    String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:/Documents " +
              "and Settings/Administrator/My Documents/mdbTEST.mdb";
    String userid = "";
    String password = "";
    Class.forName( driver );
    Connection connection = DriverManager.getConnection( url, userid, password );
    // Read data from a table
    String sql = "select * from PurchaseOrderView";
    Statement stmt = connection.createStatement();
    ResultSet rs = stmt.executeQuery( sql );
    ResultSetMetaData md = rs.getMetaData();
    int columns = md.getColumnCount();
    // Get column names
    for (int i = 1; i <= columns; i++)
    columnNames.addElement( md.getColumnName(i) );
    // Get row data
    while (rs.next())
    Vector row = new Vector(columns);
    for (int i = 1; i <= columns; i++)
    row.addElement( rs.getObject(i) );
    data.addElement( row );
    rs.close();
    stmt.close();
    catch(Exception e)
    System.out.println( e );
              if (jTable == null) {
                   jTable = new JTable(data, columnNames);
                   jTable.setAutoCreateColumnsFromModel(false);
                   jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_NEXT_COLUMN);
                   jTable.setShowHorizontalLines(false);
                   jTable.setGridColor(java.awt.SystemColor.control);
                   jTable.setRowSelectionAllowed(true);
                   jTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
                   jTable.setShowGrid(true);     
              return jTable;
         }

    this method has a default behavior to supply exactly what you're seeing: column names consisting of the capitalized letters, "A", "B", "C".Thanks Pete, had seen that but never really thought about it... about 10 days ago somebody needed to obtain Excel column names, I'd offered a rigorous solution and now see it would have been shorter and simpler (if a little heavier) to extend DefaultTableModel and provide the two additional methods needed (getOffsetCol and getColIndex).
    Not much of a difference in LOC but certainly more elegant ;-)
    Darryl

  • Help with column resizing

    Hi,
    Relatively new to java swing...
    I have a JTable inside a JScrollPane that gets filled dynamically. What I would like to happen is to set a min column width, and then have each column be large enough to fit its largest cell (by largest cell I mean the cell in the column that has the most data to display). If this is too large for the pane, a scrollbar should come up. Right now I am using
    setAutoResizeMode(JTable.AUTO_RESIZE_OFF);but the column sizes are showing up only as big as the column headers need to be, and then for the other cells in the column i get some of my data followed by "..." It lets me manually resize the columns so that everything looks OK, but I would rather have it start out this way
    Thanks for any tips...

    but the column sizes are showing up only as big as the column headers need to be,The size of the header has nothing to do with the size of the column. The column width defaults to 75 pixels. If you want to change the size then you need to manually calculate the width of the column.
    Read the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#width]Setting Column Widths. Then check out [url http://www.exampledepot.com/egs/javax.swing.table/PackCol.html]Packing a Column.

  • Need help with multi-level categorization

    Hi,
    We have the following scenario:
    A complaint has a subject profile with two catalogs:
    1. Problem - 60 problem codes
    2. Solution - 30 solution codes
    Each catalog has code groups and codes assigned as above.
    In GUI we can address this using the catalogs, code groups and codes under "Analysis" tab at complaint header / item level. However, we want to switch over to categorization schema in CRM 7.0 Webclient UI.
    I tried creating a categorization schema in Web UI. However, if I understand correct, for each of the 90 codes (60 + 30 mentioned above) I need to a add category id under the root schema id and assign a subject code under the general data of the category (while maintaining the category hierarchy). Is this true? I really cannot do it since I have already created the catalogs with the mentioned number of codes under the relevant code groups. Isn't it a duplication of effort? Whats the whole point of creating subject profiles / catalogs / code groups / codes if it has to be redone in webclient's categorization schema? Moreover, every time I add a problem code (say number of codes become 61 from 60), do I need to change the schema and release it again?
    I believe there would be a simpler way to do it.
    My exact requirement is:
    1. I want to use only the first two drop downs of the categorization view in complaints component
    2. First drop down to have all the problem codes (60 of them)
    3. The second drop down to have all solution codes (30 of them).
    Request the gurus to provide the exact steps to achieve this (_details in terms of exact steps will be appreciated and suitably rewarded_). Please note that the customizing in terms subjects, catalogs, code groups, codes etc is already in place.
    Regards,
    DP

    Hello DP,
    we have in sum 4 categorie-fields in the service request.
    And we did it like you explained it. First customizing of code / codegroups, etc.
    Afterwards you have to create the categorization schema in WebUI.
    And yes, everytime we add a code we need to change the categorization schema as well.
    We maintain categorization schema in WebUI only in TCR and we use the RFC-Import for the QCR and PCR system.
    You are right this is a duplication of effort. In our case it is needed because we use the SLA determintation based on catogorization and we have multilevel categories, which means depend from catagory A we have different entries in category B.
    If you just need two dropdown boxes idependently from each other i would suggest to create to customer own fields with z-table behind. That´s much less effort if you often add or delete codes.
    Best regards
    Manfred

  • Help With FGAC (VPD, RLS...)

    Hi all.
    I'm trying to create a Discoverer Trigger to implement FGAC. The point is:
    Discoverer DEMANDS you to create a DB function without any argument, returning integer (that won't be used anywhere), and register it in Disco. Adm. Edition. This is the easy part.
    Then I created two db. functions. The first one configures Policies (INFO_SEC). The second one (this is the one I try to invoke in discoverer - EUL_TRIGGER$POST_LOGIN), simply creates the policy using DBMS_RLS package.
    SQL> create or replace function info_sec( p_schema in varchar2) return varchar2
      2  as
      3  v_user varchar2(30);
      4  begin
      5  select sys_context('USERENV', 'SESSION_USER')
      6   into v_user
      7  FROM DUAL;
      8    if (v_user = 'DWH_ADMIN' ) then
      9      return '';
    10    else
    11      return 'upper(nm_emp) = '||v_user;
    12    end if;
    13  end;
    14  /
    Function created.
    SQL> create or replace FUNCTION EUL_TRIGGER$POST_LOGIN RETURN INTEGER
      2  as
      3  begin
      4  dbms_rls.add_policy
      5  ( object_schema   => 'DWH_ADMIN',
      6  object_name     => 'EMP_T',
      7  policy_name     => 'POL_EMP',
      8  function_schema => NULL,
      9  policy_function => 'INFO_SEC',
    10  statement_types => 'select, insert, update, delete' ,
    11  update_check    => TRUE );
    12   RETURN(10000);
    13  end;
    14  /
    Function created.
    SQL> select EUL_TRIGGER$POST_LOGIN FROM DUAL;
    select EUL_TRIGGER$POST_LOGIN FROM DUAL
    ERROR at line 1:
    ORA-14552: cannot perform a DDL, commit or rollback inside a query or DML
    ORA-06512: at "SYS.DBMS_RLS", line 308
    ORA-06512: at "DWH_ADMIN.EUL_TRIGGER$POST_LOGIN", line 4I understand this is due to the insert that dbms_rls tries to perform in order to create the policy.
    My question is if anyone has an alternative for setting this using pl/sql. I need to set the RLS policy in discoverer only, so, i MUST use Discoverer Triggers.
    If you need more info about Discoverer Triggers, you cand find it in:
    http://www.huihoo.com/oracle/docs/B25016_04/doc/dl/bi/B13916_04/appendix_b.htm
    Anything you guys input here will be highly appreciate!
    Regards,
    Marcos

    You do not want any part of a system which intends to apply different FGAC policies to the same Oracle user based on the application they are using. Assuming you managed to set things up so that each application was setting up its own FGAC policy, FGAC policies apply to the instance. So the policy that would apply to the Discoverer session, for example, could change when some other application created a session and set its own policy. This is a disaster waiting to happen.
    Your policy function could look at information about the session to try to determine the application being used and tailor the policy accordingly. This is generally a bad idea since this information is being passed in by the client, meaninging that it is relatively easy to spoof a different application.
    Justin

  • Help with column source_action_id in table pay_assignment_actions

    I've searched all over and cannot find the true meaning of column source_action_id in table pay_assignment_actions. More to the point, I've inherited code that runs a relatively simple query to retrieve all specific payroll dates from pay_payroll_actions based on effective_date being between a date range. These dates are then used to pull 401k balances for the effective date. In this query, pay_payroll_actions is joined onto pay_assignment_actions solely to verify that for a given payroll, source_action_id is NOT null. If it is null, the query will not consider it for the 401k query.
    I've found at least two records in pay_payroll_actions that should have been retrieved for our 401K process that were not retrieved based on that source_action_id being NULL. Can someone provide guidance on what would cause that column to not be populated? Was there possibly a step missed in our payroll process?
    Thanks

    Thanks for the reply.
    It turned out that within that "large chunk of SQL", there was a package call that wasn't returning the expected results... which mucked up the rest of the SQL call.
    Apparently it was a permissions issue in that the package didn't like to be called from JDBC; but would work fine out of SQL*Plus. Have you heard of this?
    I ended up just throwing the first package call into an an anonymous PL/SQL block, and then doing the SQL call... both in SQLJ. Only because the app is throw-away. Otherwise I agree: it would have been better in a stored procedure/function.

  • Jtable need help with column name

    hi, i'm currently working on a project where my jtable grab data from the database.
    as for the where clause i am thinking if i can get the column name as the field name in the table. However, I would like to hide the field name from the user.
    So, I'm here to kindly ask if there is a way that i can display the column name that is hidden from the field name.
    thanks in advance.

    actually, I am thinking of a lazy way to add the 'where' clause for my sql statement.
    so, instead of detecting which column that is related to the field i can just use the columns header name as my field. But on the other hand, I'd like to hide my field name from the user .
    For say my field name is "emp_no" but it is displayed as "Employee No" to the user. and when i do my sql statement i can do something like this:
    select * from emp_details where + jtable.getcolumnname(i).tostring() + = jtable.getvalueat(j,i)
    is there a way i can do it so???
    thanks again. and thanks for the reply

  • Need Help with Column Masking

    Hi All,
    I am looking for Masking options/techniques to mask few columns.
    I am aware of the option Oracle Data Masking Pack. But its costly. Can you please suggest some other way/technique using which I can achieve this?
    Thanks in Advance

    You can always try manual masking using datapump and sql and pl/sql (export original data and then create function that will put some random/other data instead of real ones). I have seen some clients that have implemented this type of masking. However, be aware that this will not give the best results, and that it will not come anywhere near quality of Oracle Data Masking Pack's masked data.
    Zoran

  • Need help with audio levels

    What is the best way to level out the audio throughout my entire project. I want all my clips audio levels to fall within the same range.

    Take it into STPro and 'normalize' it, or boost all levels, then put a compressor filter on it.
    I use the following settings on the compressor filter...30/3/10/500. You may need to tweak those for optimum sound.
    K
    EDIT - my bad...that's -30 on the threshold
    Message was edited by: Kevan D. Holdsworth

Maybe you are looking for