SELECT * from T_a A where A.begintime=to_date (' 2013-1-1 ', ' yyyy-mm-dd ');
and the
SELECT * from T_a A where To_char (a.begintime, ' yyyy-mm-dd ') = ' 2013-1-1 ';
the query results are the same.
the difference is that the processing steps of the query are not the same.
SELECT * from T_a A where A.begintime=to_date (' 2013-1-1 ', ' yyyy-mm-dd ');
is to first convert the string ' 2013-1-1 ' to a date format and then to compare it with the database.
if there are 1000 rows of data, then the operation is
1 characters converted to date, 1000 date comparison.
SELECT * from T_a A where To_char (a.begintime, ' yyyy-mm-dd ') = ' 2013-1-1 ';
is to convert the begintime of each row in the database into a character format and then compare it to the database.
if there are 1000 rows of data, then the operation is
1000 times the date is converted to characters, and 1000 string comparisons.
Related to Oracle Database To_date () and To_char ()