不能丢桌但也找不到依赖 [英] can not drop table but can not find dependence either

查看:72
本文介绍了不能丢桌但也找不到依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将表格删除为:


drop table sch.tab;



我得到:在SQL处理期间它返回:

SQL0478N对象类型TABLE不能删除因为

一个对象sch.SQL070515104729271,类型为FUNCTION,它取决于它的
。 SQLSTATE = 42893


然后我试着做


> drop function sch.SQL070515104729271


但是它说没有定义。实际上,我尝试用

来搜索

函数SELECT tabname FROM SYSCAT.TABLES

union SELECT procname FROM SYSCAT.procedures

union SELECT funcname FROM SYSCAT.functions

union SELECT pkgname FROM SYSCAT.packages

但未能找到该函数名。我还通过以下方式搜索依赖:


从sysibm.sysdependencies中选择bschema,bname,dschema,dname;



我发现:

BSCHEMA BNAME DSCHEMA DNAME

sch tab sch SQL070515104729271

这对我意味着什么?因为我找不到什么是

对象" SQL070515104729271"

谢谢!

解决方案

uw****@gmail.com 写道:


我尝试将表格删除为:


> drop table sch.tab;



我得到:在SQL处理期间它返回:

SQL0478N对象类型TABLE不能删除因为

一个对象sch.SQL070515104729271,类型为FUNCTION,它取决于它的
。 SQLSTATE = 42893


然后我试着做


>> drop function sch.SQL070515104729271



但是它说没有定义。实际上,我试图用



搜索

函数我认为这是*具体名称*,试试:


掉落特定功能sch.SQL070515104729271

你可能想在放下它之前看一下这个功能,你应该

能够找到它:


选择funcname,body来自syscat.functions where specificname =

''SQL070515104729271''

/ Lennart


感谢您的快速回复!


我找到了函数SQL070515104729271使用
命令:


从syscat.functions中选择funcname,body,其中specificname =

''SQL070515104729271''



我得到:


SUMSALARIES创建功能SUMSALARIES(DEPT CHAR(3))

RETURNS DECIMAL(9,2)

LANGUAGE SQL

RETURN < br $>
选择总和(工资)

来自员工

WHERE workdept = dept


然而,就像我一样尝试删除此功能:使用


drop specific function SQL070515104729271;



我得到:SQL0658N对象sch.SUMSALARIES不能明确

掉落。

SQLSTATE = 42917


我也尝试过:


下降函数sumsalaries;



这给了我同样的错误。那我该怎么办?再次感谢!


5月17日下午2:18,Lennart< erik.lennart.jons ... @ gmail.comwrote:


uwc ... @ gmail.com写道:


我尝试删除一个表格为:


drop table sch.tab;


我得到:在SQL处理期间它返回:

SQL0478N对象类型TABLE不能删除因为

一个对象sch.SQL070515104729271,类型为FUNCTION,它取决于它的
。 SQLSTATE = 42893


然后我尝试做


> drop function sch.SQL070515104729271


但是它说没有定义。实际上,我试图用
搜索

函数



我认为这是*具体名称*,试试:


掉落特定功能sch.SQL070515104729271

你可能想在放下它之前看一下这个功能,你应该

能够找到它:


选择funcname,body来自syscat.functions where specificname =

''SQL070515104729271''


/ Lennart



uw *** *@gmail.com 写道:


但是,当我尝试删除此功能时:使用


drop特定函数SQL070515104729271;



我认为你需要包含模式名称以及函数的特定

名称,即:


DROP SPECIFIC FUNCTION SCH.SQL070515104729271;


我也尝试过:


下降函数sumsalaries;



这给了我同样的错误。那我该怎么办?再次感谢!



再次,包括模式名称。此外,如果该函数具有

重载版本(具有相同名称的函数,但具有不同的

参数列表),则需要将参数列表包含在

准确区分您希望丢弃的多重版本,即:


DROP FUNCTION SCH.SUMSALARIES(CHAR(3));


或者,将当前架构更改为包含要删除的

函数的架构:


SET SCHEMA SCH;

DROP FUNCTION SUMSALARIES(CHAR(3));

HTH,


Dave。


-


I try to drop a table as:

drop table sch.tab;

I got: During SQL processing it returned:
SQL0478N The object type "TABLE" cannot be dropped because there is
an object "sch.SQL070515104729271", of type "FUNCTION", which depends
on it. SQLSTATE=42893

Then I tried to do

>drop function sch.SQL070515104729271

but it says this is not defined. Actually, I tried to search that
function with
SELECT tabname FROM SYSCAT.TABLES
union SELECT procname FROM SYSCAT.procedures
union SELECT funcname FROM SYSCAT.functions
union SELECT pkgname FROM SYSCAT.packages
but failed to find that function name. I also search dependency by:

select bschema, bname, dschema, dname from sysibm.sysdependencies;

I found:
BSCHEMA BNAME DSCHEMA DNAME
sch tab sch SQL070515104729271
What does this mean to me? since I can not find what the heck is the
object "SQL070515104729271"
Thanks!

解决方案

uw****@gmail.com wrote:

I try to drop a table as:

>drop table sch.tab;


I got: During SQL processing it returned:
SQL0478N The object type "TABLE" cannot be dropped because there is
an object "sch.SQL070515104729271", of type "FUNCTION", which depends
on it. SQLSTATE=42893

Then I tried to do

>>drop function sch.SQL070515104729271


but it says this is not defined. Actually, I tried to search that
function with

I think that this is the *specific name*, try:

drop specific function sch.SQL070515104729271

You probably want to look at the function before dropping it, you should
be able to find it with:

select funcname, body from syscat.functions where specificname =
''SQL070515104729271''
/Lennart


Thanks for the quick reply!

I found the definition of the function SQL070515104729271 using the
command:

select funcname, body from syscat.functions where specificname =
''SQL070515104729271''

And I get:

SUMSALARIES CREATE FUNCTION SUMSALARIES(DEPT CHAR(3))
RETURNS DECIMAL(9,2)
LANGUAGE SQL
RETURN
SELECT sum(salary)
FROM employee
WHERE workdept = dept

However, as I try to drop this function: using either

drop specific function SQL070515104729271 ;

I get: SQL0658N The object "sch.SUMSALARIES" cannot be explicitly
dropped.
SQLSTATE=42917

I also tried:

drop function sumsalaries;

Which gives me the same error. How should I do then? thanks again!

On May 17, 2:18 pm, Lennart <erik.lennart.jons...@gmail.comwrote:

uwc...@gmail.com wrote:

I try to drop a table as:

drop table sch.tab;

I got: During SQL processing it returned:
SQL0478N The object type "TABLE" cannot be dropped because there is
an object "sch.SQL070515104729271", of type "FUNCTION", which depends
on it. SQLSTATE=42893

Then I tried to do

>drop function sch.SQL070515104729271

but it says this is not defined. Actually, I tried to search that
function with


I think that this is the *specific name*, try:

drop specific function sch.SQL070515104729271

You probably want to look at the function before dropping it, you should
be able to find it with:

select funcname, body from syscat.functions where specificname =
''SQL070515104729271''

/Lennart



uw****@gmail.com wrote:

However, as I try to drop this function: using either

drop specific function SQL070515104729271 ;

I believe you need to include the schema name as well as the specific
name of the function, i.e.:

DROP SPECIFIC FUNCTION SCH.SQL070515104729271;

I also tried:

drop function sumsalaries;


Which gives me the same error. How should I do then? thanks again!

Again, include the schema name. Furthermore, if the function has
overloaded versions (functions with the same name, but a different
parameter list), you will need to include the parameter list to
distinguish exactly which overloaded version you wish to drop, i.e.:

DROP FUNCTION SCH.SUMSALARIES(CHAR(3));

Alternatively, change the current schema to the schema containing the
function you wish to drop:

SET SCHEMA SCH;
DROP FUNCTION SUMSALARIES(CHAR(3));
HTH,

Dave.

--


这篇关于不能丢桌但也找不到依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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