Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Function min(date) not working on group by with to_char(date,'yyyy')

1618623Oct 26 2017 — edited Oct 31 2017

Hi guys,

I have an issue that I've neve seen before... It started when I upgraded my Oracle to version 12c.

Lets go to the problem...

I have a table that has following columns:

The first column is date type and the second is number.

Table1.png

I would like as result the min(dat_calendario) group by to_char(dat_calendario,'yyyy') and mes_445. It should take two rows.

DATA445 MES_445

-------- ----------

01/01/17 1

28/01/17 2

The following query is not working as expected as showing on print below:

pastedImage_17.png

I needed make a change on my query to solve this problem and now is working well. The clause group by to_char(dat_calendario,'yyyy'), mes_445 was changed to trunc(DAT_CALENDARIO,'year'), MES_445

pastedImage_18.png

The question is...

Is there any problem with the new version?

Regards,

Anderson Reis

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 28 2017
Added on Oct 26 2017
28 comments
3,809 views