执行这个存储结构应该怎么去调用,希望详细一点,还有一个问题,查询出1000条数据用存储过程写,应该怎么写存储过程和如何去调用,菜鸟求高手指教。
CREATE OR REPLACE TYPE student_record_type IS OBJECT(
id number(10),
name VARCHAR2(255),
age number(10)
);
CREATE OR REPLACE TYPE student_table_type IS TABLE OF student_record_type ;
CREATE OR REPLACE PROCEDURE insert_student(info_list IN student_table_type ,
out_message OUT VARCHAR2) IS
BEGIN
FOR i IN 1.. info_list.count LOOP
INSERT INTO student(name,age)
VALUES (info_list(i).name,info_list(i).age); IF MOD(i,1000) = 0 THEN
COMMIT;
END IF;
END LOOP; COMMIT;EXCEPTION
WHEN OTHERS THEN
out_message := sqlerrm;
ROLLBACK;
END;
CREATE OR REPLACE TYPE student_record_type IS OBJECT(
id number(10),
name VARCHAR2(255),
age number(10)
);
CREATE OR REPLACE TYPE student_table_type IS TABLE OF student_record_type ;
CREATE OR REPLACE PROCEDURE insert_student(info_list IN student_table_type ,
out_message OUT VARCHAR2) IS
BEGIN
FOR i IN 1.. info_list.count LOOP
INSERT INTO student(name,age)
VALUES (info_list(i).name,info_list(i).age); IF MOD(i,1000) = 0 THEN
COMMIT;
END IF;
END LOOP; COMMIT;EXCEPTION
WHEN OTHERS THEN
out_message := sqlerrm;
ROLLBACK;
END;
statement.execute(SQL)