Can I make SQL*Plus output more readable like this ?

Version : 11.2
Can I make sql results more readbale like below using SqlPlus ? ie. enclosing result columns neatly in a table like structure.
+------------+------------+
| department | Avg Salary |
+------------+------------+
| Finance    | 63863.2479 |
| Hardware   | 66308.3700 |
| HR         | 66402.6549 |
| QA         | 66012.7119 |
| Software   | 61928.2700 |
| Switch     | 66413.2231 |
+------------+------------+I think this is from MySQL or Postgress (the below doesn't anything about that)
http://guylichtman.com/db-spring06/hw1_solution_sql.txt
If not possible using SQL*Plus , can this be done using some other tools like PL/SQL developer (which we have) ?
Not a business case . I just want to send some SQL training stuff to my friend.
Moreover , during posting in OTN, it would be better to post some sample data , so that volunteer gurus can quickly understand what they are looking at.

Hi,
GarryB wrote:
Version : 11.2
Can I make sql results more readbale like below using SqlPlus ? ie. enclosing result columns neatly in a table like structure.The default output is in a table-like structure, with rows and columns, and with the columns aligned. It looks like you want extra lines around those rows and columns.
+------------+------------+
| department | Avg Salary |
+------------+------------+
| Finance    | 63863.2479 |
| Hardware   | 66308.3700 |
| HR         | 66402.6549 |
| QA         | 66012.7119 |
| Software   | 61928.2700 |
| Switch     | 66413.2231 |
+------------+------------+COLSEP is an easy way to get some of what you want:
SQL> SET  COLSEP  "  |  "
SQL> SELECT * FROM scott.dept;
    DEPTNO  |  DNAME           |  LOC
----------  |  --------------  |  -------------
        10  |  ACCOUNTING      |  NEW YORK
        20  |  RESEARCH        |  DALLAS
        30  |  SALES           |  CHICAGO
        40  |  OPERATIONS      |  BOSTONSQL*Plus can also generate HTML output, but you have to use a browser, not the SQL*Plus interface, to get see the output formatted.
I think this is from MySQL or Postgress (the below doesn't anything about that)
http://guylichtman.com/db-spring06/hw1_solution_sql.txt
If not possible using SQL*Plus , can this be done using some other tools like PL/SQL developer (which we have) ?
Not a business case . I just want to send some SQL training stuff to my friend.
Moreover , during posting in OTN, it would be better to post some sample data , so that volunteer gurus can quickly understand what they are looking at.If we could get everyone on this forum to post any kind of formatted output, that would be wonderful! Personally, the extra lines wouldn't help me any, however.

Similar Messages

  • Can I use SQL *Plus 11.1.0.7.0 to connect Oracle Express 10g

    Hi guys:
    I download "Oracle 11g ODAC *11.1.0.7.20* with Oracle Developer Tools for Visual Studio", trying to use SQL *plus to see if configuration is alright.
    But after entering account/pwd, I got a error:
    ORA-12560: TNS:protocol adapter error
    What is wrong with my environment?
    Thanks,
    Ricky

    user12086319 wrote:
    Hi EdStevens,
    Following the instructions in previous post, I can connect with SQL plus (the database is on the same box* as your sqlplus client); I just enter sqlplus in windows console.
    In addition, i am still curious about how SQL plus connect to a remote* box. Could you shed more light on that?SQLPlus connects to a remote db the same way any other app does. After all, sqlplus is just another client app.
    It's all in the connect string. So say, at a command prompt you enter
    $> sqlplus scott/tiger@mydbso in the above example, 'scott' is the user, 'tiger' is the password, and 'mydb' is the tns service name. Of course, the OS passes all that to sqlplus as a command line parameter. Internally, sqlplus makes a call to the tns layer and passes it the connect information it has. TNS will take a look at the tnsnames.ora file and find an entry for 'mydb', and from there it will get the name or ip address of the host server, a port number, and a service name. That information will be passed on down the network stack for routing. (If a name was provided instead of an ip address, the OS network stack will use whatever means are at its disposal - a hosts file, a dns lookup, or whatever, to get an ip address). The request will arrive at the specified host and placed on the specified port. If everything was configured correctly, there will be an oracle listener process monitoring that port. It will pick up the request and see if it recognizes the service name. If it does, it will spawn a user server process on a different port to complete the connection, then get out of the way and continue listening for more requests.
    This is how it happens most of the time. There are a lot of other variants, but that's the gist of it.
    More information can be found in the fine documentation at tahiti.oracle.com.

  • How to establish code standards to make the abap code more readability

    Every programmer have their habit to code, but this lead a problem , it is difficult to read other people's code, especially the complex logic.
    So how to establish code standards to make the abap code more readability?
    I came up with this:
    1.Unify the naming rule.
    2.Reduce the nest of 'if' statement. (better in less than 4 if statement in one block )
    3.Use more Perform to replace the big code block.
    Is there any other standards to make our abap code more readability ?  (if we establish the standards, in sap is there any tool to help us to follow the rule we set ?)

    There are a number of things you could do. Some of which are:
    I would recommend creating your own in-house document on Coding standards, some of which you can control with the code inspector.
    It is also possible to set up the transport request in such a way that objects that do not pass the SCI test are not allowed to be released.
    I would also assign a senior developer to act as quality control for all developments. You can have a rotation scenario where this work can be divided by the number of senior developers you have.

  • Can you make a movie for more than 2 minutes on an ipad and save it on a flash drive

    Can you make a movie for more than two minutes on the ipad and sve it on a flash drive using windows XP

    Using Apple's camera connection kit, you can use a flash drive to IMPORT photos and videos. However, you can't EXPORT any type of file to the flash drive.
     Cheers, Tom

  • Can not start SQL Plus

    Hi friends
    I have installed oracle 9i on windows XP successfully.
    I can't start SQL plus, i am typing scott as username and tiger as password then it gives me TNS protocol error.
    Please help me, how shall I fix this problem.
    Thanks
    Harish

    the service might not exist yet in the services panel. you'll have to execute the following command from the server where Oracle is installed:
    c:\> lsnrctl start
    You should receive a series of messages about the listener starting. Then re-check the services as described above and you should see it there.

  • HT4061 how can i make my iphone 4 work again from this activation lock thing?

    how can i make my iphone 4 work again from this activation lock thing?

    Can you provide more info.  iOS version?  Did you have iOS 7 BETA installed previously?  (if so, go to your developer account at developer.apple.com to fix things)
    Try this link...
    http://support.apple.com/kb/ts3424

  • I am frustrated with how my cursor jumps around while typing.  How can I make the arrow follow the cursor so this doesn't happen?

    Macbook Pro with OSX Yosemite:  I am frustrated that when using Word for Mac, the cursor keeps jumping around all over the page.  How can I make the pointer follow the cursor so this stops?

    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]

  • I am about to buy spice fire one that runs through firefox operating system. So my question is that can I make a voice call using skype through this device ?

    hie myself Paras from India
    I am about to buy spice fire one that runs through firefox operating system. So my question is that can I make a voice call using skype through this device ?
    please mail me your answer at [email protected]
    edited email address as per the [https://support.mozilla.org/en-US/kb/forum-rules-and-guidelines Forum rules and guidelines]. You should get email notifications of replies to this thread.

    With firefox OS 2.0 and above you can use appear.in to make video and audio calls via webrtc

  • HT1420 how do i removel the silly security questions,  i purchased music in the past and now it asking for them and i can't remember the answers.  I dont like this feature if it remembers and verifys your password

    how do i removel the silly security questions,  i purchased music in the past and now it asking for them and i can't remember the answers.  I dont like this feature if it remembers and verifys your password

    Click here for information. If the option to have the answers emailed to you isn't available or doesn't work(the email may take a few hours to arrive), contact the iTunes Store staff via the link in the 'Additional Information' section of that article.
    (90135)

  • Connect via SQL*Plus taking more time in Oracle 11 than in 10

    Oracle Version
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Productioncurrently migrating from
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0      Production
    TNS for IBM/AIX RISC System/6000: Version 10.2.0.4.0 - Productio
    NLSRTL Version 10.2.0.4.0 - ProductionOS is AIX 5.3 for Oracle 10 and AIX 6.1 for Oracle 11.
    We are currently in the process of migrating some applications from Oracle 10 to 11. Our admins have setup a new development system for us with an Oracle 11 instance. Regarding performance the new system behaves more or less the same than our old, e.g. when executing SQLs we notice hardly any performance differences and those we find are slightly in favour of the new system.
    But now we discovered that the time it takes to establish a database connection via SQL*Plus is longer on the Oracle 11 system. Running the following code
    sqlplus -s user/pw@database <<END
    quit
    ENDa thousand times takes ~60s under Oracle 10 but ~140s under Oracle 11. This may not seem much but we are running a test framework consisting of a bunch of shell scripts where several thousand connections are openend via SQL*Plus to execute some SQLs, so that even this small time difference results in rather huge difference in total runtime. The SQLs themself require roughly the same time in both databases, as already mentioned above they are in fact slightly faster in Oracle 11.
    To analyze the time difference I ran a trace for the connect with the following parameters in sqlnet.ora
    TRACE_LEVEL_CLIENT=4
    TRACE_UNIQUE_CLIENT=ONand found out that there is a time difference of about 70ms during the connect handshake:
    Oracle 10
    [22-MAR-2013 12:13:09:595] nscon: doing connect handshake...
    [22-MAR-2013 12:13:09:595] nscon: sending NSPTCN packet
    [22-MAR-2013 12:13:09:621] nscon: got NSPTRS packet
    [22-MAR-2013 12:13:09:621] nscon: sending NSPTCN packetOracle 11
    (1) [22-MAR-2013 12:15:26:812] nscon: doing connect handshake...
    (1) [22-MAR-2013 12:15:26:812] nscon: sending NSPTCN packet
    (1) [22-MAR-2013 12:15:26:906] nscon: got NSPTRS packet
    (1) [22-MAR-2013 12:15:26:906] nscon: sending NSPTCN packetUnder Oracle 10 there are 26ms between sending the NSPTCN packet and getting the NSPTRS packet, whereas under Oracle 11 this takes 94ms. I ran the trace again, this time with
    TRACE_LEVEL_CLIENT=16and got the following results for the critical interval:
    Oracle 10:
    [22-MAR-2013 13:17:37:638] nscon: sending NSPTCN packet
    [22-MAR-2013 13:17:37:638] nspsend: entry
    [22-MAR-2013 13:17:37:638] nspsend: plen=218, type=1
    [22-MAR-2013 13:17:37:638] nttwr: entry
    [22-MAR-2013 13:17:37:638] nttwr: socket 9 had bytes written=218
    [22-MAR-2013 13:17:37:638] nttwr: exit
    [22-MAR-2013 13:17:37:638] nspsend: packet dump
    <<packet dump removed>>
    [22-MAR-2013 13:17:37:638] nspsend: 218 bytes to transport
    [22-MAR-2013 13:17:37:638] nspsend: normal exit
    [22-MAR-2013 13:17:37:638] nscon: exit (0)
    [22-MAR-2013 13:17:37:638] nsdo: nsctxrnk=0
    [22-MAR-2013 13:17:37:638] nsdo: normal exit
    [22-MAR-2013 13:17:37:638] nsdo: entry
    [22-MAR-2013 13:17:37:638] nsdo: cid=0, opcode=68, *bl=512, *what=9, uflgs=0x0, cflgs=0x3
    [22-MAR-2013 13:17:37:638] nsdo: rank=64, nsctxrnk=0
    [22-MAR-2013 13:17:37:638] nsdo: nsctx: state=2, flg=0x4005, mvd=0
    [22-MAR-2013 13:17:37:638] nsdo: gtn=10, gtc=10, ptn=10, ptc=2011
    [22-MAR-2013 13:17:37:638] nscon: entry
    [22-MAR-2013 13:17:37:638] nscon: recving a packet
    [22-MAR-2013 13:17:37:638] nsprecv: entry
    [22-MAR-2013 13:17:37:638] nsprecv: reading from transport...
    [22-MAR-2013 13:17:37:638] nttrd: entry
    [22-MAR-2013 13:17:37:665] nttrd: socket 9 had bytes read=8
    [22-MAR-2013 13:17:37:665] nttrd: exit
    [22-MAR-2013 13:17:37:665] nsprecv: 8 bytes from transport
    [22-MAR-2013 13:17:37:665] nsprecv: tlen=8, plen=8, type=11
    [22-MAR-2013 13:17:37:665] nsprecv: packet dump
    [22-MAR-2013 13:17:37:665] nsprecv: 00 08 00 00 0B 00 00 00  |........|
    [22-MAR-2013 13:17:37:665] nsprecv: normal exit
    [22-MAR-2013 13:17:37:665] nscon: got NSPTRS packetOracle 11
    (1) [22-MAR-2013 13:33:40:504] nscon: sending NSPTCN packet
    (1) [22-MAR-2013 13:33:40:504] nspsend: entry
    (1) [22-MAR-2013 13:33:40:504] nspsend: plen=205, type=1
    (1) [22-MAR-2013 13:33:40:504] nttwr: entry
    (1) [22-MAR-2013 13:33:40:504] nttwr: socket 8 had bytes written=205
    (1) [22-MAR-2013 13:33:40:504] nttwr: exit
    (1) [22-MAR-2013 13:33:40:504] nspsend: packet dump
    <<packet dump removed>>
    (1) [22-MAR-2013 13:33:40:505] nspsend: 205 bytes to transport
    (1) [22-MAR-2013 13:33:40:505] nspsend: normal exit
    (1) [22-MAR-2013 13:33:40:505] nscon: exit (0)
    (1) [22-MAR-2013 13:33:40:505] snsbitts_ts: entry
    (1) [22-MAR-2013 13:33:40:505] snsbitts_ts: acquired the bit
    (1) [22-MAR-2013 13:33:40:505] snsbitts_ts: normal exit
    (1) [22-MAR-2013 13:33:40:505] nsdo: nsctxrnk=0
    (1) [22-MAR-2013 13:33:40:505] snsbitcl_ts: entry
    (1) [22-MAR-2013 13:33:40:505] snsbitcl_ts: normal exit
    (1) [22-MAR-2013 13:33:40:505] nsdo: normal exit
    (1) [22-MAR-2013 13:33:40:505] nsdo: entry
    (1) [22-MAR-2013 13:33:40:505] nsdo: cid=0, opcode=68, *bl=2048, *what=9, uflgs=0x0, cflgs=0x3
    (1) [22-MAR-2013 13:33:40:505] snsbitts_ts: entry
    (1) [22-MAR-2013 13:33:40:505] snsbitts_ts: acquired the bit
    (1) [22-MAR-2013 13:33:40:505] snsbitts_ts: normal exit
    (1) [22-MAR-2013 13:33:40:505] nsdo: rank=64, nsctxrnk=0
    (1) [22-MAR-2013 13:33:40:505] snsbitcl_ts: entry
    (1) [22-MAR-2013 13:33:40:505] snsbitcl_ts: normal exit
    (1) [22-MAR-2013 13:33:40:505] nsdo: nsctx: state=2, flg=0x4005, mvd=0
    (1) [22-MAR-2013 13:33:40:505] nsdo: gtn=10, gtc=10, ptn=10, ptc=8155
    (1) [22-MAR-2013 13:33:40:505] nscon: entry
    (1) [22-MAR-2013 13:33:40:505] nscon: recving a packet
    (1) [22-MAR-2013 13:33:40:505] nsprecv: entry
    (1) [22-MAR-2013 13:33:40:505] nsprecv: reading from transport...
    (1) [22-MAR-2013 13:33:40:505] nttrd: entry
    (1) [22-MAR-2013 13:33:40:618] nttrd: socket 8 had bytes read=8
    (1) [22-MAR-2013 13:33:40:618] nttrd: exit
    (1) [22-MAR-2013 13:33:40:618] nsprecv: 8 bytes from transport
    (1) [22-MAR-2013 13:33:40:618] nsprecv: tlen=8, plen=8, type=11
    (1) [22-MAR-2013 13:33:40:618] nsprecv: packet dump
    (1) [22-MAR-2013 13:33:40:618] nsprecv: 00 08 00 00 0B 00 00 00  |........|
    (1) [22-MAR-2013 13:33:40:618] nsprecv: normal exit
    (1) [22-MAR-2013 13:33:40:618] nscon: got NSPTRS packetAny ideas what could be the reason for this time difference? Something in our network configuration or something else?

    With local connections - I do not think a TCP packet send from an IP to the same IP, leaves the interface as an actual wire protocol/signal. If I'm correct, then running local connection tests will be mostly useless in checking the actual network infrastructure.
    Tests 3 and 4 should be showing the same connection times as the same physical network infrastructure is used - only the direction is reversed in the tests.
    I would assume that port settings on the switches and interface settings on the routers treat packets equally in both directions between 2 servers. But this could in part explain the problem if this is not the case. In a case of a router for example, the 1st test's ingress interface is the egress interface of the 2nd test (and vice versa). Configurations can differ substantially between interfaces on the same router. Likewise if there is a firewall - as different rule sets are applied in each test and these rule sets could differ.
    So I would not be too quick to state that this is definitely not a network problem. But I agree that based on the small percentage difference (assuming comparable tests), it does not look like a network issue.
    The next step is to determine what the delay is between the listener accepting the client connection, and the connection being serviced by a dedicated server process.
    This will require listener tracing - tracing the time from when the listener accepted the connection (and parsed the TNS connection string), to handing off the connection to the dedicated server process.
    As a comparison test, you can also test shared server connections. Dispatcher processes (of the db instance) register themselves with the listener. The shared server client hand off is thus done to an existing server process - no need for the Listener to make a kernel call to load and initialise an executable image.
    Shared connections are typically faster than dedicated connections in this respect.
    If there is a major time difference, then it means some kind of issue with the listener dealing with dedicated servers as oppose to dispatcher hand off's. As both connections would have had very similar network transit time - which means the connection time difference is related directly to dealing with a dedicated server connection request and hand off.
    You can also substitute the oracle executable with a wrapper - and troubleshoot the actual dedicated server startup. I've only done this with Oracle XE 10.2 though and with local IPC connections. Unsure how robust this will be for testing purposes via TCP using 11g.

  • 2GB limits on SQL*PLUS output file

    Hi,
    We are running 64bits Oracle 8.1.7.4 and SQL*PLUS 8.1.7.0 on 64 bit SunOS. There is no limit on file size on the unix login and I am able to work with file over 2GB.
    However, I am not able the output over 2GB to text file from SQL*PLUS. The SQL*PLUS keeps running, but the file size fize does not incease after 2GB.
    Can anyone help me?
    Thanks,
    CK

    In SQL*Plus 9.0 the SQL*Plus I/O architecture was
    rewritten and many (all?) 32 bit operating systems that
    have 64bit I/O packages allow SPOOLing more than 2G.
    See enhancement request 697548.
    A dedicated OCI or Pro*C application may be faster for
    spooling large files, depending on the output formatting
    requirements.
    -- CJ

  • How can i make sql formated report

    sql formated report..
    empno month sal
    10080 500
    1000
    2000
    10020 100
    50
    will you please give the way...

    Hi, for make a formated report you will must configure the SQL Plus enviroment, you can review the next link for set the values according at your requirements.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12040.htm#SQPUG083
    Luck.
    Regards.

  • How can i make the input/output field to a multiple lines in ModulePool...

    hi all...
    can any one please let me know, is there any possibility thru Module Pool program where i can make the input/output field to a multiple lines...
    say, when we drag & drop the input/output field on the screen - it'll come with single line display. so, how to make the same field to multiple lines field.
    rather i can say my question like, how to increase the height of the input/output field.
    Desired Functionality:
    • The user wants to display a long text.
    • now the input/output field should not display the record as a single line, now the field has to display the text in multiple lines (something like wrap option in ms excel).
    hope u got my question...
    please help me in this regards...

    hi Rengith, i'm not using Text Field, i'm using Inpu/Output Field to display the long text.
    If u mean text field as input/output field then can u let me know the process for this, how to do the same thru module pool program...
    Edited by: murashali on Mar 18, 2008 1:36 PM

  • 11g: can connet using SQL*PLUS, not with TOAD

    Hi
    I run into a problem with TOAD. I can't connect with my 11g database using TOAD. I don't get any messages it just gives me a little waiticon for a split second and then nothing happens. I can however connect to my 10g database using TOAD. Using SQL*Plus I can connect to both.
    I use TOAD 8.6. Do I need a newer version maybe??...

    I can connect like:
    hr/pw@xe
    or
    hr/pw@O11R1
    or directly, no problem. I can connect from SQLplus to both databases any way I want

  • Can I block SQL PLUS (inserts, updates, deletes, drop, etc)?

    Let's say I make a forms or reports builder module, and I would like to avoid that any user alter a table by using SQL code.
    (regarless I use a different user/pass)
    is it possible?

    Ronald
    If im correct is your requirement like this ?
    You want to avoid a user using SQL and running script to alter the table structure when you
    have your form or report module is already built.
    If my understanding to ur req is correct then you can avoid this by using the
    PRODUCT_USER_PROFILE. there you can restrict the user to use only mentioned modules.
    You can allow the user to use only FORMS, REPORTS and disallow the user to connect the database by any other means.
    Also you can achieve this by creating a trigger at the schema level and check whether the product/application he is using to access the database is other than FORMS,REPORTS and raising an error
    message.
    If your requirement is just only for the data then you can achieve this same also using the similar triggers.
    try that
    all the best
    prakash
    [email protected]

Maybe you are looking for

  • Error when installing Quicktime 7.1.3

    I'm having trouble updating my iTunes/QuickTime to the newest version. The error I get is: Could not open key: HKEYLOCALMACHINE\Software\Classes\QuickTimePlayerLib.QuickTimePlayerApp\CLSID. Verify that you have sufficient access to that key, or conta

  • New Webi Document - First Folder is Always Expanded

    Hello. When ever we create a new Webi document, the first folder (class) on the Query panel is always expaned, the other folders are collapsed. How can we have all folders (classes) open collapsed rather than the first being expanded? Our system is B

  • Microsoft word

    Hi everyone, I've been asking to create a document word using ABAP programming. I am using the interface I_OI_DOCUMENT_PROXY. The question is how can I insert a "new page" in the document word ? Thanks a lot. Regards.

  • "rendeing required files" and then error

    After I almost finished edit a short movie (in 5.1 surround) the PPro CS4 (4.0.1) showed me the massage "rendering required files" (i guess it rendered the sound because the video already been rendered) but before playing it, the program closed and s

  • Activity type problem

    Dear pp brother's Here by i am confirming production order (co15) but at the time of saving it show the msg that A master record for C10030/STEAM exists only in 2007 it ask me to go KP26 T-code pls help me for the same With regards Amit Naik