Saturday, September 08, 2012

SQL*Plus word_wrapped Command

This was tested on Oracle 11.1.0.6.0 running on Windows XP. I SELECTed a piece of text from DUAL and it all came out on the same line:

SQL> select 'To be or not to be that is the question'
  2  Shakespeare from dual
  3  /

SHAKESPEARE
---------------------------------------
To be or not to be that is the question

SQL>

Then I made the linesize much shorter and the text was split over 2 lines:

SQL> set lines 20
SQL> l
  1  select 'To be or not to be that is the question'
  2* Shakespeare from dual
SQL> /

SHAKESPEARE
--------------------
To be or not to be t
hat is the question

SQL>

It did not look very good as one of the words was split too. To stop this happening, I used the SQL*Plus word_wrapped feature, which splits lines on word boundaries:

SQL> col Shakespeare word_wrapped
SQL> l
  1  select 'To be or not to be that is the question'
  2* Shakespeare from dual
SQL> /

SHAKESPEARE
--------------------
To be or not to be
that is the question

SQL>

No comments: