如何检查存储过程是否存在? [英] How to check if a stored procedure exist?

查看:87
本文介绍了如何检查存储过程是否存在?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜索过网络,并且找到了帖子,它使用以下代码片段检查存储过程是否存在:

I have searched the net and I've found a post that uses the following snippet to check if a stored procedure exists:

select * 
  from USER_SOURCE 
 where type='PROCEDURE' 
   and name='my_stored_procedure.' 

还有其他方法可以检查过程是否存在吗?

Is there any other way to check if a procedure exists?

编辑后添加:

在发布SQL Server方式之前,请先寻找ORACLE方式.

Before posting SQL Server ways, please I'm looking for ORACLE ways.

推荐答案

替代方法:

USER_PROCEDURES:

SELECT *
  FROM USER_PROCEDURES
 WHERE object_name = 'MY_STORED_PROCEDURE'

USER_OBJECTS:

SELECT *
  FROM USER_OBJECTS
 WHERE object_type = 'PROCEDURE'
   AND object_name = 'MY_STORED_PROCEDURE'

这篇关于如何检查存储过程是否存在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆