How to display table data more clearly in oracle sqlplus

后端 未结 4 1216
猫巷女王i
猫巷女王i 2020-11-28 04:13

I want to be able to display the resulting data from a select in a pretty way, not all columns under others.

Here is the way sqlplus displays my table data:

4条回答
  •  感动是毒
    2020-11-28 04:46

    If you mean you want to see them like this:

    WORKPLACEID NAME       ADDRESS        TELEPHONE
    ----------- ---------- -------------- ---------
              1 HSBC       Nugegoda Road      43434
              2 HNB Bank   Colombo Road      223423
    

    then in SQL Plus you can set the column widths like this (for example):

    column name format a10
    column address format a20
    column telephone format 999999999
    

    You can also specify the line size and page size if necessary like this:

    set linesize 100 pagesize 50
    

    You do this by typing those commands into SQL Plus before running the query. Or you can put these commands and the query into a script file e.g. myscript.sql and run that. For example:

    column name format a10
    column address format a20
    column telephone format 999999999
    
    select name, address, telephone
    from mytable;
    

提交回复
热议问题