OCP-052考試題庫彙總(3)-CUUG內部解答版

  Each row in the TRANS_SUMMARY table contains details of one product.

  Each row in the TRANS_MONTHLY table contains transaction details either for new products or for

  updates to existing products.

  There is a monthly requirement to:

  1.Insert TRANS_MONTHLY rows for new products to the TRANS_SUMMARY table

  2.Update the TRANS_SUMMARY table when a TRANS_MONTHLY row refers to an existing product.

  Which two can be used to do this?

  A)INSERT INTO .. SELECT FROM ..

  B)a called procedure.

  C)an Oracle loader type external table.

  D)the MERGE command.

  E)CREATE TABLE AS SELECT (CTAS)

  Answer: BD

  題譯:

  每月需要:

  1 將 TRANS_MONTHLY 表中的新產品的行插入到 TRANS_SUMMARY 彙總表

  2 對已有的產品進行更新

  MERGE INTO T T1

  USING (SELECT '1001' AS a,2 AS b FROM dual) T2

  ON ( T1.a=T2.a)

  WHEN MATCHED THEN

  UPDATE SET T1.b = T2.b

  WHEN NOT MATCHED THEN

  INSERT (a,b) VALUES(T2.a,T2.b);

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章