Skip to Main Content
  • Questions
  • Why this sql causes an internal error in Oracle?

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question.

Asked: November 28, 2018 - 9:23 pm UTC

Last updated: November 29, 2018 - 12:58 am UTC

Version: 12c, 11g

Viewed 1000+ times

You Asked

Hi!

I'm running this little SQL on 12c, also tried on 11g, and got an internal error on both. I couldn't understand why. Probably a bug, as noted by people in stackoverflow, where I originally asked about: https://stackoverflow.com/questions/53527981/why-this-sql-causes-an-internal-error-in-oracle

select 
  sysdate c1,
  sysdate c2,
  row_number() over(order by sysdate, sysdate desc) c3
from dual 
order by c3


It works if I remove the desc keyword from the row_number(). But I can keep the desc and remove any of the columns c1 e c2 and it also works. Still, I can remove the order by c3 or set it do desc and again it will work. Couldn't get why it doesn't works as is.

Thanks.

and Connor said...

ORA-00600 is a bug, simple as that. Think of it like a core dump in your application - we went down a code path we were not meant to.

SQL> select
  2    sysdate c1,
  3    sysdate c2,
  4    row_number() over(order by sysdate, sysdate desc) c3
  5  from dual
  6  order by c3;
  row_number() over(order by sysdate, sysdate desc) c3
                             *
ERROR at line 4:
ORA-00600: internal error code, arguments: [15851], [3], [2], [1], [1], [], [], [], [], [], [], []


There's a number of bug references on support.oracle.com for 15851. So there might already be a patch - you'd need to log a call with Support to progress this.

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library