SQL Language (MOSC)

MOSC Banner

count function behaviour on different database versions

edited Jun 18, 2019 5:00AM in SQL Language (MOSC) 3 commentsAnswered

Hi.

Recently we upgraded our database from 11.2.0.2 to 12.1.0.2. On new version, some SQL querries now return different results. For example, SQL query #1 below returned 1 row on the old database version, but on the new version now it returns no rows.

SQL query #1:

SELECT 1 FROM dual WHERE 1-(SELECT Count(1) FROM dual) = 0;

no rows returned

If I slightly change the query, both database versions return 1 record:

SQL query #2:

SELECT 1 FROM dual WHERE 1-(SELECT Count(1) FROM dual) = To_Number(0);

1 row returned

To me it looks like a bug in 12.1.0.2. Is this some known issue?

Thank you and best Regards,

Andrej

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center