简体   繁体   English

Oracle使用模式名称关联查询

[英]Oracle correlated query using schema names

consider the following correlated query : 考虑以下相关查询:

update CASSETTE.DB_NIM_CABLES a
set( cgb_a, cgb_z ) =
(
    select  regexp_substr( name, '[^ ]+', 1, 1 )
        ,   regexp_substr( name, '[^ ]+', 1, 1 )
    from CASSETTE.DB_NIM_CABLES b 
    where b.id = a.id
) where REGEXP_COUNT( a.name, '-' ) = 1;

This works if I run it using the CASSSETTE account, but not with any other. 如果我使用CASSSETTE帐户运行它,但不能与其他任何帐户一起运行,则此方法有效。 Why is this ? 为什么是这样 ?

It happens because probably the other users (account) with which you want to run the DML don't have the UPDATE and SELECT permission on the table. 这是因为您希望运行DML的其他用户(帐户)可能没有对表的UPDATE和SELECT权限。 So the CASSETTE user shoud grant the permission to the corresponding user. 因此,CASSETTE用户应该向相应的用户授予权限。

IE, saying that you want to run it from the OTHERUSER schema, you, should IE,说你想从OTHERUSER架构运行它,你应该

1- connect to DB with CASSETTE USER 1-使用CASSETTE USER连接到DB

2- give the permission as follows 2-如下给予许可

            grant ALL PRIVILEGES on DB_NIM_CABLES to OTHERUSER ;

PS I give all permission, it should be enough to give SELECT, INSERT, UPDATE. PS我给予所有权限,它应该足以给出SELECT,INSERT,UPDATE。

See this doc, in the part where it talks about OBJECT privileges. 请参阅此文档,在其中讨论OBJECT权限的部分。

https://docs.oracle.com/database/122/DBSEG/configuring-privilege-and-role-authorization.htm#DBSEG99868 https://docs.oracle.com/database/122/DBSEG/configuring-privilege-and-role-authorization.htm#DBSEG99868

There were duplicate tables, one in the CASSETTE-schema and the other one in GTFIBER. 有重复的表,一个在CASSETTE模式中,另一个在GTFIBER中。 I was updating the table in the GTFIBER scheme and looking for data in the other scheme. 我正在更新GTFIBER方案中的表并在另一个方案中查找数据。 Thanks for your time 谢谢你的时间

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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