g*******l 发帖数: 6 | 1 I tried to do such a query against USER_OBJECTS :
SELECT * FROM USER_OBJECTS WHERE CREATED='10/15/2002';
It shows no row selected, but I know there is an object in the view.
If I change the query to :
SELECT * FROM USER_OBJECTS WHERE OBJECT_NAME='thename';
It will show:
OBJECT_NAME: thename
CREATED: 10/15/2002
And if I retrieve data from a user-defined table also based on the date, it is
fine. For example:
SELECT * FROM my_table WHERE enroll_date='10/15/2002';
the type of ENROLL_DATE is DATE too | s****d 发帖数: 13 | 2 when i do date related staff, i prefer
where to_char(enroll_date,'mm-dd-yyyy')='10-15-2002'
so u dont need to consider the format difference.
is
【在 g*******l 的大作中提到】 : I tried to do such a query against USER_OBJECTS : : SELECT * FROM USER_OBJECTS WHERE CREATED='10/15/2002'; : It shows no row selected, but I know there is an object in the view. : If I change the query to : : SELECT * FROM USER_OBJECTS WHERE OBJECT_NAME='thename'; : It will show: : OBJECT_NAME: thename : CREATED: 10/15/2002 : And if I retrieve data from a user-defined table also based on the date, it is : fine. For example:
| a****c 发帖数: 25 | 3 Actually the default date format in Oracle is 'DD-MON-YY', such as
'17-OCT-02'. You can use it without any format strings. I guess the CREATED
field in USER_OBJECTS is something like 'DD-MON-YYYY HH24:MI:SS' , so you
wound get any hit by simply providing the date for your query. You might try
WHERE created > '15-OCT-2002'. See what would happen then. :)
it
【在 s****d 的大作中提到】 : when i do date related staff, i prefer : where to_char(enroll_date,'mm-dd-yyyy')='10-15-2002' : so u dont need to consider the format difference. : : is
|
|