| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- set define off
- set echo on
- whenever sqlerror exit sql.sqlcode
- alter session set container=ORCLPDB;
- alter session set current_schema=PMS_TEST;
- declare
- v_count number;
- v_xh number;
- v_fwc clob;
- v_obj json_object_t;
- v_arr json_array_t;
- v_out clob;
- v_found boolean;
- type t_gw is table of number;
- type t_names is table of varchar2(100);
- v_gws t_gw := t_gw(102121, 1015484);
- v_names t_names := t_names('fjyrjc', 'fjyrjc_ck', 'fjyrjc_lr');
- procedure add_service(p_name varchar2) is
- begin
- for i in 0 .. v_arr.get_size - 1 loop
- if v_arr.get_string(i) = p_name then
- v_found := true;
- exit;
- end if;
- end loop;
- end;
- begin
- select count(*)
- into v_count
- from PMS_TEST.GRCD
- where SJGRCDID = 1025885
- and DXM = 'fjyrjc';
- if v_count = 0 then
- select nvl(max(XH), -1) + 1
- into v_xh
- from PMS_TEST.GRCD
- where GRCDMBID = 1011
- and SJGRCDID = 1025885;
- insert into PMS_TEST.GRCD
- (SJGRCDID, GRCDMBID, CAIDLBM, XH, MC, YWM, DXM, GNM, JLZTM, MS)
- values
- (1025885, 1011, 1, v_xh, '风纪仪容检查', null,
- 'fjyrjc', 'search', 1, '风纪仪容检查');
- end if;
- for g in 1 .. v_gws.count loop
- select FWC
- into v_fwc
- from PMS_TEST.GW
- where GWID = v_gws(g)
- for update;
- v_obj := json_object_t.parse(v_fwc);
- v_arr := v_obj.get_array('bjpj');
- if v_arr is null then
- v_arr := json_array_t();
- end if;
- for n in 1 .. v_names.count loop
- v_found := false;
- add_service(v_names(n));
- if not v_found then
- v_arr.append(v_names(n));
- end if;
- end loop;
- v_obj.put('bjpj', v_arr);
- v_out := v_obj.stringify;
- update PMS_TEST.GW
- set FWC = v_out
- where GWID = v_gws(g);
- end loop;
- commit;
- dbms_output.put_line('FJYRJC_MENU_PERMISSION_OK');
- end;
- /
- exit
|