Project

General

Profile

B_3043

SQL Sprint
18/04/2025

create or replace procedure PBH_MA_NGDD_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_ma_dvi_ct varchar2(20);
    b_kieu varchar2(1); b_dong number; b_tu number:=1; cs_lke clob;
begin
-- viet anh - ma nguoi dai dien
delete temp_1; commit;
b_lenh:=FKH_JS_LENH('kieu,gtri,ma_dvi_ct');
EXECUTE IMMEDIATE b_lenh into b_kieu,b_gtri,b_ma_dvi_ct using b_oraIn;
PBH_NG_DDIEN_LISTt(b_ma_dvi_ct);
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_NG_DDIEN_LISTt(b_ma_dvi_ct varchar2)
AS
    b_ngay number:=PKH_NG_CSO(sysdate);
begin
  -- viet anh
insert into temp_1(c1,c2,c3)
  select '1',ma,ten from ht_ma_nsd where ma_dvi=b_ma_dvi_ct;
end;

Files