A third-party supplier delivered some SQL today but it did not work in SQL*Plus. We asked the supplier about this and it turned that the code had been tested in SQL Developer. The reason for the failure was as follows. If you end a line of SQL with a semi-colon then add a comment afterwards, SQL*Plus rejects it with an ORA-00911:
SQL> @test1
SQL> set echo on
SQL> select 'Comment->' from dual; /*Andrew was here*/
2 select 'More SQL' from dual;
select 'Comment->' from dual; /*Andrew was here*/
*
ERROR at line 1:
ORA-00911: invalid character
SQL>
To get the code to work, you need to include the comment before the semi-colon:
SQL> @test2
SQL> set echo on
SQL> select 'Comment->' from dual /*Andrew was here*/;
'COMMENT-
---------
Comment->
SQL> select 'More SQL' from dual;
'MORESQL
--------
More SQL
SQL>
However, if you try this in SQL Developer, both options work (as usual, click on the images to enlarge them and bring them into focus):