dr_lke_anChi
SQL Sprint
15/05/2025
create or replace procedure PBH_MA_HDAC_HOI_LIST(
b_ma_dvi varchar2,b_nsd varchar2,b_pas varchar2,b_oraIn clob, b_oraOut out clob)
AS
b_loi varchar2(100); b_lenh varchar2(1000); b_gtri nvarchar2(500); b_nv varchar2(10);
b_proc_name varchar2(100);
b_kieu varchar2(1); b_dong number; b_tu number:=1; cs_lke clob;
begin
-- viet anh
delete temp_1; commit;
b_lenh:=FKH_JS_LENH('kieu,gtri,nv,proc_name');
EXECUTE IMMEDIATE b_lenh into b_kieu,b_gtri,b_nv,b_proc_name using b_oraIn;
PBH_MA_HDAC_LISTt(b_ma_dvi);
b_loi:=FHT_MA_NSD_KTRA(b_ma_dvi,b_nsd,b_pas,'BH','','');
if b_loi is not null then raise PROGRAM_ERROR; end if;
if b_kieu<>'C' then
PBH_MA_DMUC_LIST(b_oraIn,b_dong,cs_lke,b_loi);
elsif trim(b_gtri) is not null then
PBH_MA_DMUC_LIST_MA(b_oraIn,b_dong,cs_lke,b_loi);
else
PBH_MA_DMUC_LIST_SL(b_oraIn,b_tu,b_dong,cs_lke,b_loi);
end if;
if b_loi is not null then raise PROGRAM_ERROR; end if;
select json_object('kieu' value b_kieu,'dong' value b_dong,'tu' value b_tu,'cs_lke' value cs_lke returning clob) into b_oraOut from dual;
delete temp_1; commit;
exception when others then if b_loi is null then raise PROGRAM_ERROR; else raise_application_error(-20105,b_loi); end if;
end;
/
create or replace procedure PBH_MA_HDAC_LISTt(b_ma_dvi varchar2)
AS
b_ngay number:=PKH_NG_CSO(sysdate);
begin
-- viet anh
insert into temp_1(c1,c2,c3)
select '1',ma,ten from hd_ma_hd where ma_dvi=b_ma_dvi;
end;
b_ma_dvi varchar2,b_nsd varchar2,b_pas varchar2,b_oraIn clob, b_oraOut out clob)
AS
b_loi varchar2(100); b_lenh varchar2(1000); b_gtri nvarchar2(500); b_nv varchar2(10);
b_proc_name varchar2(100);
b_kieu varchar2(1); b_dong number; b_tu number:=1; cs_lke clob;
begin
-- viet anh
delete temp_1; commit;
b_lenh:=FKH_JS_LENH('kieu,gtri,nv,proc_name');
EXECUTE IMMEDIATE b_lenh into b_kieu,b_gtri,b_nv,b_proc_name using b_oraIn;
PBH_MA_HDAC_LISTt(b_ma_dvi);
b_loi:=FHT_MA_NSD_KTRA(b_ma_dvi,b_nsd,b_pas,'BH','','');
if b_loi is not null then raise PROGRAM_ERROR; end if;
if b_kieu<>'C' then
PBH_MA_DMUC_LIST(b_oraIn,b_dong,cs_lke,b_loi);
elsif trim(b_gtri) is not null then
PBH_MA_DMUC_LIST_MA(b_oraIn,b_dong,cs_lke,b_loi);
else
PBH_MA_DMUC_LIST_SL(b_oraIn,b_tu,b_dong,cs_lke,b_loi);
end if;
if b_loi is not null then raise PROGRAM_ERROR; end if;
select json_object('kieu' value b_kieu,'dong' value b_dong,'tu' value b_tu,'cs_lke' value cs_lke returning clob) into b_oraOut from dual;
delete temp_1; commit;
exception when others then if b_loi is null then raise PROGRAM_ERROR; else raise_application_error(-20105,b_loi); end if;
end;
/
create or replace procedure PBH_MA_HDAC_LISTt(b_ma_dvi varchar2)
AS
b_ngay number:=PKH_NG_CSO(sysdate);
begin
-- viet anh
insert into temp_1(c1,c2,c3)
select '1',ma,ten from hd_ma_hd where ma_dvi=b_ma_dvi;
end;