如何在 Oracle PL SQL 中定义类似字典的结构?
如何在 PL/SQL 中定义以下结构:
包含多行的字符串列表。
示例:
'User A'
-->
(1)
-->
1
(2)
-->
2
'User B'
-->
(1)
-->
0
(2)
-->
9
整数定义为:
TYPE number_arry IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
如何定义整个结构?
我想从这个表中填充这个结构:
RowId | User_A | User_B
------+--------+--------
1 | 1 | 0
2 | 2 | 0
3 | 3 | 9
用这些语句:
CURSOR c1
IS
SELECT User_A, User_B FROM my_table;
OPEN c1;
LOOP
FETCH c1
BULK COLLECT INTO
my_dict('User A'),
my_dict('User B')
LIMIT 1000;
EXIT WHEN c1%NOTFOUND;
END LOOP;
How to define in PL/SQL the following structure:
A list of strings which contains multiple rows.
Example:
'User A'
-->
(1)
-->
1
(2)
-->
2
'User B'
-->
(1)
-->
0
(2)
-->
9
The integers are defined as:
TYPE number_arry IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
How to define the whole structure ?
I want to fill this structure from this table:
RowId | User_A | User_B
------+--------+--------
1 | 1 | 0
2 | 2 | 0
3 | 3 | 9
With these statements:
CURSOR c1
IS
SELECT User_A, User_B FROM my_table;
OPEN c1;
LOOP
FETCH c1
BULK COLLECT INTO
my_dict('User A'),
my_dict('User B')
LIMIT 1000;
EXIT WHEN c1%NOTFOUND;
END LOOP;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用以下结构:
You could use the following structure: