Implementing a user truncate a table under another user in Oracle

Source: Internet
Author: User

The requirement for TRUNCATE permissions in an Oracle document is that a table is required under the currently logged-on user, or the currently logged-on user has the permission to drop any table.

However, if the first condition is not met, the permission is too large for a user to satisfy the second condition.

Refer to the discussion on the Web, you can use the stored procedure to time.

For example, there are two users u1,u2,u1 the table TEST1A

Now want to implement U2 can truncate U1 under the table TEST1A.

You can create a stored procedure using user U1,

CREATE PROCEDURE U1.stgtruncate (table_name in VARCHAR2) as
Begin
Execute immediate ' truncate TABLE ' | | table_name;
End

The permissions of the stored procedure are then assigned to U2,

Grant execute on U1.stgtruncate to U2;

Now log in to U2, truncate the table under U1 by executing SQL below TEST1A

Call U1.stgtruncate (' test1a ');

Above.

Implementing a user truncate a table under another user in Oracle

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.