How to restrict the user(Schema) from deleting the data from a table

Hi All,
I have scenario here.
I want to know how to restrict a user(Schema) from deleting the values from a table created in the same schema.
Below is the example.
I have created a table employee in abc schema which has two values.
EMPLOYEE
ABC
XYZ
In the above scenario the abc user can only fire select query on the EMPLOYEE table.
SELECT * FROM EMPLOYEE;
He should not be able to use any other DML commands on that table.
If he uses then Insufficient privileges error should be thrown.
Can anyone please help me out on this.

Hi,
kumar0828 wrote:
Hi Frank,
Thanks for the reply.
Can you please elaborate on how to add policies for a table for just firing a select DML statement on table.See the SQL Packages and Types manual first. It has examples. You can also search the web for examples. This is sometimes called "Virtual Private Database" or VPD.
If you have problems, post a specific question here. Include CREATE TABLE and INSERT statements to create a table as it exists before the policies go into effect, the PL/SQL code to create the policies, and additonal DML statements that will be affected by the policies. Show what the table should contain after each of those DML statements.
Always say which version of Oracle you're using. Confirm that you have Enterprise Edition.
See the forum FAQ {message:id=9360002}
The basic idea behind row-level security is that it generates a string that is automatically added to SELECT and/or DML statement WHERE clauses. For example, if user ABC is only allowed to query a table on Sunday, then you might write a function that returns the string
USER  != 'ABC'
OR      TO_CHAR (SYSDATE, 'DY', 'NLS_DATE_LANGUAGE=ENGLISH') = 'SUN'So whenever any user says
SELECT  *
FROM    table_x
;what actually runs is:
SELECT  *
FROM    table_x
WHERE   USER  != 'ABC'
OR      TO_CHAR (SYSDATE, 'DY', 'NLS_DATE_LANGUAGE=ENGLISH') = 'SUN'
;If you want to prevent any user from deleting rows, then the policy function can return just this string
0 = 1Then, if somone says
DELETE  employee
;what actually gets run is
DELETE  employee
WHERE   0 = 1
;No error will be raised, but no rows will be deleted.
Once again, it would be simpler, more efficient, more robust and easier to maintain if you just created the table in a different schema, and not give DELETE privileges.
Edited by: Frank Kulash on Nov 2, 2012 10:26 AM
I just saw the previous response, which makes some additional good points (e.g., a user can always TRUNCATE his own tables). ALso, if user ABC applies a security policy to the table, then user ABC can also remove the policy, so if you really want to prevent user ABC from deleting rows, no matter how hard the user tries, then you need to create the policies in a different schema. If you're creating things in a different schema, then you might as well create the table in a different schema.

Similar Messages

  • How to move the data of a table from sqlplus to XML file

    Hi,
    Could you pls guide me how to move the data of a table from sqlplus to XML file.
    i want to do it from sqlplus rather than toad.pls help
    Thanks

    Oh..I'm in 9i.
    Try this out..and let me know.
    DECLARE
    CTX DBMS_XMLGEN.CTXHANDLE ;
    XML CLOB ;
    F UTL_FILE.FILE_TYPE;
    XMLC VARCHAR2(32767);
    BEGIN
    CTX := DBMS_XMLGEN.NEWCONTEXT('SELECT * FROM department1 ') ;
    XML := DBMS_XMLGEN.GETXML(CTX) ;
    XMLC:=TO_CHAR(XML);
    SHOW_ENVELOPE(XMLC);
    F := UTL_FILE.FOPEN('ATTACH_FILES','DEPT.XML', 'W');
    UTL_FILE.PUT_LINE(F,XML);
    UTL_FILE.FCLOSE(F);
    END ;
    Good luck!!!
    Bhagat
    null                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to update the data in sqlserver table using procedure in biztalkserver

    Hi,
    Please can any one answer this below question
    how to update the data in sqlserver table using procedure in biztalkserver
    while am using executescalar,typedprocedure getting some warning
    Warning:The adapter failed to transmit message going to send port "SendtoSql1" with URL "mssql://nal126//MU_Stage2?". It will be retransmitted after the retry interval specified for this Send Port. Details
    Please send me asap....
    Thanks...

    Hi Messip,
    A detailed error would have helped us to answer you more appropriately but
    You can follow the post which has step by step instructions, to understand how to use Stored Procedure:
    http://tech-findings.blogspot.in/2013/07/insert-records-in-sql-server-using-wcf.html
    Maheshkumar
    S Tiwari|User
    Page|Blog|BizTalk
    2013: Inserting RawXML (Whole Incoming XML Message) in SQL database

  • How to hide the data in particular table in oracle 10g

    How to hide the data in particular table in oracle 10g
    i want steps

    If its on Report u can  always hide the column - Keyfigure or Selection - Display - Hide......y do u want to have it on the report if it is to be hided in the first place?

  • How to Restrict the Rows In Pivot Table

    Hi All,
    how to Restrict the Row in the Pivot table.
    My Requirement is like this.
    i have to show the top 10 values in the pivot table but My report is show all the values.
    how can we achieve this.
    any quick solution for this appreciated.
    Thanks,
    Yogi.

    Yogi1729 wrote:
    Hi All,
    how to Restrict the Row in the Pivot table.
    My Requirement is like this.
    i have to show the top 10 values in the pivot table but My report is show all the values.
    how can we achieve this.
    any quick solution for this appreciated.
    Thanks,
    Yogi.You can't really restrict the rows in a pivot table, but you can do this:
    http://oraclebizint.wordpress.com/2008/01/17/oracle-bi-101332-pagination-in-pivot-tables/

  • How to maintain the data  into database table

    Hi,
    experts,
    how to maintain the data  into database table

    There are several ways to maintain data in the database
    1. Use table maintanance generator . You can create this using SE11 and data can be edited through SM30.
    2. Loginto  SE11 with the specified table and check the ATTRIBUTES tab. There you can set some parameters for maintaining the database. When you set Maintain database, you edit the data thorugh SE11 it self
    3. Through Se16 as well.
    4. A small abap program can do the above task as well.
    Thanks,
    Raj
    Edited by: Rajanya Kolavennu on Feb 5, 2008 8:33 PM

  • How to restrict the data with Filter in Query - Updated the description

    Hi all,
    Free Characteristics: u2018Service Orderu2019 & u2018Statusu2019.
    Key Figures: u2018Response Timeu2019 & u2018Data Record Counteru2019.
    Calculated Key Figure: u2018Resp Time > 1 hru2019.
    Only u2018Plantu2019 is in ROWS and u2018Resp Time > 1 hru2019 & u2018Data Record Counteru2019 are in COLUMNS section.
    The report looks like the below:
    Plant---Resp Time > 1 hr -
    Data Record Counter
    100--1--
    2
    101--1--
    3
    After dragging the u2018Service Ordersu2019 from u2018Free Characteristicsu2019 , the report looks like the below:
    Plant---Service Order -
    Resp Time > 1 hr ---Data Record Counter
    100--111--
    1
    100--120--
    1
    101--130--
    1
    101--141--
    1
    101--150--
    1
    I want only records whose u2018STATUSu2019 is u2018Yu2019. The u2018STATUSu2019 is u2018Blanku2019 for Service Orders 12, 13 & 15
    and those records should not be there in the report.
    The report should be like the below:
    After dragging the u2018Service Ordersu2019 from u2018Free Characteristicsu2019, the report looks like the below:
    Plant---Service Order -
    Resp Time > 1 hr ---Data Record Counter
    100--111--
    1
    101--141--
    1
    After creating the Restricted KF u2018Countu2019 on u2018Data Record Counteru2019 by restricting u2018STATUSu2019 to u2018Yu2019 and
    dragging the u2018Service Ordersu2019 from u2018Free Characteristicsu2019, the Count shows ZERO :
    Plant---Service Order -
    Resp Time > 1 hr ---Count
    100--111--
    0
    100--120--
    0
    101--130--
    0
    101--141--
    0
    101--150--
    0
    If I keep the Filter (globally) on 'STATUS = Y' then it returns 'NO Data'.
    If I keep the u2018Service Ordersu2019 is in u2018Rowsu2019 and the Filter on u2018STATUSu2019 (u2018Yu2019) then it works fine, but the report should be based on PLANT.
    Thanks in advance.
    Reagrds,
    Venkat.

    Hi Gurus,
    Thanks for u r all prompt replies...
    Got the Solution...
    Actually no need to work at query level...
    iN Multiprovider.... we can select the WBS element Char for which ever cube data we want... just drop down the char in to the dimension which we need and R/click the Char select identification of participating char.. un-select the check box for char WBS element for the Cubes which we dont require the data......
    Thanks to all
    Cheers
    Lajwanth
    Edited by: Lajwanth Singh on Apr 27, 2010 10:41 PM

  • How to read the date of ZL table in schema

    Dear all,
    I want to read the record of the ZL table,and I wanted to read the date of every record in ZL table, and then choose which wage type should be used.
                                                                                    Thank you.

    Hi Simon,
    You need to write a custom function.
    Please refer to the following wiki of mine:
    http://wiki.sdn.sap.com/wiki/display/ERPHCM/CreateaCustomPayrollFunctionUpdatingZL+Table
    Regards,
    Dilek

  • How to restrict the date

    ie i want the date not to exceed 10 days if so give the error.
      like in select options   10.2.2007 to 20.2.2007 its ok . if the difference between the date exceeds 10 days it should show error. pls send the ans

    Hello,
    Do like this.
    datae: diff type i.
    at selection screen on so_date.
    read table so_date index 1.
    if sy-subrc = 0.
    diff  = so_date-high - so_date-low .
    if diff gt 10.
    " Error message
    endif.
    endif.
    If useful reward.
    vasanth

  • How to get the data in a table in horizontal order

    when i execute the command "select empno from emp" i would get the output in vertical order
    How to get the output in horizontal order

    Did you search in the forum before posting your question? Every week similar question like yours is being posted. Anyway find below the query.
    SELECT LTRIM(MAX(SYS_CONNECT_BY_PATH(EMPNO,';')),';')
    FROM
    SELECT EMPNO,ROW_NUMBER() OVER(PARTITION BY 1 ORDER BY 1) CURR,ROW_NUMBER() OVER(PARTITION BY 1 ORDER BY 1)+1 NEXXT
    FROM EMP
    START WITH CURR=1
    CONNECT BY CURR = PRIOR NEXXT
    Regards,
    Mohana

  • How to updated the data into Database table

    Hi Guy's,
    Please help me Using Tabstrip control how to updated the related infotype records into related database table.
    Thanks and Regards,
    Sai.

    Hi Guy's,
    Please help me Using Tabstrip control how to updated the related infotype records into related database table.
    Thanks and Regards,
    Sai.

  • How to insert the data system created table throuch RFC

    How can i Insert any data  system created table like MARC T100w .... throuh RFC.
    I created Funstion module.
    MY Email Address : [email protected]
                                   [email protected]

    Hello Chandan
    It is pure madness to update or modify tables like MARC or T100W directly, whether on remote systems or locally.
    If you need to update or modify such tables on remote system search for the appropriate <b>BAPI </b>(e.g. in case of MARC use BAPI_MATERIAL_SAVEDATA).
    Regards
      Uwe

  • How to filter the data in a table UI/

    hi all,
    I have to put filter  and sort functions in my table UI.can ayone please help me how to do this with a code.
    regrads,
    Sharan

    >
    But the only thing is that such function cannot be used in SQL.
    >
    Perhaps you weren't including the use of autonomous transactions?
    CREATE OR REPLACE FUNCTION remove_emp (employee_id NUMBER) RETURN NUMBER AS
    PRAGMA AUTONOMOUS_TRANSACTION;
    tot_emps NUMBER;
    BEGIN
    SELECT COUNT(*) INTO TOT_EMPS FROM EMP3;
    DELETE FROM emp3
    WHERE empno = employee_id;
    COMMIT;
    tot_emps := tot_emps - 1;
    RETURN TOT_EMPS;
    END;
    SQL> SELECT REMOVE_EMP(7499) FROM DUAL;
    REMOVE_EMP(7499)
                  12
    SQL> SELECT REMOVE_EMP(7521) FROM DUAL;
    REMOVE_EMP(7521)
                  11
    SQL> SELECT REMOVE_EMP(7566) FROM DUAL;
    REMOVE_EMP(7566)
                  10
    SQL>

  • How to Delimit the date in a table

    Hi experts,
    A master table has fields like BEGDA and ENDAT.
    I want to delimit the records based on DATE.
    Kindly provide me some example.
    Thanks in advance for ur valuable thoughts.

    U can delimit a date for an entry or entires in a table  Ex:
    SM30 , V_T511 
    Delimit the table .......end date form 01.02.2009 tp 31.12.9999
    if this is not the issue than can you be some more clear ...

  • How to restrict the decimal entry on dynamic table in adf 11 .6

    Hi All,
      JDev version 11.6
      I have a usecase based on dynamic VO. How to restrict the decimal numbers on table columns . When user enter the decimal number .I have to show error message.
      In order to achieve above requirement .I have added value change listener on table column .its not working as expected
    <af:table rows="#{bindings.EmployeeDynamicVO.rangeSize}"
                      fetchSize="#{bindings.EmployeeDynamicVO.rangeSize}"
                      emptyText="#{bindings.EmployeeDynamicVO.viewable ? 'No data to display.' : 'Access Denied.'}"
                      var="row" rowBandingInterval="0"
                      value="#{bindings.EmployeeDynamicVO.collectionModel}"
                      selectedRowKeys="#{bindings.EmployeeDynamicVO.collectionModel.selectedRow}"
                      selectionListener="#{bindings.EmployeeDynamicVO.collectionModel.makeCurrent}"
                      rowSelection="single" id="t1"
                      styleClass="AFStretchWidth" autoHeightRows="-1"
                      columnStretching="last" contentDelivery="immediate" >
              <af:forEach items="#{bindings.EmployeeDynamicVO.attributeDefs}"
                          var="def">
                <af:column headerText="#{bindings.EmployeeDynamicVO.labels[def.name]}"
                           sortProperty="#{def.name}" id="c1">
                  <af:inputText value="#{row[def.name]}" id="ot1"
                                valueChangeListener="#{backingBeanScope.EmployeeBean.validateINputs}"
                                autoSubmit="true">
                    </af:inputText>
                  <af:outputText value="#{row[def.name]}" id="ot6"
                                 visible="#{def.name eq 'Dummy'}"/>
                </af:column>
              </af:forEach>
            </af:table>
    So appriciate if any alternatives on above usecase. Thanks in advance

    HI
    Expected :as soon as user enter the decimal values in table column , it should throw the error message in new small new window
    Getting the value change listener and validating , but its working only tab out (Because VO is dynamic )
    please suggest us any reg expression and Validators to achieve the above scenario ?

Maybe you are looking for

  • 10.4.8- dimmed screen & wireless won't work

    I downloaded the latest Mac update 10.4.8 and ever since my screen looks dim or darker. Not as bright and vibrant as it used to. I have read other posts of it looking blueish. I bet this is the same thing others are describing. In addition, my wirele

  • Want to get an iMac.  Budget - $2000.  What model should I get?

    Dear Sir/Madam, I am new to iMac.  Want to get one between $1500-$2000.  What kind of software and hardware do I need?  I had a Dell before and AT&T is my Internet service provider.  I also connect the modem to my HDTV for videostreaming.  I have a H

  • To Get current System Name / Machine Name

    Hi all, Is there any thing to get the current System Name or Machine Name In PL/SQL? Thanks in advance. Regards, GowriShankar.N

  • The New Flash Player Is Downloading Flash 9.0

    I have downloaded Flash Player 10.1 & the link is downloading 9.0. Why hasn't anyone fixed this problem in the link?

  • Re: Issues in first bootup of laptop

    I have just purchased a Satellite Pro L500D series notebook, and have tried booting it up for the first time. However, when Windows began, it asked for a username and password, and I have set none as this was the first time I had started the laptop.