简体   繁体   中英

How to alter table for a particular user? [SQL Oracle]

In SQL Developer, under one connection, we can have many users. Right now, I am trying to alter a table for a particular user but I have been failing to do so.

Here is my code:

ALTER TABLE USER_NAME.VIEW_NAME
ADD new_view_column VARCHAR(250),
ADD CONSTRAINT FOREIGN KEY(new_view_column) REFERENCES USER_NAME.REFERENCE_TABLE_NAME(reference_column);

If there is already similar question asked, can you help give me the link? Sincerely, I have been searching high and low but haven't got anywhere.

Otherwise, please advice me on this matter. Thank you.

SQL Developer will let you see any objects you have select privileges on; that does not mean you can modify the objects, and maybe not mean you can modify the data they contain.

To alter another user's table you need to have been granted the alter any table privilege , either directly to your user or via a role.

The "any" privileges are powerful though and should only be granted if really needed - which is true of any privilege of course, but particularly of those that might let a user cause problems outside their own schema.

Unless it is really necessary for your user, in a DBA-type role, to make changes elsewhere then the owner of the object should make any changes to it themselves. If you have the credentials for that schema you can just create a new connection with those, and will then be able to make changes directly as that user.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM