Oracle升级后的ORA-06531 [英] ORA-06531 after Oracle upgrade

查看:633
本文介绍了Oracle升级后的ORA-06531的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将数据库从 Oracle 10 升级到了 11.2 .我面临的问题是表格中的几何不再起作用.我的SQL是:

I upgraded my database from Oracle 10 to 11.2. The problem I face is that my geometry in tables don't work any more. My SQL is:

Select 
   GEOMETRYID, COORDCOUNT, CREATIONDATE, QUALITYID,       
  SDO_UTIL.TO_WKTGEOMETRY(SDO_CS.TRANSFORM(SDO_UTIL.SIMPLIFY(GEOMETRY, 1, 0.0000005), 27700)) as "WKT" 
FROM 
   NWKGEOMETRY 
WHERE 
   DELETIONDATE IS NULL;  
   AND SDO_GEOMETRY.GET_GTYPE(GEOMETRY)=2 AND SDO_UTIL.GETNUMVERTICES(GEOMETRY)>2;

我得到一个错误:

ORA-06531:引用未初始化的集合

ORA-06531: Reference to uninitialized collection

如果我删除了TRANSFORM函数,则一切正常.有什么问题吗?

If I remove TRANSFORM function then all works fine. What could be wrong?

推荐答案

此错误:

ORA-06531: Reference to uninitialized collection

表示您有一个在使用之前未初始化的集合,例如:

means that you have a collection that is not initialized before you use it, for example:

SQL> select banner from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL> ed
Wrote file afiedt.buf

  1  CREATE OR REPLACE TYPE t_employee AS OBJECT(
  2    id  number,
  3    name VARCHAR2(300),
  4    CONSTRUCTOR FUNCTION t_employee RETURN SELF AS RESULT
  5* )
SQL> /

Type created.

SQL> ed
Wrote file afiedt.buf

  1* CREATE OR REPLACE TYPE t_employees AS TABLE OF t_employee
SQL> /

Type created.

SQL> ed
Wrote file afiedt.buf

  1  DECLARE
  2    l_emp t_employee;
  3    l_emps t_employees;
  4  BEGIN
  5    for i in (SELECT employee_id, first_name
  6                FROM employees)
  7    loop
  8      l_emp := t_employee(i.employee_id, i.first_name);
  9      l_emps.extend();
 10      l_emps(l_emps.COUNT) := l_emp;
 11    end loop;
 12    DBMS_OUTPUT.put_line(l_emps(4).name);
 13* END;
SQL> /
DECLARE
*
ERROR at line 1:
ORA-06531: Reference to uninitialized collection
ORA-06512: at line 9

如您所见,我出现了ORA-06531错误,这是因为我尚未初始化l_emps变量,所以我必须添加l_emps := t_employees();:

As you can see, I have the ORA-06531 error, that's because I haven't initialized the l_emps variable, I have to add l_emps := t_employees();:

SQL> ed
Wrote file afiedt.buf

  1  DECLARE
  2    l_emp t_employee;
  3    l_emps t_employees;
  4  BEGIN
  5    l_emps := t_employees();
  6    for i in (SELECT employee_id, first_name
  7                FROM employees)
  8    loop
  9      l_emp := t_employee(i.employee_id, i.first_name);
 10      l_emps.extend();
 11      l_emps(l_emps.COUNT) := l_emp;
 12    end loop;
 13    DBMS_OUTPUT.put_line(l_emps(4).name);
 14* END;
SQL> /
David

PL/SQL procedure successfully completed.

因此,请查看所有这些PL/SQL过程的来源,问题出在其中.

So take a look at the sources of all these PL/SQL procedures, the problem is in them.

这篇关于Oracle升级后的ORA-06531的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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