0

I'm getting a really annoying bug. If I run a script with an a simple query as this:

SELECT C.cnum
FROM CLASS C
WHERE C.room = '115'

I get this output on the terminal and the cursor keeps blinking. I get the same result for several different queries.

SQL> @test.sql
  4  
double-beep
  • 5,031
  • 17
  • 33
  • 41

2 Answers2

0

Try putting a / on a new line.

double-beep
  • 5,031
  • 17
  • 33
  • 41
clq
  • 180
  • 9
  • Now i get the desired output. Why does this happen? – Aymen Rizwan Oct 13 '15 at 18:32
  • Glad to help :) End of file does not finish the script automatically as would be expected. – clq Oct 13 '15 at 18:40
  • @AymenRizwan: a `;` would be a better choice: http://stackoverflow.com/a/10207695/330315 –  Oct 13 '15 at 19:02
  • `/` is for executing embedded statements like PL/SQL not for a SQL statement. You should in fact use semi-colon. Also, using `/` in SQL statements, there is a chance that you might end up executing the query again which is in the buffer. so, semi-colon is a better choice in this case. – Lalit Kumar B Oct 14 '15 at 08:51
0
SELECT C.cnum
FROM CLASS C
WHERE C.room = '115'

You must terminate the SQL statement with semi-colon.

SELECT C.cnum
FROM CLASS C
WHERE C.room = '115';

Also, prefer using / for PL/SQL objects where you have lot of statements embedded. If you use / for SQL statements, chances are that you might end up executing the statement twice as the previous executed statement is in the current buffer, and / executes statements in the current buffer.

Lalit Kumar B
  • 47,486
  • 13
  • 97
  • 124