DB2 how to drop overloaded functions


When you try to drop an overloaded function/procedure, DB2 will report a SQL0476N error code.
For example: if function MY_TOCHAR is overloaded with

CREATE FUNCTION MY_TOCHAR(P DATE) RETURNS VARCHAR(50) LANGUAGE SQL RETURN ...
CREATE FUNCTION MY_TOCHAR(P TIME) RETURNS VARCHAR(50) LANGUAGE SQL RETURN ...

And if you want to delete function using:
DROP FUNCTION MY_TOCHAR

You will get following error message:

DB21034E  The command was processed as an SQL statement because it was not a valid Command Line Processor command.  During SQL processing it returned:
SQL0476N  Reference to routine "<SCHEMA>.MY_TOCHAR" was made without a signature, but the routine is not unique in its schema.  SQLSTATE=42725


Solution 1: Drop function with explicit signature, like

DROP FUNCTION MY_TOCHAR(DATE)
DROP FUNCTION MY_TOCHAR(TIME)

Solution 2: Drop function using specific-name

DROP SPECIFIC FUNCTION <specific-name>

The <specific-name> could be found from SYSIBM.SYSROUTINES:

db2 => SELECT NAME, SPECIFICNAME FROM SYSIBM.SYSROUTINES WHERE NAME = 'MY_TOCHAR'

 NAME                SPECIFICNAME            
-------------------- ------------------------
MY_TOCHAR            MY_D3MYTVWGULBL        
MY_TOCHAR            MY_TOCHAR              

db2 => DROP SPECIFIC FUNCTION MY_TOCHAR
DB20000I  The SQL command completed successfully
db2 => DROP SPECIFIC FUNCTION MY_D3MYTVWGULBL
DB20000I  The SQL command completed successfully


  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值