Jac*_*ter 8 oracle plsql oracle-apex
我面前有一段这样的代码:
FOR row IN 1..l_RowSet(1).count
LOOP
l_a_variable := l_RowSet(1)(row);
END LOOP;
Run Code Online (Sandbox Code Playgroud)
l_RowSet是一种ApEx类型 - apex_plugin_util.t_column_value_list由此定义:
type t_column_value_list is table of wwv_flow_global.vc_arr2 index by pls_integer;
Run Code Online (Sandbox Code Playgroud)
在哪里wwv_flow_global.vc_arr2定义为
type vc_arr2 is table of varchar2(32767) index by binary_integer;
Run Code Online (Sandbox Code Playgroud)
将vc_arr2被传递回从我的代码apex_plugin_util.get_data功能.vc_arr2由列号索引,而不是按行索引.
最好的我可以看出这意味着数据有效地存储在2D数组中,按列然后按行索引.
使用LOOP语句时,是从零还是从一个索引?因为在我看来我应该能够使LOOP多余,即:
l_a_variable := l_RowSet(1)(1);
Run Code Online (Sandbox Code Playgroud)
但我需要提前知道是否将0或1作为初始行.
我无法在Oracle文档中找到一个明确的答案(不出所料,"索引"是一个相当广泛使用的术语),并且通过SO查看也不会向任何其他人显示相同的问题.
关联数组不一定是密集的.索引0处可能有一个元素,索引为-1时可能有一个元素,索引1处可能有一个元素.或者您可能在索引17,42和127处有元素.您发布的代码表示关联数组很密集,索引从1开始.
在特定的情况下,apex_plugin_util.get_data集合应该是密集的,应该从1开始.如果循环实际上没有做任何你发布的内容,你可以通过获取最后一个元素来替换它l_RowSet(1),即
l_a_variable := l_RowSet(1)(l_RowSet(1).count);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12130 次 |
| 最近记录: |