1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
SQL> create table test_date(id number, col_date date);
Table created
SQL> insert into test_date(id, col_date) values (1, sysdate);
1 row inserted
SQL> insert into test_date(id, col_date) values (2, sysdate);
1 row inserted
SQL> insert into test_date(id, col_date) values (3, sysdate);
1 row inserted
SQL> insert into test_date(id, col_date) values (4, sysdate);
1 row inserted
SQL> commit;
Commit complete
SQL> select * from test_date;
ID COL_DATE
---------- -----------
1 15/09/2009
2 15/09/2009
3 15/09/2009
4 15/09/2009
SQL> select to_char(COL_DATE, 'dd/mm/yyyy hh24:mi:ss') from test_date;
TO_CHAR(COL_DATE,'DD/MM/YYYYHH
------------------------------
15/09/2009 15:21:08
15/09/2009 15:21:14
15/09/2009 15:21:20
15/09/2009 15:21:31
SQL> select count(*), col_date from test_date group by col_date;
COUNT(*) COL_DATE
---------- -----------
1 15/09/2009
1 15/09/2009
1 15/09/2009
1 15/09/2009
SQL> select count(*), to_char(col_date, 'dd/mm/yyyy') from test_date group by to_char(col_date, 'dd/mm/yyyy');
COUNT(*) TO_CHAR(COL_DATE,'DD/MM/YYYY')
---------- ------------------------------
4 15/09/2009
SQL> |
Partager