ORACLE问题:我有个SELECT * BULK COLLECT INTO死活写不对,哪位前辈帮我看一下,感激不尽~ ( 积分: 33 )

  • 主题发起人 主题发起人 章慧
  • 开始时间 开始时间

章慧

Unregistered / Unconfirmed
GUEST, unregistred user!
PROCEDURE BIOBJECT_QUERY(vi_Query IN BIO_QUERY,
vo_Result OUT BIO_QUERY,
vo_OperationStatus OUT NUMBER,
vo_OperationStatusDesc OUT VARCHAR2) IS
BEGIN
vo_Result := BIO_QUERY(vi_Query.BQ_TYPE, vi_Query.BQ_VALUE, BI_OBJECTS());
IF vi_Query.BQ_TYPE = 0 THEN
SELECT * BULK COLLECT INTO vo_Result.BQ_RESULT FROM BIO_INFO WHERE BO_NAME = vi_Query.BQ_VALUE; -- << 就是编译时候报错在这一行,报ORA-00947
END IF;
vo_OperationStatus := 0;
EXCEPTION
WHEN OTHERS THEN
vo_OperationStatus := -151000;
vo_OperationStatusDesc := 'BIOBJECT_QUERY Error: ' || SQLERRM;
END BIOBJECT_QUERY;
///// 类型声明如下
-- ************************************************
-- * COMMON TYPE DECLARATION FOR BIODESIGNER 2005 *
-- * AUTHOR: Hibiki, Kirikawa 20:25 21th May,2005 *
-- ************************************************
CREATE TYPE BIOF_EXTENDINFO AS OBJECT
(
BE_NAME VARCHAR2(25),
BE_VALUE VARCHAR2(25),
BE_DESCRIPTION VARCHAR2(20)
);

CREATE OR REPLACE TYPE BIOF_EXTENDINFOS AS TABLE OF BIOF_EXTENDINFO;

CREATE OR REPLACE TYPE BIO_FIELD AS OBJECT
(
BF_NAME VARCHAR2(80),
BF_TYPE VARCHAR2(80),
BF_RADIX CHAR(1),
BF_NULLABLE CHAR(1),
BF_DIRECTION VARCHAR2(6),
BF_DESCRIPTION VARCHAR2(512),
BF_EXTENDINFOS BIOF_EXTENDINFOS
);

CREATE OR REPLACE TYPE BIO_FIELDS AS TABLE OF BIO_FIELD;

CREATE OR REPLACE TYPE BI_OBJECT AS OBJECT
(
BO_NAME VARCHAR2(80),
BO_FIELDS BIO_FIELDS,
BO_DESCRIPTION VARCHAR(512),
BO_MIDDLEWARE_DISPACTHER VARCHAR(80),
BO_MIDDLEWARE_SUBDISPATCHER VARCHAR(80),
BO_MODULE VARCHAR(80),
BO_OWNER VARCHAR(80),
BO_CREATEDATE VARCHAR(40),
BO_MODIFYDATE VARCHAR(40),
BO_SP_NAME VARCHAR(160),
BO_SP_TYPE VARCHAR(80)
);

CREATE OR REPLACE TYPE BI_OBJECTS AS TABLE OF BI_OBJECT;

CREATE OR REPLACE TYPE BIO_QUERY AS OBJECT
(
BQ_TYPE NUMBER(8),
BQ_VALUE VARCHAR2(80),
BQ_RESULT BI_OBJECTS
)

-- ************************************************
-- * COMMON TABLE DECLARATION OF BIODESIGNER 2005 *
-- * AUTHOR: Hibiki, Kirikawa 20:25 21th May,2005 *
-- ************************************************

CREATE TABLE BIO_INFO OF BI_OBJECT
NESTED TABLE BO_FIELDS STORE AS NESTED_BO_FIELDS
(
NESTED TABLE BF_EXTENDINFOS STORE AS NESTED_BF_EXTENDINFOS
);
 
PROCEDURE BIOBJECT_QUERY(vi_Query IN BIO_QUERY,
vo_Result OUT BIO_QUERY,
vo_OperationStatus OUT NUMBER,
vo_OperationStatusDesc OUT VARCHAR2) IS
BEGIN
vo_Result := BIO_QUERY(vi_Query.BQ_TYPE, vi_Query.BQ_VALUE, BI_OBJECTS());
IF vi_Query.BQ_TYPE = 0 THEN
SELECT * BULK COLLECT INTO vo_Result.BQ_RESULT FROM BIO_INFO WHERE BO_NAME = vi_Query.BQ_VALUE; -- << 就是编译时候报错在这一行,报ORA-00947
END IF;
vo_OperationStatus := 0;
EXCEPTION
WHEN OTHERS THEN
vo_OperationStatus := -151000;
vo_OperationStatusDesc := 'BIOBJECT_QUERY Error: ' || SQLERRM;
END BIOBJECT_QUERY;
///// 类型声明如下
-- ************************************************
-- * COMMON TYPE DECLARATION FOR BIODESIGNER 2005 *
-- * AUTHOR: Hibiki, Kirikawa 20:25 21th May,2005 *
-- ************************************************
CREATE TYPE BIOF_EXTENDINFO AS OBJECT
(
BE_NAME VARCHAR2(25),
BE_VALUE VARCHAR2(25),
BE_DESCRIPTION VARCHAR2(20)
);

CREATE OR REPLACE TYPE BIOF_EXTENDINFOS AS TABLE OF BIOF_EXTENDINFO;

CREATE OR REPLACE TYPE BIO_FIELD AS OBJECT
(
BF_NAME VARCHAR2(80),
BF_TYPE VARCHAR2(80),
BF_RADIX CHAR(1),
BF_NULLABLE CHAR(1),
BF_DIRECTION VARCHAR2(6),
BF_DESCRIPTION VARCHAR2(512),
BF_EXTENDINFOS BIOF_EXTENDINFOS
);

CREATE OR REPLACE TYPE BIO_FIELDS AS TABLE OF BIO_FIELD;

CREATE OR REPLACE TYPE BI_OBJECT AS OBJECT
(
BO_NAME VARCHAR2(80),
BO_FIELDS BIO_FIELDS,
BO_DESCRIPTION VARCHAR(512),
BO_MIDDLEWARE_DISPACTHER VARCHAR(80),
BO_MIDDLEWARE_SUBDISPATCHER VARCHAR(80),
BO_MODULE VARCHAR(80),
BO_OWNER VARCHAR(80),
BO_CREATEDATE VARCHAR(40),
BO_MODIFYDATE VARCHAR(40),
BO_SP_NAME VARCHAR(160),
BO_SP_TYPE VARCHAR(80)
);

CREATE OR REPLACE TYPE BI_OBJECTS AS TABLE OF BI_OBJECT;

CREATE OR REPLACE TYPE BIO_QUERY AS OBJECT
(
BQ_TYPE NUMBER(8),
BQ_VALUE VARCHAR2(80),
BQ_RESULT BI_OBJECTS
)

-- ************************************************
-- * COMMON TABLE DECLARATION OF BIODESIGNER 2005 *
-- * AUTHOR: Hibiki, Kirikawa 20:25 21th May,2005 *
-- ************************************************

CREATE TABLE BIO_INFO OF BI_OBJECT
NESTED TABLE BO_FIELDS STORE AS NESTED_BO_FIELDS
(
NESTED TABLE BF_EXTENDINFOS STORE AS NESTED_BF_EXTENDINFOS
);
 
ORACLE中不支持 SELECT .. INTO.. 吧?
用 INSERT INTO 的方式
 
ORACLE支持的。。
 
ORACLE中应该为:
create table 新表名 as select * from 旧表名
 
BIO_INFO 表的字段数目与vo_Result.BQ_RESULT不一致引起的
 
ps:
BIO_INFO 表的字段数目与vo_Result.BQ_RESULT不一致引起的

可是这2者哪里不一样呢?定义都为TABLE OF BI_OBJECT啊[:(]
 
后退
顶部