oracle string splicing numbers ||

      Now there is a requirement: take the truncation of the day in the string, and if it is less than 10, splice a 0 in front; if it is greater than or equal to 10, do not splice.

      I won't say how to intercept the string and how to judge it here.

      The oracle splicing string uses ||, the string can also be spliced ​​with numbers.

      Assuming that the intercepted day is 3, then it should be 03, and the following sql is no problem:

select 0 || 3 from student;

      

      Now there is a new demand, the day needs to be cut out +1. If it is less than 10 after +1, a 0 is spliced ​​in front; if it is greater than or equal to 10, it is not spliced.

select 0 || 3 + 1  from student;

      It stands to reason that 03 should be returned, but the actual return is 4.

      I guess whether it is a string plus a number or a numeric addition.

      It can be processed as follows:

select 0 || (3 + 1)  from student;

 

 

 

Published 48 original articles · Like 36 · Visits 130,000+

Guess you like

Origin blog.csdn.net/weixin_42845682/article/details/88825902