写存储过程时出的错误:PLS-00201: 必须声明标识符 'INSERT_OBJECT'
create table gpscoordinate(
id int primary key,
longitude VARCHAR(32),
latitude VARCHAR(32)
name VARCHAR(32),
time VARCHAR(32)
);
CREATE TYPE department_type AS OBJECT (
longitude VARCHAR(32),
latitude VARCHAR(32)
name VARCHAR(32),
time VARCHAR(32)
);
CREATE TYPE dept_array AS TABLE OF department_type;
create or replace package objecttype
as
procedure insert_object(d dept_array);
end objecttype;
create or replace package body objecttype
as
procedure insert_object(d dept_array)
as
begin
for i in d.first .. d.last
loop
insert into gpscoordinate(longitude,latitude,name,time) values(d(i).longitude,d(i).latitude,d(i).name,d(i).time);
end loop;
end insert_object;
end objecttype;
//JAVA代码
{
Connection con=Util.getConnection();
con.setAutoCommit(false);
try{
StructDescriptor st = new StructDescriptor ("DEPARTMENT_TYPE",con);
STRUCT[] deptArray = new STRUCT[name.length];
for(int i=0;i<name.length;i++){
Object[] so={longitude[i],latitude[i],name[i],time};
deptArray[i]=new STRUCT(st,con,so);
}
ArrayDescriptor arrayDept = ArrayDescriptor.createDescriptor("DEPT_ARRAY", con);
ARRAY deptArrayObject = new ARRAY(arrayDept, con, deptArray);
OracleCallableStatement callStatement = (OracleCallableStatement)con.prepareCall("{call insert_object(?)}");
callStatement.setArray(1, deptArrayObject);
callStatement.execute();
con.commit();
Util.close(con, callStatement, null);
int k=this.getCount();
System.out.println("现有记录条数:"+k);
}catch(Exception e){
con.rollback();
e.printStackTrace();
flag=false;
}
return flag;
}