Get the App
SLTechnology News&Howtos  ›  Database  › 

Oracle database uses cursors to convert uppercase numbers to lowercase numbers

Shulou Source: shulou.com Published: 2022-06-01 15:27:21 09月25日 Update

The project meets requirements and needs to convert uppercase numbers to lowercase. The code is as follows:

Declaret_zl varchar2, t_ts varchar2, number;hh varchar2, xx varchar2, type TIArray is table of varchar2, type TCArray is table of varchar2, A TIArray; B TCArray;cursor c is select zl,tstybm from fc_h_qsdc2 Begin A:=TIArray ('47','46','45','44','43','42','41','39','38','37','36','35','34','33','32','31','29','28','27','26' '40','24','23','22','21','25','30','20','19','18','17','16','15','14','13','12','11', 'ten', 'nine', 'eight', 'seven', 'six', 'five', 'four', 'three', 'two' 'one') B:=TCArray ('47' recorder,' 46', '45',' 44', '41',' 39', '38',' 36', '35',' 34', '33',' 32', '31',' 29', '28',' 27', '26',' 25', '24',' 23', '22',' 21', '40',' 30', '20',' 19', '18',' 17'. "16", "15", "14", "13", "12", "11", "11", "10", "9",'8 "," 7 "," 6 "," 5 "," 4 "," 3 "," 2 "," 1') Open c; loop fetch c into tyogzl and length; exit when c% notched; for i in 1.. 47 loop select instr (tweezlMagi A (I)) into xx from dual; if (xx > 0 ZL (A (I)) = 3) then hh:=substr | | B (I) | | substr (tweezl Magnesia xxanth3) Elsif (xx > 0 and length (A (I)) = 2) then hh:=substr | | B (I) | | substr (tweezlline xxwords 2); elsif (xx > 0 and length (A (I)) = 1) then hh:=substr (tweezllidllium xxway1) | | B (I) | substr (tweezlline xwords 1); else hh:=t_zl; end if; Tasking zl vig end loop; update fc_h_qsdc2 set zl=t_zl where tstybm=t_ts; end loop; close c; end

Note: to achieve the key points, use (type type_name is table of {column_type | variable_name%type | table_name.column_name%type | table_name%rowtype} [not null] index by {pls_integer | binary_tnteger | varchar2 (v_size)}) this type is similar to an array, and use the key value to find the corresponding value.

2016-05-11

Tags: Uppercase lowercase numbers code keys arrays types requirements projects data databases cursors Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Xiaomi vpn Huawei NVidia