Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle database uses cursors to convert uppercase numbers to lowercase numbers

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report