atgc的博客
===========================================================
aaaaa
===========================================================

import java.sql.*;
import java.util.*;
import oracle.jdbc.driver.*;
import oracle.sql.*;

public class zhu
{
public static void main(String args[]) throws Exception
{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.1:1521:gene","test","test");
OraclePreparedStatement cstmt = (OraclePreparedStatement)conn.prepareStatement("begin p2(:x); end;" );
int a[][]={{1,2},{3,4}};
ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor("ARR",conn);
ARRAY array_to_pass = new ARRAY(descriptor,conn,a);
cstmt.setARRAY(1, array_to_pass);
cstmt.execute();
}
}

create or replace type mtype is record
(id number,name number);
/

create or replace type acc_type as object
(id number,name number)
/

create or replace type arr as table of acc_type
/

create or replace type arr as table of number;

--´´½¨´æ´¢¹ý³Ì
create or replace procedure p(myArray arr)
as
begin
for i in myArray.first..myArray.last
loop
dbms_output.put_line(to_char(i));
end loop;
end;

create or replace procedure p2(myArray arr)
as
begin
forall i in myArray.first..myArray.last
insert into aa values(myArray(i,i));
COMMIT;
end;

--²âÊÔ
declare
myArray arr:=arr('1,2','3,4');
begin
p(myArray);
end;

http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:712625135727


atgc 发表于:2006.12.01 17:11 ::分类: ( 技术文章 ) ::阅读:(231次) :: 评论 (0)

发表评论
标题

在此添加评论
表情符号: smile laughing tongue angry crying sad wassat wink

称呼

邮箱地址(可选)

个人主页(可选)




切换风格
新闻聚合
博客日历
文章归档...
最新发表...
博客统计...
网站链接...