简体   繁体   English

Oracle SQL Developer不在触发器DDL中放入模式名称

[英]Oracle SQL Developer doesn't put in schema names in trigger DDLs

In our test environment, the schema is prepended to the trigger DDL as one might expect. 在我们的测试环境中,正如人们所期望的那样,该模式被添加到触发器DDL之前。 However, in our QA and PROD environments, the schema prefix doesn't show in the DDL. 但是,在我们的QA和PROD环境中,模式前缀不在DDL中显示。 We always connect as the "SCHEMA" user so it hasn't been a problem thus far. 我们始终以“ SCHEMA”用户身份进行连接,因此到目前为止,这并不是问题。 Is it worth updating the QA and PROD DDL's to include the schema prefix? 是否值得更新QA和PROD DDL以包括模式前缀? If we don't ever connect to the DB as a user/schema other than "SCHEMA", do we really have anything to worry about? 如果我们没有以“ SCHEMA”以外的用户/模式连接到数据库,我们真的有什么需要担心的吗?

TEST DDL: 测试DDL:

create or replace TRIGGER "SCHEMA"."MDATA_BIR_TRG" 
                BEFORE INSERT ON "SCHEMA"."METADATA"
                FOR EACH ROW
                BEGIN
                  ---CODE HERE.
                END;

QA DDL: 质量检查DDL:

create or replace TRIGGER "MDATA_BIR_TRG" 
                    BEFORE INSERT ON "METADATA"
                    FOR EACH ROW
                    BEGIN
                      ---CODE HERE.
                    END;

I agree with omeinusch that the schema name is not that important (as long as the current schema is the same as the schema where the object is intended to reside). 我同意omeinusch的观点,即模式名称并不那么重要(只要当前模式与对象要驻留的模式相同)。 There is no need to recompile the trigger and make it fully qualified. 无需重新编译触发器并使其完全合格。

A common approach to exporting an object's DDL is to use the SQL Developer's export wizard which does allow you to indicate whether the DDL of the object is schema qualified. 导出对象的DDL的常见方法是使用SQL Developer的导出向导,该向导确实允许您指示对象的DDL是否符合架构要求。

Directions to obtain DDL from SQL Developer export wizard 从SQL Developer导出向导获取DDL的说明

  1. right click on the object in the connection navigator and select export 在连接导航器中右键单击对象,然后选择导出 在此处输入图片说明
  2. choose characteristics of export (include schema by selecting check) 选择导出的特征(通过选择检查来包括架构) 在此处输入图片说明
  3. make sure file path is entered. 确保输入文件路径。
  4. click next. 点击下一步。

No, the SCHEMA is optional and only needed if you want ensure that the handled object belongs to a defined schema or not. 不,SCHEMA是可选的,只有在要确保所处理的对象属于已定义的架构时才需要。 If you "don't care" and always use mean your current schema, you can omit it. 如果您“不在乎”并且始终使用“ mean”表示当前架构,则可以忽略它。

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

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