4

I'm working on a solution where several SQL and PL/SQL scripts are being run together, in a batch of sorts, via SQL*Plus.

I'm declaring SET ECHO OFF; and SET ECHO ON; at relevant points in the scripts so as to output relevant code.

Currently the output looks something like this:

SQL> DECLARE
  2      ct number := 0;
  3      ctChanges number := 0;
  4  
  5  BEGIN
  6      select count(*) into ct from ...
  7  (...rest of code block...)
"some specific status message"
Commit executed.

We keep this output as a run-log in our build-environment, but can also access it as a plain text file.

One downside of this format however, is that if I'd like to copy a certain section of the code and run it again in an IDE (like Toad or SQL Developer), it's hard to exclude the line numbers.

Is it possible to tell SQL*Plus to output the code as above, but without including the line numbers?

GMB
  • 216,147
  • 25
  • 84
  • 135
Kjartan
  • 18,591
  • 15
  • 71
  • 96

1 Answers1

9

You can use options sqlnumber and sqlprompt:

set sqlprompt ''
set sqlnumber off

SET SQLN[UMBER] {ON|OFF}

SET SQLNUMBER is not supported in iSQL*Plus

Sets the prompt for the second and subsequent lines of a SQL command or PL/SQL block. ON sets the prompt to be the line number. OFF sets the prompt to the value of SQLPROMPT.

GMB
  • 216,147
  • 25
  • 84
  • 135