Ref : SQL Command Line -

Hi Experts,
I've started using SQL Command Line to write queries. But the problem is ,i'm not able to format the o/p properly.
select * from v$sqlarea;When i executed this query, the output came in very unreadable format and covered the entire Editor window.
Can anybody please prove me some tips to improve the readability?
Thanks in Advance,
Ranit B.

>
Thanks... I'll keep these in mind.
>
That isn't what you need to do to learn how to get formatted output. You need to actually try things. You learn by doing, not by reading.
Start simple. Use the query in the doc example. See how messy the output is with no formatting. Then use the formatting in that example. See the difference it makes.
Then do the same with your query. Just use two or three columns. See how messy the output is when you don't specify formatting. Then try different formats and see what effect it has.
Once you have done that you will notice that you now get the nice output you want but in order to get it you have to spend time looking up what the column names and datatypes are and hand-coding a bunch of formatting.
You can make that job easier in a couple of ways. One way is to create a script that contains the formatting and query and then just execute that script when you want to run that query.
The second way is more complex but more flexible. You can add parameters to your script that control which columns get used, how many rows will get returned and how to sort the output. Then you can either pass the parameters manually every time you run the script, have the script prompt you for the parameters or just create several versions of the script that do things different ways.
SB's advice may have seemed simplistic but unless you start building your own 'toolkit' you will never advance to the stage where you can do those things easily. There are just too many permutations to try to remember them all when you need to. You need to start creating the building blocks that you can use to build on and create more complex combinations.
I have one question for you. Will you commit to trying that doc example and then trying similar formatting for your own query?

Similar Messages

  • Oracle Express 10g - SQL Command Line - copy and paste?

    Is there a special key to copy and paste SQL statement in the SQL command line?
    I'm doing a spool and this can only be achieved through the SQL command line. Thanks for the help if any.

    It uses the functionality of the shell it is running in.
    If you're using Windows, right-click on the title bar, select Edit then Paste from the menu that pops up.
    If you select Properties from the menu, you can enable Quick Edit mode, which lets you paste using the right mouse button.
    You can use the up arrow key to recall previous commands.
    If you're using Linux, I think you can paste with the right mouse button. (Or is it the middle mouse button?)

  • Oracle Express 10g - a way to terminate in SQL Command Line interface

    I've downloaded Oracle Express 10g and use the SQL Command Line interface to execute SQL*Plus -- a really simple window / interface without hardly any smarts. In other Oracle installations' SQL*Plus, I'm used to be able to do a Ctrl C to terminate the current SQL that's being executed and the session is still active and I can keep using it. But with the Oracle Express 10g SQL Command Line interface, when I do a Ctrl C the currrent SQL is terminated -- but so is the whole dang session and the window goes away too. There must be a way in the Oracle Express 10g SQL Command Line interface to simply terminate th current SQL results without losing the whole dang session!!! This is so incredibly frustrating it's not even funny. HELP!!!!

    I think your answer is in this thread:
    Re: stopping a query
    Regards, Marc

  • Connection error when logining in from sql command line

    I'm getting the following errors when I attempt to connect using the sql command line. I have installed 10g Express on XP home addition. The errors are as follows:
    ORA-01034 Oracle not available
    ORA-27101 Shared memory realm does not exist.
    Thanks

    I am getting this error in the oradim log file:
    ORA-01078: failure in processing system parameters
    ORA-01565: error in identifying file 'D:\oraclexe\app\oracle\product\10.2.0\server\dbs/spfileXE.ora'
    checked this directory and it is empty
    should I uninstall and reinstall. Can I get this file somewhere?

  • SQL COMMAND LINE DISAPPEARD

    I AM ALREADY IN THE CHAP05 OF THE BOOK. I USED THE OBJECT BROUSER TO CREATE SOME TABLES. AFTER THAT I TRIED TO USE THE SQL COMMAND LINE BUT EVERYTIME I HIT "ENTER", THE COMMAND LINE JUST DISAPPEARED ON ME RIGHT AWAY. I CANNOT EVEN GET THE RESULT AFTER I EXECUTED SOME QUERRIES IN THE COMMAND LINE BECAUSE IT WILL JUST DISAPPEAR RIGHT AWAY AFTER I HIT THE "ENTER", IN THE KEY PAD.
    PLEASE HELP ME. I CANNOT GO AHEAD BECAUSE OF THIS PROBLEM. IM REALLY FRUSTRATED FOR 3 NIGHTS IN A ROW ALREADY. ANY HELP IS GREATLY APPRECIATED.
    THANK YOU.

    Seriously, what book? Are you using the browser interface for Oracle 10g Express Edtion (XE)? If so, is there a "Run" button at the top right of the screen? Or are you using the SQL*Plus client application which runs in a Windows command window?
    btw your caps lock key is stuck.

  • Clear screen in "Run SQL Command Line" causes the utility to dump in Window

    Just for your notice... I have not checked if i can reproduce this on Linux platform or on second node running Windows XP Pro.
    But if I use "Run SQL Command Line" utility and do
    clear screen
    The utility dumps, (not the database though only the utlility)
    Maybe some other people could confirm if this findings is a bug or not and if it is a port specific issue with Windows XP only.
    Kindly Rgds
    /Ulf, Kentor IT Sweden

    Tracking info is in
    Re: SQL*Plus generated Program Error
    -- cj

  • Run Sql command line is not openning.

    Hi !
    sql command line is not openning.(windows 2008 enterpise and oracel 11g express)
    please tel me is there any other way to open it, i have tried it from the phyical directory also.
    but oracel is working properlly.
    i wanted it load data from captured data to oracle database. (i was migrating).
    yours sincerely
    Edited by: 944768 on Aug 14, 2012 12:12 AM

    Open a command prompt (cmd), from there run:
    c:\> sqlplus user/passwordHow do you plan to "load data", based on what format? Sqlplus might not be the right tool for the job.
    Sql*loader is one option. Another option to help with migration is Oracle SQL Developer (separate, free tool).

  • SQL command line on windows

    Hi
    I use SQL comman-Line, and i always connect from one db to another, it gets confusing on which db i am connected (test / production).
    i was wondering is there a parameter or an option in which i can see the db i am connected to?
    like next to the prompt ?
    ie:
    scott@db SQL>
    or something like that??
    Regards
    Tony G.

    On Metalink you can find some solutions. See, for example, Doc. 456547.996
    or Asktom
    http://asktom.oracle.com/pls/ask/f?p=4950:8:13194713802943657485::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:446220075876
    Higher the DB version, better the solution :-)

  • Problem using sql command line

    Hello!
    I do have some problems with using the command line for INSERT statements. When I perform insert statements the data of these statements are lost as soon as I close the command line. Other statements like SELECT or CREATE TABLE work properly.
    any idea?
    regards
    D.

    I do have some problems with using the command line
    for INSERT statements. When I perform insert
    statements the data of these statements are lost as
    soon as I close the command line. Other statements
    like SELECT or CREATE TABLE work properly.
    Have you run "COMMIT", after insert statement ??
    You need to run "commit" (preferable) or exit (Oracle explicit commit on exit).
    You might have close the sqlplus window without running above command.
    See following thread for explanation with example
    Re: commit problem!!
    Virag

  • How to create analytic privileges from sql command line in hana studio?

    I want to create a bunch of analytic privileges, activate them and assign it a roles. I was wondering if there is a method where I can create these analytical privileges directly from sql?

    Hi Krishna,
    Thanks for the reply.
    The use case is to create a bulk analytical privileges on the pre-existing analytical or calculation views and I'm failing to create it using the simple CREATE STRUCTURED PRIVILEGE.
    The security guide shows below mentioned as the syntax but I'm failing to create it through that:
    CREATE STRUCTURED PRIVILEGE AP_SALES_1 FOR SELECT ON TABLEOWNER.VIEW_SALES WHERE REGION IN ('DE','UK') OR PRODUCT = 'CAR';
    It gives me this error -
    SAP DBTech JDBC: [257] (at 44): sql syntax error: incorrect syntax near "FOR": line 1 col 44 (at pos 44)

  • Run SQL Command Line

    Sorry folks, but I'm new to all this - just started an Oracle db course and downloaded the Windows (Oracle.exe) version of 10g to practise at home. Whenever I try and writes some SQL, I get a message:
    SP2-0640: Not connected
    What am I doing wrong?!?

    hi,
    u can connect to the ORACLE database like this
    SQLPLUS <user_name>/<pasword>
    or
    SQLPLUS
    Enter Username: <user_name>
    Enter Password:
    Trinath Somanchi,
    Hyderabad.

  • Error message in Command line (cannot mount database in EXCLUSIVE mode)

    Hello Experts
    I'm new in Oracle and trying to connect to my database though SQL command line. After I login as SYS I user I get the message that 'connected to idle instance'. Then I use “STARTUP” to connect to database. Now from my understanding it should mount the database and open it as well. But it does'nt happens.Instead I get the message 'cannot mount database in EXCLUSIVE mode' . I'm not sure why it can't mound the database and what should I do to make it working. Please can somebody show me how to make it working again. Here are the details about my problem
    Enter user-name: SYS as SYSDBA
    Enter password:
    Connected to an idle instance.
    SQL> startup
    ORACLE instance started.
    Total System Global Area 595591168 bytes
    Fixed Size 1220748 bytes
    Variable Size 301993844 bytes
    Database Buffers 285212672 bytes
    Redo Buffers 7163904 bytes
    ORA-01102: cannot mount database in EXCLUSIVE mode
    Thanks a lot in advance.

    Thank you so much for both of you. I've checked everything. All looks fine to me and then i tried to connect though SQL and it worked. Now what I've notice that this time I didn't start Enterprise Manager only I started the listner and then start sql it worked. Does this means that I can't use both SQL and EM at a time together?

  • Password keystrokes won't register in Run SQL Command

    I'm sorry if this has been answered before. I searched but I couldn't find this particular problem. I'm new to Oracle and I'm trying to install it on my computer. I'm used to using the Enterprise Edition that is available at school, so the Express Edition seems so much different.
    In case it is important, I'm running Windows Vista Home Premium (64-bit). When I go to Start > All Programs > Oracle Database 10g Express Edition > Run SQL Command Line, I enter "connect", then it prompts me for a username. I enter "SYSDBA", then it asks me for a password and my keystrokes are not recognized. I tried to just go ahead and enter the password I created when I installed and press ENTER but that didn't work.
    I tried going to the Database Homepage, and I can log in with SYSTEM and my password, but my SQL commands and scripts (from school, that work with the Enterprise Edition) don't work. I get this pop-up window with the title "Enter Bind Variables" and the page itself has a SUBMIT button, but there is nothing else there.
    I'm totally lost. Any help is greatly appreciated.
    Edited by: user10823568 on Apr 1, 2009 11:56 PM

    sysdba is a privilege, not a user. SYS and SYSTEM users have the DBA role privileges, SYS owns the catalog (database, tables, datafile, user and object info, all the metadata).
    The sys and system users can manipulate just about anything in the instance, using a connect sys as sysdba grants the ability to do a few more management tasks (i.e. shut down the database). Its best to only use those database logins when they're really needed (backups, startups, etc) and create other database users for all the other stuff. A quick way to get started is
    connect sys as sysdba; -- or connect / as sysdba;
    create user joe identified by joepasswd;
    grant resource to joe;
    grant connect to joe;
    grant create session to joeThe resource privilege is a quick way to get all the rights needed to create tables, indexes, procedures. There are a couple of rights in resource that most admins don't like to hand out to just anyone but it'll get the joe database user rolling.
    Now on to that "bind variables" dialog, the script that is running needs some input, take a look at the .sql file and there's probably an ampersand in there somewhere- maybe it wants a user name name, just have to figure out what it wants.
    And sqlplus does not echo characters typed in at the password prompt, that's normal.

  • Oracle command line to connect to a database directly from a client machine

    Hi,
    I need to connect from a Client machine to a database present on the Database server.
    Client: Windows 7 32 bit/ 64 bit
    Server where DB is installed: Windows 2008, Oracle 11.xg
    I need a command line option that will connect to a database say 'Test' from the command line. I want to put that command in a batch file / exe and call it from there.
    I have tools like SQL Developer and dbForge but was unable to do it. Could I have some help on this.
    I am a fresher with Oracle and I would appreciate detailed steps. Thanks very much in advance.
    Vincent

    Vincent,
    There is a few steps you want to perform, first of all tell me where is your client database server and where you want command line to use Oracle SQL command line.
    Regards,
    Hunain Khanani

  • How to replace data in sql command

    Hi all
    if i had one column data like
    http://localhost:123
    http://localhost:123 a
    http://localhost:123 bg
    http://localhost:123 fdasf
    does any sql command line or method i can use to relace this column data?
    the relace it should be like
    http://127.0.0.1:123
    http://127.0.0.1:123 a
    http://127.0.0.1:123 bg
    http://127.0.0.1:123 fdasf
    regard

    Hi all
    if i had one column data like
    COL1 COL2
    http://localhost:123
    http://localhost:123 a
    http://localhost:123 bg
    http://localhost:123 fdasf
    does any sql command line or method i can use to
    relace this column data?
    the relace it should be like
    COL1 COL2
    http://127.0.0.1:123
    http://127.0.0.1:123 a
    http://127.0.0.1:123 bg
    http://127.0.0.1:123 fdasf
    regardselect replace(col1,'localhost','127.0.0.1') column1, col2 from table;
    Good Luck

Maybe you are looking for