oracle
查找存储过程
1 | select t. name ,t.text from all_source t where type = 'PROCEDURE' and text like '%var_app_1_pst%' |
查找函数
1 | select t. name ,t.text from all_source t where type = 'FUNCTION' and text like '%var_app_1_pst%' |
MSSQL
1 2 3 4 | select b. name from 数据库名.dbo.syscomments a, 数据库名.dbo.sysobjects b where a.id=b.id and b.xtype= 'p' and a.text like '%key words%' order by name |
Oracle中,如果关键字是一张表的话,还可以通过表的Referenced by属性找到相关的函数、存储过程和触发器等。
如:

MSSQL类似。
oracle数据库中如何查看已经创建的索引信息
1. 根据表名,查询一张表的索引
1 | select * from user_indexes where table_name= upper ( '表名' ); |
2. 根据索引号,查询表索引字段
1 | select * from user_ind_columns where index_name=( '索引名' ); |
3.根据索引名,查询创建索引的语句
1 | select dbms_metadata.get_ddl( 'INDEX' , '索引名' , [ '用户名' ]) from dual ; --['用户名']可省,默认为登录用户 |
PS:dbms_metadata.get_ddl还可以得到建表语句,如:
1 2 | SELECT DBMS_METADATA.GET_DDL( 'TABLE' , '表名' , [ '用户名' ]) FROM DUAL ; //取单个表的建表语句,[ '用户名' ]可不输入,默认为登录用户 SELECT DBMS_METADATA.GET_DDL( 'TABLE' ,u.table_name) FROM USER_TABLES u; //取用户下所有表的建表语句 |
当然,也可以用pl/sql developer工具来查看相关的表的各种信息。