Oracle SUBSTR Instruction Trunc____oracle

Source: Internet
Author: User
Tags oracle substr
substr (String, -10) 

Oracle string function substr (string, intercept start position, intercept length)
1. If the last intercept length parameter is empty, it means that the intercept starts at the bottom
2. If you intercept the start position To a number greater than 0, the beginning of the number from the left of the string
3. If the Intercept starts at a number less than 0, the number from the right of the string begins
--1. remove; @ Update  ggzyjyzx_zfcgxx t set T.ZBRQ=SUBSTR (t.zbrq,1,9)   where   T.ZBRQ like '%;@% '--2, remove the winning amount. Update  ggzyjyzx_zfcgxx t set T.zbjey=replace (T.zbjey, '? ', ')  --3, remove after the decimal point. Update ggzyjyzx_zfcgxx t    set T.zbjey = trunc (t.zbjey)  where t.zbjey like '%.00 '--4. Remove the first one in front of the amount. You can remove the previous second decimal point--substr function Default, start index, the default is all, if omitted, update  ggzyjyzx_zfcgxx t set t.zbjey= substr (T.zbjey, 1, InStr (
T.zbjey, '. ', 1, 1)-1 | |                  SUBSTR (T.zbjey,             &N Bsp           InStr (T.zbjey, '. ', 1, 1) + 1)      where substr (t.zbjey,-7,1) = '. '
      --4. Units changed to Yuan, update  ggzyjyzx_zfcgxx t set T.ZBJEY=NVL (t.zbjey,0) *10000 
--delete the last few on the right
--3, remove the back of the decimal point.
Update ggzyjyzx_zfcgxx t
set T.zbjey = substr (T.zbjey,1,length (T.zbjey)-3)
where T.zbjey like '%.00 '
--
--5, remove the number,
update ggzyjyzx_zfcgxx t
set t.zbjey = replace (T.zbjey, ', ', ', ')
--7, The Intercept string takes a specific symbol as the quasi-
update ggzyjyzx_zfcgxx t
set t.zbjey = case when
InStr (T.zbjey, ' (', 1,1) >0 Then > substr (T.zbjey,1,instr (T.zbjey, ' (', 1,1)-1) Else
T.zbjey End
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.