Not a Valid month statement in oracle while querying -


i need in fixing 'not valid month' statement , below query working max function..

select max( y.file_sub_ret_date_time ) adpdba.work_request_file_trans_audit y y.file_event_type = 'submission' ,     y.file_submt_retrl_status = 'level1 posted' , y.file_sub_ret_date_time >= '01-dec-2015' , y.file_sub_ret_date_time <= '03-feb-2017' group y.wr_file_trans_info_id  

and output followed...

12/11/2015 1:44:33 pm 2/2/2017 3:42:02 pm 2/2/2017 3:42:02 pm 

now need rewrite query without max function , these queries prepared below. both display 'not valid month' statement..

select x.wr_file_trans_audit_id adpdba.work_request_file_trans_audit x x.file_sub_ret_date_time in  ('20170202034202','20170202034202','20151211014433')   select x.wr_file_trans_audit_id adpdba.work_request_file_trans_audit x x.file_sub_ret_date_time in  ('2017-02-02 03:42:02.0','2017-02-02 03:42:02.0','2015-12-11 01:44:33.0')  

can me rid of error please...

i think problem in date format. date columns, oracle try convert date based on nls default settings. sql, let's more specific , tell oracle how interpret date string, like...

(assuming date data type)

select x.wr_file_trans_audit_id  adpdba.work_request_file_trans_audit x  x.file_sub_ret_date_time in       (to_date('2017-02-02 03:42:02', 'yyyy-mm-dd hh24:mi:ss'),        to_date('2017-02-02 03:42:02', 'yyyy-mm-dd hh24:mi:ss'),        to_date('2015-12-11 01:44:33', 'yyyy-mm-dd hh24:mi:ss')       ); 

..or saw comment on timestamp column

select x.wr_file_trans_audit_id  adpdba.work_request_file_trans_audit x  x.file_sub_ret_date_time in       (to_timestamp ('2017-02-02 03:42:02', 'yyyy-mm-dd hh24:mi:ss'),        to_timestamp ('2017-02-02 03:42:02', 'yyyy-mm-dd hh24:mi:ss'),        to_timestamp ('2015-12-11 01:44:33', 'yyyy-mm-dd hh24:mi:ss')       ); 

Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -