How to format the output of a .sql script that has select statements.

Hello

I have a .sql script which is having several select statements. Each Select statement is to have hundreds of Table columns.

When we run the .sql script, we are unable to read the output.

Please let know us the commands that we include for better readable output format.

You work with the lin standard set 80.
Increase this setting to set lin 3000 or more.

Tags: Database

Similar Questions

  • How to display the output of PL/SQL and difficulty package below error (please help)

    -PACKAGE SPECIFICATION AND met with success, but I see no way out, an error is also here... Please help. How do I solve this problem
    -with the code

    CREATE OR REPLACE PACKAGE package_variables
    -Declare the components of a package.
    Established PROCEDURE (VARCHAR2 value);
    Public FUNCTION get RETURN VARCHAR2;
    END package_variables;
    /



    CREATE OR REPLACE PACKAGE BODY package_variables
    -Declare the package-scoped variable.
    variable VARCHAR2 (20): = "initial value";
    -Define the function
    Get function RETURN VARCHAR2 IS
    BEGIN
    RETURN variable;
    END get;
    -Define the procedure.
    PROCEDURE set(value VARCHAR2) IS
    BEGIN
    variable: = value;
    The END value;
    END package_variables;
    /



    Result VARIABLE VARCHAR2 (20)
    CALL package_variables.get () IN: result;
    SELECT: result AS result FROM dual;


    RUN package_variables.set ("new value '");
    CALL package_variables.get () IN: result;
    SELECT: result AS result FROM dual;

    /*

    OUTPUT


    PACKAGE compiled package_variables.
    PACKAGE compiled package_variables BODY.

    Error at startup on line 2 of the command:
    CALL package_variables.get () IN: results
    Error report:
    SQL error: ORA-01008: not all variables
    01008 00000 - "not all variables.
    * Cause:
    * Action:
    RESULTS
    --------------------------------


    1 selected lines

    anonymous block filled

    Error at startup on line 2 of the command:
    CALL package_variables.get () IN: results
    Error report:
    SQL error: ORA-01008: not all variables
    01008 00000 - "not all variables.
    * Cause:
    * Action:
    RESULTS
    --------------------------------


    1 selected lines

    */

    The package name is package_variables (note the 's'. Plural.) But using package_variable (in the singular) in your call.
    Also select in as a SQL statement seems to be not valid. You encapsulate a begin - end around her block.

    SQL> begin
      2  select package_variables.get into :outcome from dual;
      3  end;
      4  /
    
    PL/SQL procedure successfully completed
    outcome
    ---------
    Initial Value
    
  • How to run the linux command line sql script

    Hi all!

    Just quick question. On my server I have to install the crontab script which will be eexecute some sql statements.
    How can I undergo command which will execute the script file without asking for password?


    sqlplus user/pass... and then what?


    Thank you

    dlugasx

    sqlplus user/pass @yourscript.sql

  • How to recharge the apps on a dead Mac that has been repaired?

    I use Photoshop, InDesign and Illustrator CS6 on two Macs.

    My Mac Book Pro died and the hard drive has been replaced. I lost all my applications on this computer. How can I reload these apps on my MBP?

    I'm supposed to first disable it in the HELP menu, but can't do it in this case.

    Thanks for your help as soon as possible!

    Make sure that the product that download you matches the serial number. Suite package numbers are not interchangeable with the standalones or other packages now.

  • How to make the output of the task are an entry in another task

    How to connect the output of a task for I can use it as input for another task?  See this screen below: the task "Invoke the Script" run a PowerShell Script.  The task 'Send E-mail' send an email.  The two tasks work separately.  How can I get the results of my powerShell script that I can use them as content of the task 'Send Email'?

    workflow.jpg

    On the script invoke task you set the attributes of output containing the results of powershell.

    to do this, select the output tab and use an object name that was put in place in powershell results as in the data

    You may need to format, this results in a recognized VMware object I guess in your case it is a string type.

    and then select the e-mail task, select the task from email, click on the small eye looking for icon "view details".

    Select the Visual link

    Select the attributes you setup from the output of the previous task and hang it in the input parameters of the task to email.

    fact

  • Customize and format the output number

    How can I can format the output divided by a number?

    For example, the space time often displayed as bytes, I always manually to divide by 1024 ^ 3 to make it user-friendly.

    Example below...

    Get-Datastore. Get-View | Select summary - ExpandProperty | SELECT name, capacity, FreeSpace, @{N = 'Supplied'; E={ ($_. Capacity - $_. FreeSpace + $_. Not posted)}}

    OK, I see.

    You can use the same technique for the other 2 properties. Something like that

    Get-Datastore | Get-View |
    Select -ExpandProperty Summary |
    Select Name,
        @{N="Capacity"; E={[Math]::Round($_.Capacity/1GB,1) }},
        @{N="FreeSpace"; E={[Math]::Round(($_.FreeSpace/1GB,1) }},
        @{N="Provisioned"; E={[Math]::Round(($_.Capacity - $_.FreeSpace + $_.Uncommitted)/1GB,1) }}
    

    Another option is to use the New-VIProperty cmdlet and set these properties in the UK.

    Refer to the section of the data store in my New VIProperty module, where you will find the instructions to New-VIProperty to provide the properties CapacityGB, FreeGB , and ProvisionedGB .

  • How to format the message in the response

    Hi all

    Please let me know how to format the message in the response.
    Sorry this is not the case associated with sql, plsql. I went in the way of asking questions in the forums oracle instructions. But I did not find. Help, please...

    I know this: when I write my thread I use
    .. to format  the code ,but while replying how to include post with formatted text. 
    
    
    Thanks,
    P prakash                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

    >

    Thanks for the reply, I would like to know how you included the message formatted in your answer.
    Please let me know this...

    Hi again Prakash,

    Easy - just put ">"at the beginning lines you want to quote. "

    That is higher and space - when you answer, hit the double quotes in the bar
    at the top of the post - last symbol to the right and it will be automatically
    the post to which you want to reply.

    HTH,

    Paul...

  • How to store the output of a statement select * statement in a file?

    How to store the output of a statement select * / statement of dsc in a file?

    As user sys:

    CREATE OR REPLACE DIRECTORY TEST_DIR AS '\tmp\myfiles'
    /
    GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser
    /
    

    As myuser:

    CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2
                                         ,p_dir IN VARCHAR2
                                         ,p_header_file IN VARCHAR2
                                         ,p_data_file IN VARCHAR2 := NULL) IS
      v_finaltxt  VARCHAR2(4000);
      v_v_val     VARCHAR2(4000);
      v_n_val     NUMBER;
      v_d_val     DATE;
      v_ret       NUMBER;
      c           NUMBER;
      d           NUMBER;
      col_cnt     INTEGER;
      f           BOOLEAN;
      rec_tab     DBMS_SQL.DESC_TAB;
      col_num     NUMBER;
      v_fh        UTL_FILE.FILE_TYPE;
      v_samefile  BOOLEAN := (NVL(p_data_file,p_header_file) = p_header_file);
    BEGIN
      c := DBMS_SQL.OPEN_CURSOR;
      DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
      d := DBMS_SQL.EXECUTE(c);
      DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
      FOR j in 1..col_cnt
      LOOP
        CASE rec_tab(j).col_type
          WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
          WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);
          WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);
        ELSE
          DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
        END CASE;
      END LOOP;
      -- This part outputs the HEADER
      v_fh := UTL_FILE.FOPEN(upper(p_dir),p_header_file,'w',32767);
      FOR j in 1..col_cnt
      LOOP
        v_finaltxt := ltrim(v_finaltxt||','||lower(rec_tab(j).col_name),',');
      END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
      UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      IF NOT v_samefile THEN
        UTL_FILE.FCLOSE(v_fh);
      END IF;
      --
      -- This part outputs the DATA
      IF NOT v_samefile THEN
        v_fh := UTL_FILE.FOPEN(upper(p_dir),p_data_file,'w',32767);
      END IF;
      LOOP
        v_ret := DBMS_SQL.FETCH_ROWS(c);
        EXIT WHEN v_ret = 0;
        v_finaltxt := NULL;
        FOR j in 1..col_cnt
        LOOP
          CASE rec_tab(j).col_type
            WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
                        v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
            WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
                        v_finaltxt := ltrim(v_finaltxt||','||v_n_val,',');
            WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
                        v_finaltxt := ltrim(v_finaltxt||','||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),',');
          ELSE
            v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
          END CASE;
        END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
        UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      END LOOP;
      UTL_FILE.FCLOSE(v_fh);
      DBMS_SQL.CLOSE_CURSOR(c);
    END;
    

    This allows the header line and the data to write into files separate if necessary.

    for example

    SQL> exec run_query('select * from emp','TEST_DIR','output.txt');
    
    PL/SQL procedure successfully completed.
    

    Output.txt file contains:

    empno,ename,job,mgr,hiredate,sal,comm,deptno
    7369,"SMITH","CLERK",7902,17/12/1980 00:00:00,800,,20
    7499,"ALLEN","SALESMAN",7698,20/02/1981 00:00:00,1600,300,30
    7521,"WARD","SALESMAN",7698,22/02/1981 00:00:00,1250,500,30
    7566,"JONES","MANAGER",7839,02/04/1981 00:00:00,2975,,20
    7654,"MARTIN","SALESMAN",7698,28/09/1981 00:00:00,1250,1400,30
    7698,"BLAKE","MANAGER",7839,01/05/1981 00:00:00,2850,,30
    7782,"CLARK","MANAGER",7839,09/06/1981 00:00:00,2450,,10
    7788,"SCOTT","ANALYST",7566,19/04/1987 00:00:00,3000,,20
    7839,"KING","PRESIDENT",,17/11/1981 00:00:00,5000,,10
    7844,"TURNER","SALESMAN",7698,08/09/1981 00:00:00,1500,0,30
    7876,"ADAMS","CLERK",7788,23/05/1987 00:00:00,1100,,20
    7900,"JAMES","CLERK",7698,03/12/1981 00:00:00,950,,30
    7902,"FORD","ANALYST",7566,03/12/1981 00:00:00,3000,,20
    7934,"MILLER","CLERK",7782,23/01/1982 00:00:00,1300,,10
    

    The procedure allows for the header and the data to separate files if necessary. Just by specifying the file name "header" will put the header and the data in a single file.

  • How to format the hard duct under XP?

    How to format the hard drive under XP?

    Hello

    You can format when reinstalling XP or installing another operating system process.

    http://pcsupport.about.com/od/OperatingSystems/SS/instxpclean1.htm

    See you soon.

  • How to format the hard drive and do a clean install of XP?

    I have a legal windows XP profesional version to install and I need advice on how to format the hard disk, the version on it now was apparently a pirate vers.its years since I, did such things and my mind is old so I really need all the steps, a - z,.

    * How can original title - I wipe my hard drive and install win XP Prof? *

    Hi syynbbad,

    In addition to the post of cbarnhorst, please see the following article on how to do a clean install of XP:

    http://support.Microsoft.com/kb/978307

    I hope this helps!

    Debra
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

  • How to format the SD card?

    Android 4.0 will erase all data on my phone, right?

    I want to format the SD card, too, because some setting or cache is stored on it as well.  When and how should I do this?

    Here's how to format the sd card
    Settings > storage > unmount sd card > remove sd card

    Don't forget to mark the right answer and the useful answer

  • concatenate the output of two sqls.

    Hi all

    I'm trying to concatenate the output of two sqls

    It should be fairly simple, but somehow I find it hard today.

    Here's the sql code.

    < code >

    Select (select to_char (sysdate, 'YYYYMMDD') of double) | "| (select the CHILD_SEQ.nextval of the double) of the double

    < code >

    I'm working on Oracle 11 g.

    Kindly help.

    use

    What's the problem with just doing...

    SQL > create the sequence child_seq;

    Order of creation.

    SQL > ed
    A written file afiedt.buf

    1 * select to_char (sysdate, 'YYYYMMDD') | The double CHILD_SEQ.nextval
    SQL > /.

    TO_CHAR (SYSDATE, 'YYYYMMDD') | CHILD_SEQ. NEXTVAL
    ------------------------------------------------
    201408131

    SQL >

    I hope you're not uing a primary touch well and trying to 'reset' the sequence every day.  This is not recommended and not scalable; keep primary keys simple by simply using a sequence and treat sysdate as a piece of data and other data.  If you need to get "sequences" for a particular day you can create them on the fly using row_number() over (partition by primarykeycolumn order datecolumn) where your datecolumn is the cut off date (trunc (sysdate)) and the primary key column is just the value of sequence assigned to the record.

  • How to install the output in bridge CC module using an apple OSX 10.9.5 and a miss apple OSX 10.11 this point completely in CC bridge!

    How to install the output in bridge CC module using an apple OSX 10.9.5 and a miss apple OSX 10.11 this point completely in CC bridge!

    Hi abev41080082

    Greetings.

    Concerning

    Rohit

  • Formatting the output of a request of $ P

    Hi everyone, I am currently working on how to format the scriot next so that I get column headers for the host name, vSwitch, Teddy bear, speed, duplex, status

    For the moment he outpus format the data in a list, I can add to the script to get it in a table that I can use convertto-html on?

    SE connect-VIServer

    foreach ($esxImpl in (Get-VMHost)) {}

    $esx = $esxImpl | Get-View

    {foreach ($pnic to $esx.Config.Network.Pnic)}

    $vSw = $esxImpl | Get-VirtualSwitch | where {$_.} {NIC-contains $pNic.Device}

    $pg = $esxImpl | Get-VirtualPortGroup | where {$_.} {VirtualSwitchName - eq $vSw.Name}

    $order = ($esx.Config.Network.Vswitch |) where {$_.} ({Name - eq $vSw.Name}). Spec.Policy.NicTeaming.NicOrder

    $pnic | Select @{N = "ESXname"; {E = {$esxImpl.Name}}.

    @{N = "Teddy"; E = {$pnic. Device}},

    @{N = "vSwitch"; {E = {$vSw.Name}}.

    @{N = 'Speed'; E = {$pnic. LinkSpeed.SpeedMb}},

    @{N = "Duplex"; E = {$pnic. LinkSpeed.Duplex}},

    @{N = 'Status'; E = {if($pnic.) (LinkSpeed-ne $null) {'up'} else {'down'}}}

    }

    }

    I tried all kinds of things and I'm sure that when I see that the solution will understand where I was wrong

    Thanks in advance for any help

    Try with this method

    Connect-VIServer 
    $report = @()
    foreach($esxImpl in (Get-VMHost)){
         $esx = $esxImpl | Get-View
         foreach($pnic in $esx.Config.Network.Pnic){
              $vSw = $esxImpl | Get-VirtualSwitch | where {$_.Nic -contains $pNic.Device}
              $pg = $esxImpl | Get-VirtualPortGroup | where {$_.VirtualSwitchName -eq $vSw.Name}
              $order = ($esx.Config.Network.Vswitch | where {$_.Name -eq $vSw.Name}).Spec.Policy.NicTeaming.NicOrder
              $pnic | %{
                   $row = "" | Select ESXName, pNIC, VSwitch, Speed, Duplex, Status
                   $row.ESXname = $esxImpl.Name
                   $row.pNic = $pnic.Device
                   $row.vSwitch = $vSw.Name
                   $row.Speed = $pnic.LinkSpeed.SpeedMb
                   $row.Duplex = $pnic.LinkSpeed.Duplex
                   $row.Status = &{if($pnic.LinkSpeed -ne $null){"up"}else{"down"}}
                   $report += $row
              }
         }
    }
    $report
    

    You can run the table $report to another cmdlet Export-Csv or Convertto-Html command

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • How to solve the problem of Oracle SQL Developer Connection?

    People,

    Hello. I use the Oracle 11 GR 1 material database. The database https://localhost.localdomain:1158 control console / em works correctly. I can create a database and a table with success.

    My OS is Linux and connects to the internet successfully.

    In order to execute SQL statements. We use Oracle SQL Developer. I connect Oracle SQL Developer in the following way:

    Connection name: DB1 (is my database name)
    User name: SYS (this is the user name I used to connect to the Console)
    Password: SYS (this is the password used to connect to the Console)
    Connection type: basic
    Host name: localhost
    Port: 1158
    SID: DB1 (it is created during the installation of the database)

    But the error message: "status: failed - IO exception Connection Reset."

    Can any folk tell me how to solve the problem of Oracle SQL Developer Connection?

    user8860348 wrote:
    People,

    Hello. I use the Oracle 11 GR 1 material database. database Control Panel https://localhost.localdomain:1158 / em works correctly. I can create a database and a table with success.

    My OS is Linux and connects to the internet successfully.

    In order to execute SQL statements. We use Oracle SQL Developer. I connect Oracle SQL Developer in the following way:

    Connection name: DB1 (is my database name)
    User name: SYS (this is the user name I used to connect to the Console)
    Password: SYS (this is the password used to connect to the Console)
    Connection type: basic
    Host name: localhost
    Port: 1158
    SID: DB1 (it is created during the installation of the database)

    But the error message: "status: failed - IO exception Connection Reset."

    Can any folk tell me how to solve the problem of Oracle SQL Developer Connection?

    user name: sys
    password: enter_your_correct_password given at the time of the installation of oracle

    role: select sysdba if you would connect as sysdba otherwise select normal for users other than the sys

    HostName: Enter your ip or hostname of the oracle example server address:-192.168.11.12

    to find the terminal/command prompt open hostname in oracle installed machine
    type---> hostname

    type ping hostname--->

    You can find the IP address of the server

    Port number: 1521 (default)---> I guess, otherwise check the port number in the file tnsnames.ora under your ORACLE_HOME/network/admin folder

    SID: DB1

    try it
    Good luck

Maybe you are looking for

  • HP Envy 15 laptop TS: hp envy battery doesn't charge

    The battery of my laptop 15 hp envy ts won't hold a charge. It works fine when connected to the charger but when removed, will stop. I have ran a battery test through the HP support assistant and ran a test of components. Each indicates that the batt

  • Acer W500/W501 Auto Rotation on Windows 8.1/10

    I recently upgraded the Acer Iconia W501P Windows 7 to Windows 10 and everything seems to work, and some drivers are missing. The only thing that needs attention has been the feature of automatic Rotation, because the remote control software hangs wh

  • Code internet printing HP PSC 2410

    HP PSC 2410 all-in-one XP Pro & XP Home - (2 lapstop - same problem with this printer) No changes have been made to the XP Home, just installed this printer on the XP Pro laptop and it's printing code.

  • Intermittent USB mouse freeze on Windows 7 Pro 64-bit. Tested with several mice that work fine on other computers.

    I am having a frustrating problem where my Wired Optical mouse appears to 'freeze' for 10 seconds on my machine Windows 7 Pro 64-bit. Meanwhile, everything else on the computer works fine, including the keyboard (connected through PS2). The mouse doe

  • Is ample to low menu possible?

    Hello I need to know which is ample menu as possible opera on the BB? Coding advice will be a great help because I have little knowledge about it!