Re: [SQL ] 請問一個Oracle語法

看板Database作者 (570)時間15年前 (2009/03/31 20:41), 編輯推噓2(200)
留言2則, 1人參與, 最新討論串2/2 (看更多)
※ 引述《ling123 (@@)》之銘言: : 請問一個Oracle語法 : 要如何知道該Function/Procedure/View : References到哪個Table或Function阿? : 在PL/SQL Developer這套工具可以看到References資訊 : 那要如何用SQL語法串出呢? : 謝謝~ 基本上是用 SYS.DBA_OBJECTS 和 PUBLIC_DEPENDENCY 這兩個串出來的 如底下 SQL, 如果你權限不足, 試著用 USER_OBJECTS 看看 Select a.object_type, a.object_name, b.owner AS related_owner, b.object_type AS related_object_type, b.object_name AS related_object_name, b.status from sys.dba_objects a, sys.dba_objects b, (Select object_id, referenced_object_id FROM public_dependency start with object_id = (Select object_id from sys.dba_objects WHERE owner = '' -- your schema name here AND object_name = '' -- your procedure name here AND object_type = 'PROCEDURE') connect by prior referenced_object_id = object_id) c where a.object_id = c.object_id and b.object_id = c.referenced_object_id and a.owner not in ('SYS', 'SYSTEM') and b.owner not in ('SYS', 'SYSTEM') and a.object_name <> 'DUAL' and b.object_name <> 'DUAL'; -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.160.109.245

04/03 13:00, , 1F
謝謝阿~
04/03 13:00, 1F

04/03 14:09, , 2F
Start With這種語法第一次看過 好神阿
04/03 14:09, 2F
文章代碼(AID): #19qW-CVn (Database)
文章代碼(AID): #19qW-CVn (Database)