oracle存儲過程日期加1 如何判斷SQL中是否已經(jīng)存在某表,存儲過程,函數(shù)等?
如何判斷SQL中是否已經(jīng)存在某表,存儲過程,函數(shù)等?1、是否存在某表的判斷if exists(select 0 from sysobjects where name="表名" and xtype="U
如何判斷SQL中是否已經(jīng)存在某表,存儲過程,函數(shù)等?
1、是否存在某表的判斷
if exists(select 0 from sysobjects where name="表名" and xtype="U") begin --存在 end
2、是否存在某存儲過程的判斷
if exists(select 0 from sysobjects where name="存儲過程名" and xtype="P")begin --存在end
3、是否存在某函數(shù)的判斷
if exists(select 0 from sysobjects where name="函數(shù)名" and xtype="FN")begin --存在end
oracle存儲過程中,如果用if語句判斷一條查詢語句的結(jié)果集是否為空?
已經(jīng)經(jīng)過測試,可以。create table test1023(id int) --創(chuàng)建測試表 test1023declare cnt intbeginselect count(*) into cnt from test1023if cnt=0 theninsert into test1023 values("1")commitend ifend