I’m encountering a strange problem with Oracle SQL Developer where including a line comment disrupts my query from executing correctly.
The following query works without any issues when run:
select 12 id, date '2024-01-15' orderDate, 25 qty, 148.75 amount, 2 status from dual union all
select 12 id, date '2024-01-16' orderDate, 33 qty, 267.89 amount, 2 status from dual union all
select 12 id, date '2024-01-17' orderDate, 51 qty, 423.56 amount, 2 status from dual union all
select 12 id, date '2024-01-18' orderDate, 19 qty, 315.42 amount, 2 status from dual union all
select 12 id, date '2024-01-20' orderDate, 87 qty, 654.33 amount, 2 status from dual union all
select 12 id, date '2024-01-21' orderDate, 76 qty, 589.67 amount, 2 status from dual union all
select 12 id, date '2024-01-22' orderDate, 145 qty, 789.12 amount, 2 status from dual union all
select 12 id, date '2024-01-25' orderDate, 38 qty, 456.78 amount, 2 status from dual union all
select 12 id, date '2024-01-28' orderDate, 42 qty, 678.90 amount, 2 status from dual union all
select 12 id, date '2024-01-30' orderDate, 156 qty, 234.56 amount, 2 status from dual union all
select 12 id, date '2024-02-01' orderDate, 67 qty, 567.89 amount, 2 status from dual union all
select 12 id, date '2024-02-03' orderDate, 23 qty, 345.67 amount, 2 status from dual union all
select 12 id, date '2024-02-05' orderDate, 89 qty, 123.45 amount, 2 status from dual union all
select 12 id, date '2024-02-07' orderDate, 134 qty, 890.12 amount, 2 status from dual union all
select 12 id, date '2024-02-10' orderDate, 45 qty, 456.78 amount, 2 status from dual
However, when I append a comment using double dashes at the end of the first line like this:
select 12 id, date '2024-01-15' orderDate, 25 qty, 148.75 amount, 2 status from dual union all --
select 12 id, date '2024-01-16' orderDate, 33 qty, 267.89 amount, 2 status from dual union all
select 12 id, date '2024-01-17' orderDate, 51 qty, 423.56 amount, 2 status from dual union all
I receive the following error:
ORA-00928: missing SELECT keyword
Is this a recognized issue in SQL Developer, or could it be that I’m overlooking something? Using block comments is a viable workaround, but I’m curious as to why line comments create this complication.