当我在Oracle plsql包中编译下面的代码时出现编译错误。错误如下:
PACKAGE BODY的编译错误tttt_KP_ALLOCATION
错误:PL / SQL:ORA-02287:此处不允许序列号 行:3465 文字:all_kp_prior_seq.nextval prior_seq_no,
错误:PL / SQL:忽略SQL语句 行:3404 文字:插入all_pat_list
tttt_sys_pkg.reset_sequence('ALL_KP_PRIOR_SEQ', 1);
insert into all_pat_list
(apl_id,
all_id,
prod_id,
prior_seq_no,
org_code,
all_step_no,
pat_id,
pat_name,
sex,
dob,
ped_ind,
blood_typ,
home_prov_code,
home_town,
org_code_registered,
org_descrip_registered,
hosp_id,
mrn,
oldr_code,
current_wait_list_stat_code,
init_wait_list_stat_date,
dis_code_prim_diag,
dis_code_sec_diag,
cadaver_liv_ind,
weight,
height,
abdom_girth,
chest_circum,
chest_vert_right,
chest_vert_left,
chest_transverse,
cmv,
ebv,
hepatitis_b_surface_ant,
hepatitis_c,
prev_trnsplt_no,
all_step_descrip,
eff_date,
hcv_rna,
dsa_cur_unaccp1,
dsa_acc_unaccp1,
dsa_cur_indet1,
dsa_acc_indet1,
dsa_cur_unaccp2,
dsa_acc_unaccp2,
dsa_cur_indet2,
dsa_acc_indet2,
x_match_serum_date,
x_match_b_cell_res_ind,
x_match_t_cell_res_ind,
current_pra,
current_pra_date,
peak_pra,
peak_pra_date,
kp_allocation_points,
cpra,
patr_id)
select apl_id,
all_id,
prod_id,
all_kp_prior_seq.nextval prior_seq_no,
org_code,
all_step_no,
pat_id,
pat_name,
sex,
dob,
ped_ind,
blood_typ,
home_prov_code,
home_town,
org_code_registered,
org_descrip_registered,
hosp_id,
mrn,
oldr_code,
current_wait_list_stat_code,
init_wait_list_stat_date,
dis_code_prim_diag,
dis_code_sec_diag,
cadaver_liv_ind,
weight,
height,
abdom_girth,
chest_circum,
chest_vert_right,
chest_vert_left,
chest_transverse,
cmv,
ebv,
hepatitis_b_surface_ant,
hepatitis_c,
prev_trnsplt_no,
all_step_descrip,
eff_date,
hcv_rna,
dsa_cur_unaccp1,
dsa_acc_unaccp1,
dsa_cur_indet1,
dsa_acc_indet1,
dsa_cur_unaccp2,
dsa_acc_unaccp2,
dsa_cur_indet2,
dsa_acc_indet2,
x_match_serum_date,
x_match_b_cell_res_ind,
x_match_t_cell_res_ind,
current_pra,
current_pra_date,
peak_pra,
peak_pra_date,
kp_allocation_points,
cpra,
patr_id
from temp_kp_all_pat_list_pool
order by prior_seq_no;
谁可以帮助我将非常感谢!!!请给我正确的代码,非常感谢。
阅读Ed的帖子后,我修改了下面的代码,它现在可以通过编译。
tttt_sys_pkg.reset_sequence('ALL_KP_PRIOR_SEQ', 1);
insert into all_pat_list
(apl_id,
all_id,
prod_id,
prior_seq_no,
org_code,
all_step_no,
pat_id,
pat_name,
sex,
dob,
ped_ind,
blood_typ,
home_prov_code,
home_town,
org_code_registered,
org_descrip_registered,
hosp_id,
mrn,
oldr_code,
current_wait_list_stat_code,
init_wait_list_stat_date,
dis_code_prim_diag,
dis_code_sec_diag,
cadaver_liv_ind,
weight,
height,
abdom_girth,
chest_circum,
chest_vert_right,
chest_vert_left,
chest_transverse,
cmv,
ebv,
hepatitis_b_surface_ant,
hepatitis_c,
prev_trnsplt_no,
all_step_descrip,
eff_date,
hcv_rna,
dsa_cur_unaccp1,
dsa_acc_unaccp1,
dsa_cur_indet1,
dsa_acc_indet1,
dsa_cur_unaccp2,
dsa_acc_unaccp2,
dsa_cur_indet2,
dsa_acc_indet2,
x_match_serum_date,
x_match_b_cell_res_ind,
x_match_t_cell_res_ind,
current_pra,
current_pra_date,
peak_pra,
peak_pra_date,
kp_allocation_points,
cpra,
patr_id)
select apl_id,
all_id,
prod_id,
all_kp_prior_seq.nextval prior_seq_no,
org_code,
all_step_no,
pat_id,
pat_name,
sex,
dob,
ped_ind,
blood_typ,
home_prov_code,
home_town,
org_code_registered,
org_descrip_registered,
hosp_id,
mrn,
oldr_code,
current_wait_list_stat_code,
init_wait_list_stat_date,
dis_code_prim_diag,
dis_code_sec_diag,
cadaver_liv_ind,
weight,
height,
abdom_girth,
chest_circum,
chest_vert_right,
chest_vert_left,
chest_transverse,
cmv,
ebv,
hepatitis_b_surface_ant,
hepatitis_c,
prev_trnsplt_no,
all_step_descrip,
eff_date,
hcv_rna,
dsa_cur_unaccp1,
dsa_acc_unaccp1,
dsa_cur_indet1,
dsa_acc_indet1,
dsa_cur_unaccp2,
dsa_acc_unaccp2,
dsa_cur_indet2,
dsa_acc_indet2,
x_match_serum_date,
x_match_b_cell_res_ind,
x_match_t_cell_res_ind,
current_pra,
current_pra_date,
peak_pra,
peak_pra_date,
kp_allocation_points,
cpra,
patr_id
from (select apl_id,
all_id,
prod_id,
prior_seq_no,
org_code,
all_step_no,
pat_id,
pat_name,
sex,
dob,
ped_ind,
blood_typ,
home_prov_code,
home_town,
org_code_registered,
org_descrip_registered,
hosp_id,
mrn,
oldr_code,
current_wait_list_stat_code,
init_wait_list_stat_date,
dis_code_prim_diag,
dis_code_sec_diag,
cadaver_liv_ind,
weight,
height,
abdom_girth,
chest_circum,
chest_vert_right,
chest_vert_left,
chest_transverse,
cmv,
ebv,
hepatitis_b_surface_ant,
hepatitis_c,
prev_trnsplt_no,
all_step_descrip,
eff_date,
hcv_rna,
dsa_cur_unaccp1,
dsa_acc_unaccp1,
dsa_cur_indet1,
dsa_acc_indet1,
dsa_cur_unaccp2,
dsa_acc_unaccp2,
dsa_cur_indet2,
dsa_acc_indet2,
x_match_serum_date,
x_match_b_cell_res_ind,
x_match_t_cell_res_ind,
current_pra,
current_pra_date,
peak_pra,
peak_pra_date,
kp_allocation_points,
cpra,
patr_id
from temp_kp_all_pat_list_pool
order by prior_seq_no);
答案 0 :(得分:1)
我只是尝试了类似的东西,认为它是分配给序列值的别名。你不需要别名,但事实证明它是无害的。
问题?这是order by
。如果你摆脱它,错误将消失。在做INSERT
时,订单无论如何都不应该真正重要。