【OCP最新題庫解析(052)–題42】 which is true about invalid PL/SQL

  • 2019 年 10 月 11 日
  • 筆記

該系列專題為2018年4月OCP-052考題變革後的最新題庫。題庫為小麥苗解答,若解答有不對之處,可留言,也可聯繫小麥苗進行修改。

註:OCP-052最新題庫完整詳細解答版請聯繫小麥苗私聊。解題不易,請大家尊重原創。

題目

which is true about invalid PL/SQL objects?

A. They are automatically recompiled against the new definition of a referenced object when they are called.

B. They must be manually recompiled before they can be used if a DDL is performed on a table that is referenced in the PL/SQL object.

C. They are automatically recompiled against the new definition of a referenced object at the same time as the referenced object is modified.

D. They can be manually recompiled only by using SQL commands.

A

答案

Answer:A

失效的PL/SQL對象在下一次執行時會自動進行編譯操作,排除B、C和D。

實驗如下:

LHR@OCPLHR1> create table test_ddl(id number);  Table created.  LHR@OCPLHR1> create or replace procedure pro_test_ddl as begin insert into test_ddl(id) values(1);commit; end;    2  /  Procedure created.  LHR@OCPLHR1> show errors  No errors.  LHR@OCPLHR1> select status from user_objects where object_name='PRO_TEST_DDL';  STATUS  -------  VALID  LHR@OCPLHR1> alter table test_ddl add name varchar2(10);  Table altered.  LHR@OCPLHR1> select status from user_objects where object_name='PRO_TEST_DDL';  STATUS  -------  VALID  LHR@OCPLHR1> alter table test_ddl drop column id;  Table altered.  LHR@OCPLHR1> select status from user_objects where object_name='PRO_TEST_DDL';  STATUS  -------  INVALID  LHR@OCPLHR1> alter table test_ddl add id number;  Table altered.  LHR@OCPLHR1> select status from user_objects where object_name='PRO_TEST_DDL';  STATUS  -------  INVALID  LHR@OCPLHR1> exec PRO_TEST_DDL;  PL/SQL procedure successfully completed.  LHR@OCPLHR1> select status from user_objects where object_name='PRO_TEST_DDL';  STATUS  -------  VALID

About Me:小麥苗

● 本文作者:小麥苗,只專註於資料庫的技術,更注重技術的運用

● 作者部落格地址:http://blog.itpub.net/26736162/abstract/1/

● 本系列題目來源於作者的學習筆記,部分整理自網路,若有侵權或不當之處還請諒解

● 版權所有,歡迎分享本文,轉載請保留出處

● 題目解答若有不當之處,還望各位朋友批評指正,共同進步