前端之家收集整理的这篇文章主要介绍了
Oracle bulk into clause,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
DECLARE
TYPE salaryTab IS TABLE OF plch_employees.salary%TYPE;
s_tab salaryTab;
TYPE eTab IS RECORD (
last_name plch_employees.last_name%TYPE,salary plch_employees.salary%TYPE
);
TYPE eTab1 IS TABLE OF eTab;
e_tab eTab1;
BEGIN --fetch single col with bulk collect clause SELECT salary BULK COLLECT INTO s_tab FROM plch_employees;
FOR i IN 1..s_tab.count
LOOP
dbms_output.put_line('fetch data by bulk: ' || s_tab(i));
END LOOP;
FOR eachrow IN (SELECT salary FROM plch_employees) LOOP dbms_output.put_line('fetch data by for: ' || eachrow.salary);
END LOOP;
SELECT last_name,salary BULK COLLECT INTO e_tab FROM plch_employees;
FOR i IN 1..e_tab.count
LOOP
dbms_output.put_line('fetch data by bulk: ' || e_tab(i).last_name || ' ' || e_tab(i).salary);
END LOOP;
FOR eachrow IN (SELECT last_name,salary FROM plch_employees) LOOP dbms_output.put_line('fetch data by for: ' || eachrow.last_name || ' ' || eachrow.salary);
END LOOP;
END;
/
class A {
private String A;
public String B;
}
原文链接:https://www.f2er.com/oracle/210456.html