PL/SQL (MOSC)

MOSC Banner

Query returns two rows instead of one

edited Oct 5, 2018 6:34AM in PL/SQL (MOSC) 8 commentsAnswered

CREATE TABLE test (

col1 NUMBER);

insert into test(col1) values (1);

CREATE TABLE test2 (

col1 varchar2(10),

col2 varchar2(100)

);

insert into test2(col1, col2) values('1', 'Test 1');

insert into test2(col1, col2) values('01', 'Test 01');

select a.col1, (select max(b.col2) from test2 b where a.col1 = b.col1) from test a;

The select in the end returns two rows instead of one which is strange.

This appears in Oracle 12c and 18c but not in 11g.

Is this a bug in Oracle 12c and 18c?

Tagged:

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