In Oracle, you can use the trunc function to query the data of the day. This function can be used to intercept time or numerical values. Use this function with the select statement to query the data of the day. The syntax is "select*from. ..where trunc(...)=trunc(sysdate)”.
The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.
The syntax example is as follows:
select * from T_BASE where trunc(BASE_TIME)=trunc(sysdate)
TRUNC function description:
Used to intercept time or value and return the specified value.
Syntax
(1) Date processing:
TRUNC(date,[fmt])
Date is a necessary parameter, which is an input date value
The fmt parameter can be ignored, yes Date format, by default it represents 0 o'clock on the specified date.
(2) Numerical processing:
TRUNC(number,[decimals])
Number is a necessary parameter, which is a number value entered
The decimals parameter can be ignored, it is the number of digits to be intercepted, the default means truncating the value after the decimal point.
Examples are as follows:
Expand knowledge:
Processing numerical values:
--123.56,将小数点右边指定位数后面的截去; select trunc(123.567,2) from dual; --100,第二个参数可以为负数,表示将小数点左边指定位数后面的部分截去,即均以0记; select trunc(123.567,-2) from dual; --123,默认截去小数点后面的部分; select trunc(123.567) from dual;
Recommended tutorial:《 Oracle Video Tutorial》
The above is the detailed content of How to query the data of the day in oracle. For more information, please follow other related articles on the PHP Chinese website!