A statement written in the work
SELECT * FROM Bt_holiday where
To_char (setting_date, ' YYYY ') =substr (' 2015-03-00 ', 1,4) and
To_char (setting_date, ' MM ') =substr (' 2015-03-00 ', 6, (InStr (' 2015-03-00 ', '-') ')-(InStr (' 2015-03-00 ', '-', 1) +1))
Substr (' 2015-03-00 ', 6, (InStr (' 2015-03-00 ', '-', ') ')-(InStr (' 2015-03-00 ', '-', ' 1 ') +1)) The statement means the month in the acquisition date.
The function of the To_char () function is to convert a numeric or date type into a character type.
Select To_char (sysdate, ' YYYY ') from dual output: 2015
Select To_char (sysdate, ' MM ') from dual output: 08
Select To_date (' 2001-12-01 ', ' YYYY-MM-DD ') from dual output: 2001/12/01
Select Sysdate from dual output is: 2015/8/17 20:14:34
Substr (' Primitive string ', ' start of character ', ' intercept a few characters ')
Select Substr (' 2015-03-00 ', 1,4) from dual output to: 2015
Instr (' Source string string1 ', ' string to find in string1 string2 ', ' start with the first few characters ', ' to find the first occurrence of string string2 ') returns the position of the string to intercept in the source string
Oracle's time-to-string To_char (), string-to-time to_date (), and the use of substr and instr.