Resolving ORA-O4O89: Unable to create trigger for objects owned by sys

Source: Internet
Author: User

During the past two days, Oracle triggers are learned. When you create a trigger, you may encounter an error message "you cannot create a trigger for objects owned by sys.

User logon is a self-created new user XXX login, and then XXX user creates a tablespace named MECITY, create a table named citys in the mecity tablespace under the XXX user.

Then, create a trigger for the CITY table so that the ID column of the table is automatically increased by 1 each time data is inserted.

Trigger creation statement:

Create trigger TRI_CITY_ID

BEFORE INSERT ON CITYS

FOR EACH ROW

BEGIN

SELECT CITY_ID.NEXTVAL INTO: NEW. id from citys;

END;

Error prompt: ORA-O4O89: unable to create a trigger for objects owned by sys.

First, find the table in tables and right-click the table to view its properties, which contains the owner. In this case, the owner must be sys.

The following provides a solution:

Create a table with the same name as the table for the current login user, and copy the data from the table sys. For example:

Create table xxx. citys as select * from sys. CITYS;

Delete the table under sys.

Drop table sys. CITYS;

Then execute the create trigger statement.

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.