zoukankan      html  css  js  c++  java
  • 如何在Oracle中向Collection类型的变量中逐条插入数据

    这篇文章将要介绍如果需要生成一个新的Collection并且向其中添加数据的方法。

    procedure insert_object(d in dept_array, d2 out dept_array) is
    begin

    --First way to insert data into a new array.
    SELECT CAST(MULTISET
    (SELECT DNO, name, location FROM department_teststruct) AS
    dept_array)
    INTO l_dept_array
    FROM DUAL;

    --Second to insert data into a new array.
    d2 := dept_array();
    FOR j IN 1 .. d.COUNT LOOP
    d2.EXTEND;
    d2(j) := department_type(d(j).dno, d(j).name, d(j).location);
    END LOOP;

    --Test data
    for j in 1 .. d2.count loop
    --update
    d2(j).location := 'New Loc2_' || j;
    INSERT INTO department_teststruct
    VALUES
    (d2(j).dno || j, d2(j).name, d2(j).location);
    end loop;
    end insert_object;
  • 相关阅读:
    md5加密(4)
    生成短的uuid
    九九乘法
    闰年判断
    初识网络传输
    省选模拟77
    省选模拟76
    省选模拟75
    省选模拟74
    省选模拟73
  • 原文地址:https://www.cnblogs.com/duffy/p/4745804.html
Copyright © 2011-2022 走看看