3

Is it possible to set multiple system variables in a single command?

For e.g. set the below system variables in a single line?

SET COLSEP '    '
SET ECHO OFF
SET FEEDBACK OFF
SET HEADING OFF
SET LINESIZE 10000
SET NEWPAGE NONE
SET TRIMSPOOL ON

Checked http://docs.oracle.com/cd/B19306_01/server.102/b14357/ch12040.htm#i2699283 but don't see an example of doing so.

3
  • No, you cannot do that. Commented Jun 24, 2014 at 14:06
  • Learned something new today! Commented Jun 24, 2014 at 18:45
  • I searched for ages for such a thing also and couldn't see any examples! Commented Jun 24, 2014 at 18:49

1 Answer 1

6

Is it possible to set multiple system variables in a single command?

Yes you can. Simply specify variable name/value pairs using space as a delimiter between previous variable's new value and the next variable's name. Here is an example:

/* display variables' current values */
SQL> show colsep echo feedback heading linesize

colsep " "
echo OFF
FEEDBACK ON for 6 or more rows
heading ON
linesize 80

/* Assign new values */
SQL> set colsep "|" echo on echo on feedback off heading off linesize 1000;

/* Make sure changes are in effect */
SQL> show colsep echo feedback heading linesize

colsep "|"
echo ON
feedback OFF
heading OFF
linesize 1000


SQL> spool off;

Note: When number of system variables are more than a few, this approach will drastically reduce readability. So it would be better to dedicate each variable/value pair its own SET command.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.