How dynamically update the role of oracle using the trigger

How dynamically update the role of oracle using the trigger:

I have svmanger owner of schema in the database. There are five tables belonged to svmanager.

Table A, B, C, D, E.

I have a role that is played only to these tables under the scheme: SVMANAGER_READ_ONLY

now, if I create a new table F under svmanager. the role that svmanager_read_only does not work is updated, so the user had assigned role cannot access table F.

is there a way to create the trigger for this role dynamically update any when a table is created or deleted?

Thank you.

I really really really don't suggest to do this - it's a bad habit. If possible I'd just adding the grant as part of the steps to the role on the new creation of the table.
But for fun here's how you can accomplish this:

create or replace procedure execute_grant(v_ddl in varchar2)
is
begin
   execute immediate v_ddl;
end;
/
create or replace trigger catch_create_table_trg after create on schema
DECLARE

ddl_job number;
ddl_str varchar2(50);
begin
   IF ora_dict_obj_type = 'TABLE' THEN

       ddl_str := 'GRANT SELECT ON '||ora_dict_obj_owner||'.'||ora_dict_obj_name||' TO SVMANAGER_READ_ONLY';

       dbms_job.submit(job => ddl_job,
       what => 'execute_grant(''' || ddl_str || ''');',
       next_date => sysdate+(5/24/60/60));

   END IF;
end;
/

Test it

create table F (id number(1));

Validate

select * from ROLE_TAB_PRIVS where ROLE = 'SVMANAGER_READ_ONLY';

Tags: Database

Similar Questions

  • How dynamically update the menu items?

    Hello

    How can I update menuitems dynamically?

    Suppose I have an audio player that has five play, pause, resume, stop, quit option.

    so when the user select break then it can select that resume, stop or exit.play is not seen in the menu.

    Thankx

    Override makeMenu and add only the items you need based on your internal state.

  • How to update the model of RDS for Windows Server 2012 collection?

    Hi team,

    I want to know how to update the collection of RDS model (model master sysprep) which is used to create the collection?

    I tried the below way but did not get the update of the collection of virtual machines.

    -Start the image of mater of sysprep

    -install the required components

    -resysprep the image and stop it

    -East went to the RDS Collection and added new virtual machines in collection (removed the old his)

    Once created, I opened a session in the machines, but I don't see the updates (I installed some software in the sysprep image however and no is not there in the virtual machines in the pool)

    Can someone let me know if I need to create a whole collection again or the way I do it is a proper way? If it's a good way what could be the reason why I get the new installed software model sysprep image in virtual machines created in the pool, based on the model?

    How do we actually updated for security and other regular patches updated in virtual machines? In my view, we use the same approach?

    Any suggestions will be appreciated.

    Kind regards

    original title: Windows Server 2012 RDS - model Sysprep update process and collection of creation

    Hi MS Expert 2010,

     

     

    I wish that you post your question in the TechNet Forums as it is addressed to an audience of it professionals.

     

    Check out the link-

     

     

    TechNet Forums

     

    Hope this helps!

     

  • How to update the drivers NVIDIA for Pavilion dv6755el.

    Hi, I know it please tell how to update the video card driver, in which rirectory GB installed, because I stood Blue Shield and microsoft has identified that the video card driver is not updated, I followed the procedure of upgrading HP but found no drivers. ? I downloaded directly from NVIDIA updated for my card, but I can't find where the original, but the installer says C:\Nvidia... Thank you

    I don't think it's asking you where to install, it can ask for a place to decompress the files, so just say ok the location by default, he suggests. If the installation does not continue after developing files, switch to that folder where it expanded their and find the Setup, the exe file and run it.

    .

  • refresh rate... How to update the drivers for the monitor in Vista

    How to update the drivers for the monitor in Vista

    You are welcome.

    Normally, you go to the Web site of the pre-installed drivers.

    But, if you have any problems, andf Forum hardware drivers is the best place to ask.

    See you soon.

    Mick Murphy - Microsoft partner

  • How mass update the display name for a group of existing emails?

    We were recently acquired and at the end of April will undergo a change of name of company official. Is there a way to mass update the display name for all or most of the emails without manual update of each individual file in the details by email? I know how to update the name of the company in the configuration > system management > company display settings > name of the company; However, this is only the default display name for e-mail messages that are created from that moment. It is not to update existing records, as I understand it. This will be a huge pain updates of each email for each existing campaign in the program generator, so if there is a solution, please let me know!

    sc * 2799241 * tr-j' thought that this might be the case. We will make do. Thanks for your reply.

  • How to dynamically update the Position of the cursor?

    I have this Slider element:

    
    

    Sometimes I need to change the value for the user when they enter its screen. The way I do it is as follows:

    document.getElementById("slider").value = sliderValue;
    

    However, the cursor remains on the value 250. Although if I connect its value (console.log (document.getElementById("slider").value);), it shows that the value updated, but the UI is not updated or something. What should I do to solve this problem!

    The function that updates the slider is drawn to: ondomready: function (element, id, params) {...} to bb.init)

    Also, I am trying to manually change the Javascript Console of Chrome value, but this element is null. I guess it's because the ripple of load it as an iFrame internal? Any way to directly access these items in the Console?

    I don't know if it's similar, but I am facing a problem with a checkbox so where document.getElementById('myCheckBox').checked always returns false regarless of the State of the box! It makes me crazy!

    Are you using bbUI.js?  If so, it adds a setValue() function elements slider that "allows value to set and apply visual style."

    https://github.com/BlackBerry/bbUI.js/wiki/sliders

    You can see how this framework is hair of the range element dynamically looking at his source code on Github:

    https://github.com/BlackBerry/bbUI.js/BLOB/master/samples/BBUI.js#L8046-L8069

  • How to update the table by using the value of a column in a table field

    Hi all
    use APEX4.1,
    I have a tabular presentation based on the HOLIDAY table, it contains the following fields,
    Leave_id
    Employee_name
    No_of_days
    Status
    Here's the column LOV updateable status.
    Lov includes 2 values IE APPROVE and REJECT

    and I have another Table called LEAVE_HISTORY, it contains the following fields.
    Emp_name
    status
    Here whenever the ststus is updated (click the button SUBMIT) in tabular form should also be updated in the LEAVE_HISTORY of the SITUATION of the table column.

    I tried the following in the process of "WE SUBMIT AFTER CALCULATIONS AND VALIDATIONS,"
    begin
    update LEAVE_HISTORY set status= status where upper(employee_name)=upper(emp_name);
    end;
    but it is not kept up-to-date,
    When we updated through forms we can use something like this,
    update LEAVE_HISTORY set status= :P200_status where upper(employee_name)=upper(:P_200_emp_name);  <----here we are referring page item i.e (:P_200_emp_name)
    as the code above, how to run the columns in a table?
    Thank you.

    Hi Gurujothi,

    Try this,

    begin
    update LEAVE_HISTORY
    set status= :STATUS
    where upper(Emp_name)=upper(:EMPLOYEE_NAME);
    end;
    

    Brgds,
    Max

  • How to update table pl SQL by using the loop

    Assuming I don't have only one table: members_tbl which columns are: SN, FN, DB, IDDBL, FLAG, DBLCRIT

    I need to update the table if certain conditions are OK with this algorithm:

    id_dup: = 1;

    (I, 1 to Nrow (members_tbl)) THEN

    {

    ((I + 1) J to Nrow (members_tbl)) THEN

    {

    IF (members_tbl (i) .iddbl IS NULL) THEN

    members_tbl (i) .iddbl: = id_dup

    IF (((members_tbl (i). DB is members_tbl (j). DB)

    AND (UTL_MATCH.jaro_winkler_similarity (members_tbl (i). SN, members_tbl (j). (SN) > 80)

    AND (UTL_MATCH.jaro_winkler_similarity (members_tbl (i). FN, members_tbl (j). FN) > 80))

    AND (members_tbl (j) .iddbl IS NULL)) THEN

    {

    members_tbl (j) .iddbl: = id_dup;

    members_tbl (i) .flag: = 1;

    members_tbl (j) .flag: = 1;

    members_tbl (i) .dblcrit: = 1;

    members_tbl (j) .dblcrit: = 1;

    }

    }

    id_dup: = id_dup + 1;

    }

    Is there a way to write this algorithm in a pl/sql procedure? I'm relatively new to PL/SQL, and I've never written a stored procedure.

    IDDBL is a NUMBER yet, there may be several duplicate rows.  How you expect store multiple values in a single issue?

    SQL > select m.idm
    2, m.sname
    3, m.fname
    4, m.dbirth
    5, listagg (m2.idm, ',') Group (order of m2.idm) as dups
    members_tbl 6 m
    7 left join external members_tbl m2 (m.idm! = m2.idm)
    8 and m.dbirth = m2.dbirth
    9 and utl_match.jaro_winkler_similarity (m.sname, m2.sname) > 80
    10 and utl_match.jaro_winkler_similarity (m.fname, m2.fname) > 80
    11                                          )
    Group m.idm 12, m.sname, m.fname, m.dbirth
    13.
    IDM SNAME FNAME DBIRTH DUPS
    ---------- -------------------- -------------------- --------------- --------------------
    BOLOREY JEANNE 05/11/1955 126 125 223
    126 BOLLOREY JEANNE 05/11/1955 125 223
    153 BALORE GIANNE 05/11/1955
    223 ABOLLOREYY JEANNE 05/11/1955 125 126
    225 RELIABLE MARINE 25/04/1963 228 230
    228 LOW MARYANE 25/04/1963 225 230
    LOW 230 SAILOR 25/04/1963 225 228
    235 LIPARK JACQLINE 20/12/1939 237
    236 ILIPARC JACQUELYNE 20/12/1939 237
    237 LIPARC JACQUELHINE 20/12/1939 235 236
    240 RINTET MALIKA 08/07/1954
    241 GRISION RAUGER 26/10/1931 242-245
    ROGER 10/26/1931 241 GRISION 242


    245 GRESION RAUJER 26/10/1931 241

    14 selected lines.

  • How to update the table when change list item in the classic report

    Hello
    I worked with apex 4.2 and I create normal classic report with list (named loved) select a column, now I want to update the table when the user changes the list with the new value, I can't create a dynamic action to do this, I create checkbox with the primary key and the loop for check point to update the table but I can not get the value of the list item. and for more speed, the user want to do it when changing the value from the list.

    My question
    1. how to do it in javascript and get the value of the list item and update the table with the new value
    2. do I have to use the API to create the list item so I can get the value of the report item or what.





    Thank you

    Ahmed

    You can find a lot of information in this forum (and outside in google) when you search for AJAX processes and demand. However, the tutorial in the link below should be useful:
    http://www.Oracle.com/WebFolder/technetwork/tutorials/OBE/DB/hol08/apexweb20/ajax_otn.htm

    BTW, if we answer your question, don't forget to mark the appropriate post as correct. It will help all of us in the forum.

  • How to update the drivers

    How to upgrade drivers for windows 7?

    Hi John,.

    Thanks for posting in the Microsoft community.

    John, I understand you want to know the method to update the drivers on your Windows 7 computer.

    There are 2 ways you can update the drivers.

    Method 1:

    You can visit the manufacturer of the peripheral site and download the drivers for the model you own. You can then double-click on the file and install the drivers.

    Method 2:

    You can use the automatic update option in Windows to update the drivers.  Visit the link and follow the steps which provides article.

    Update drivers: recommended links

    http://Windows.Microsoft.com/en-us/Windows7/update-drivers-recommended-links

    You can also check this link for more information.

    Updated a hardware driver that is not working properly

    http://Windows.Microsoft.com/en-us/Windows7/update-a-driver-for-hardware-that-isn ' t-work correctly

    Let us know if you need additional assistance.

  • How to update the name of the provider

    We have employees and suppliers. The type of provider that "'provider used to process the payment of fees in internal employees" "

    Now we have updated the existing employee environment. Now, how to upgrade the provider with the middle name. Is there a standard competitive program updated the supplier according to the employees.

    There is an emergency room that will be shared with you earlier for standard provider, but to employees type provider, you can run 'Employee-update program'.

    This program at any time update the provider name of type used in the corresponding employee records. The program updates only the provider name (the name of the employee update).

    Two following information is not automatically updated:

    1. home and Office Supplier site addresses (update of office location and address employee home)

    2. Inactive Date field for the provider and for the sites of suppliers (updated if a termination date has been entered)

    If the program updates all records, it produces a report that lists each employee who has been updated by the program provider. It lists the previous value and the value of the new, updated. The report is sorted by provider name.

    Thank you

    Oubous khalid

    NOTE: If you consider your question/problem answered/resolved, please, rate this answer as Correct or useful.

    This will help for the rest of the guests to easily find the correct answers. Thank you!

  • How to update the table with the number management

    Hello

    I need as there is a loc_tab of the created table as below,

    CREATE TABLE loc_tab
    (
    Country_ID NUMBER,
    country_code VARCHAR2 (3),
    country_name VARCHAR2 (50).
    State_ID NUMBER,
    state_code VARCHAR2 (3),
    state_name VARCHAR2 (50).
    city_id NUMBER,
    city_code VARCHAR2 (3),
    city_name VARCHAR2 (50)
    );

    I inserted records like below,
    COUNTRY_ID     COUNTRY_CODE     COUNTRY_NAME     STATE_ID     STATE_CODE     STATE_NAME     CITY_ID     CITY_CODE     CITY_NAME
    
              IND          INDIA                    TN          TAMIL NADU          CHN          CHENNAI
              IND          INDIA                    TN          TAMIL NADU          TRI          TRICHY
              IND          INDIA                    TN          TAMIL NADU          CMT          COIMBATORE
              IND          INDIA                    TN          TAMIL NADU          MDU          MADURAI
              IND          INDIA                    AP          ANDHRA PRADESH          HYD          HYDERABAD
              IND          INDIA                    AP          ANDHRA PRADESH          SEC          SECUNDRABAD
              AUS          AUSTRALIA               QLD          QUEENSLAND          BRI          BRISBANE
              AUS          AUSTRALIA               TAS          TASMANIA          HB          HOBART
              AUS          AUSTRALIA               TAS          TASMANIA          CCE          CITY OF CLEARANCE
              AUS          AUSTRALIA               TAS          TASMANIA          BUR          BURNIE
    Now, I wanted to update the table such that all ID columns are updated with running number.

    Each ID columns should get incremented so that, for Country_ID column corresponding to "India" If country_id is 1, that there must be one for all the lines with the name as "India". Likewise for "Australia".

    In the case of State, she also has the same logic with numbers repeated until the very name of the State comes.

    For the city, it of course will hold separate ID only because the name of the city will not get duplicated.

    This update must be done in the normal way using simple SQL such as no PLSQL don't like looping, etc... is involved.

    Here are the contents of the table, and that's how the table should be updated,
    COUNTRY_ID     COUNTRY_CODE     COUNTRY_NAME     STATE_ID     STATE_CODE     STATE_NAME     CITY_ID     CITY_CODE     CITY_NAME
                                            
    1          IND          INDIA          1          TN          TAMIL NADU     1     CHN          CHENNAI
    1          IND          INDIA          1          TN          TAMIL NADU     2     TRI          TRICHY
    1          IND          INDIA          1          TN          TAMIL NADU     3     CMT          COIMBATORE
    1          IND          INDIA          1          TN          TAMIL NADU     4     MDU          MADURAI
    1          IND          INDIA          2          AP          ANDHRA PRADESH     1     HYD          HYDERABAD
    1          IND          INDIA          2          AP          ANDHRA PRADESH     2     SEC          SECUNDRABAD
    2          AUS          AUSTRALIA     1          QLD          QUEENSLAND     1     BRI          BRISBANE
    2          AUS          AUSTRALIA     2          TAS          TASMANIA     1     HB          HOBART
    2          AUS          AUSTRALIA     2          TAS          TASMANIA     2     CCE          CITY OF CLEARANCE
    2          AUS          AUSTRALIA     2          TAS          TASMANIA     3     BUR          BURNIE
    Thank you and best regards,
    Shiva
  • How to update the data of the CLI command line interface store

    Dear friends

    I use VMWare Server 2.0 on a debian linux server.

    I need to be able to update the store data from the command line, this because I put the command Refresh within a bash script.

    Of course, I know how the web management, but as you understand, I need to do from the console.

    Thanks for the answer, help or advice

    Robert

    Post edited by: FAsTec

    Hello

    Try vmware-vim-cmd.

    As in:

    vmware-vim-cmd /hostsvc/datastore/refresh
    

    You may need to add the store of data as a parameter.

    See also:

    http://www.VI-Toolkit.com/wiki/index.php/hostsvc/datastore/refresh

    Beware that your username must have good credentials to run the command.

    Hope this helps

    --
    Wil
    _____________________________________________________
    VI Toolkit & scripts wiki at http://www.vi-toolkit.com

    Writer to the blog www.planetvm.net

    Twitter: @wilva

  • Dynamically update the visibility

    Is it possible within the OPA to be updated dynamically from the elements without first clicking on validate and move on to the next screen?

    Although I can strategically day from pages of the first selections, in some cases this extremely Miss and requires you to have several pages for a small number of areas.

    Is there a work around for this? Or it will be added to the feature?

    Hi 884109,

    If you use the out-of-the-box functionality, there is no way something on a screen of question OWD change dynamically without clicking on the submit button. I think it's possible with a custom of code (javascript).

    I don't think this would be added as a feature in the future because (I think?) the javascript would mean the screen no longer meets the accessibility standards that must be met with OWD out-of-the-box. (I am not sure of that last comment, so I hope someone R & D OPA can confirm).

    If you provide more information about what you do, maybe someone here could do suggest on the rationalization of the interview.

    See you soon,.
    Jasmine

Maybe you are looking for

  • Destop icon layout

    My desktop icons will not remain in the positions I select but comes down to a simple list.  How can I block the icons to my selected location?

  • New video card - no video

    Hi, I just bought one sucks tc - 105. My game performance was not satisfactory, and I tried upgrading the video card with something, I had to hang out. I installed it in the pcie slot hooked the monitor and start got no image. Tested the card on anot

  • NMH405 - recalled?

    I noticed that Amazon.com says now the NMH 405 is available for pre-order and that the element has not yet been published. Strange since I'm enjoying the product

  • Kubuntu 14.04 on a Dell Inspiron 15 series 3000, 3542

    Recently bought an Inspiron 15 series 3000, model is 3542. It comes with Windows 8.1 I want to be able to run 14.04 Kubuntu hard disk. It has no partitions. What should I do (apart from backup) to (a) wipe windows 8.1 and (b) install Kubuntu 14.04 I

  • where can I find the Vijaya police? I have it in CS5 in a PC, but not in the other.

    where can I find the Vijaya police? I have it in CS5 on a PC but not on the other. How can I get? Thank you