我试图做一个选择,我得到一个超出计数的ORA-06533子目录。 我不明白为什么会出现这个错误,因为select中没有下标。
我发布相关代码:
TYPE Item IS RECORD (
entity number,
period number,
value NUMBER);
TYPE ItemSet IS TABLE OF Item;
modelo_pd ItemSet;
select id_scenario into sid from sae_lc_scen_var where us_type = num and type = 0 and id_segment = pid;
str := 'select distinct bd.entity_id, v.period_id, v.number_attribute_46 pd_pit
from sae_scenario s, sae_baseline b, sae_baseline_data bd, sae_entity e, v_sae_scenario_data v
where s.id = ' || sid || ' and b.scenario_type = s.scenario_type and b.id = bd.baseline_id
and bd.entity_id = e.id and b.id = s.baseline_id and v.scenario_id = s.id and v.baseline_id = b.id
and e.string_attribute_1 = ''' || t.name || ''' and v.e_string_attribute_1 = e.string_attribute_1';
execute immediate str bulk collect into modelo_pd;
查询的参数来自另外两个查询:
select id_scenario into sid from sae_lc_scen_var where us_type = num and type = 0 and id_segment = pid;
和循环:
for t in (select v.id_segment, s.name, v.value expert, v.value3 selection, v.value2 correction from sae_lc_scen_var v, sae_lc_segments s
where v.us_type = 1 and v.type = 0
and s.id = v.id_segment and v.value <> 0)
动态选择中出现错误。那是execute immediate str bulk collect into modelo_pd;
任何线索?
完整的事情:
num := get_constant('US_TYPE_EAD_AGGREGATE');
for t in (select v.id_segment, s.name, v.value expert, v.value3 selection, v.value2 correction from sae_lc_scen_var v, sae_lc_segments s
where v.us_type = 1 and v.type = 0
and s.id = v.id_segment and v.value <> 0)
loop
-- value3: 0=Model, 1=Proxy VMG, 2=Expert, 3=PD_TTC
num := get_constant('US_TYPE_LGD_CALC_METHOD');
if t.selection = 0 then
num := get_constant('US_TYPE_MODELOS_PD');
select id_scenario into sid from sae_lc_scen_var where us_type = num and type = 0 and id_segment = pid;
str := 'select distinct bd.entity_id, v.period_id, v.number_attribute_46 pd_pit
from sae_scenario s, sae_baseline b, sae_baseline_data bd, sae_entity e, v_sae_scenario_data v
where s.id = ' || sid || ' and b.scenario_type = s.scenario_type and b.id = bd.baseline_id
and bd.entity_id = e.id and b.id = s.baseline_id and v.scenario_id = s.id and v.baseline_id = b.id
and e.string_attribute_1 = ''' || t.name || ''' and v.e_string_attribute_1 = e.string_attribute_1';
execute immediate str bulk collect into modelo_pd;
答案 0 :(得分:0)
我找到了错误的来源。
该选择没有行,所以当我使用modelo_pd
时会出现错误。
对我来说不清楚的是它为什么在使用下标之前给出行号。