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

[teacher Zhao Qiang] the character function of SQL

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

Share

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

Character functions, as the name implies, operate on strings. From the following figure, let's take a look at the character function of Oracle.

The case control functions lower, upper, initcap1 2select lower ('Hello World') are converted to lowercase, upper (' Hello World') to uppercase, and initcap ('hello world') to uppercase from dual

Character control function

Substr (aforme b) starts with bit b from a.

1select substr ('Hello World', 3) from dual

Substr (a dint b ~ C) starts with bit b in a, and takes bit c.

1select substr ('Hello World', 3pr 4) from dual

Number of length characters lengthb bytes

1 2 3 45 from dual;-for English, the number of characters is the same as the number of bytes: select length ('Hello World') characters, lengthb (' Hello World') bytes from dual;-for Chinese, the number of characters equals two bytes select length ('China') characters, lengthb ('China') bytes from dual

Instr (a ll' b) in a, find the b1select instr ('Hello World',' ll') location from dual

Lpad left fill, rpad right fill

1select lpad ('abcd', 10,' *') left, rpad ('abcd', 10,' *') right from dual

Trim removes the specified characters before and after: remove the'H' before and after.

1select trim ('H' from 'Hello WorldH') from dual

Replace replacement

1select replace ('Hello World',' l','*') from dual

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