See the number of rows affected the performance of sqlplus to a sql file

Hello

It's just we have a sql file that contains a bunch of select/update/insert statements.

I have a unix script that calls sqlplus on this sql file. However, at the exit I don't get the number of rows affected.

Without adding any code in the input sql file, how can I change the code of sqlplus shell script to print the number of rows affected for each statement in the sql file?

${ORACLE_HOME}/bin/sqlplus -L >> ${LOG_FILE} 2>&1  << EOF
  ${ORAID}/${ORAPASS}@${ORAINS}
  whenever sqlerror exit sql.sqlcode;
  set echo on;
  set feedback off;
  set serveroutput on;
  @${SQL_FILE};
  exit;
EOF
RC=$?

The SQL_FILE of entry content is:

select 12 "col1" from dual;
select 'abcd' "col2" from dual;
select;
select 13 'col3' from dual;

The result of the race of sqlplus is (LOG_FILE):

SQL*Plus: Release 11.2.0.2.0 Production on Fri Jun 6 14:28:00 2014

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Enter user-name: 
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> SQL> SQL> SQL> SQL> SQL> select 12 "col1" from dual;

      col1
----------
        12
SQL> select 'abcd' "col2" from dual;

col2
----
abcd
SQL> select;
select
     *
ERROR at line 1:
ORA-00936: missing expression


Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

Thank you

Srinivas - y.

  1. echo setting
  2. Set feedback off;

use

Set of feedback on

Tags: Database

Similar Questions

  • to check the number of rows affected by an update query in a procedure

    Hello
    I want to check the number of rows affected by the update script that I used in a procedure and I shoud be able to use this count towards the end of the procedure.
    How can I do?

    for example:
    create or replace procedure p1 is
    Start
    Update table1 set x = 'a', where y = 'b ';.
    end p1;

    Published by: christele CS on May 1, 2012 22:06

    Hello

    Try the below a...

    create or replace procedure p1 is
    Start
    Update table1 set x = 'a', where y = 'b ';.
    dbms_output.put_line (SQL % ROWCOUNT |) ("Lines updated ');
    end p1;

  • Get number of rows affected in SQLPLUS...

    Hello world
    I have a shell script where I am invoking sqlplus, running a query and save the result in a hold file in .csv format. This file now has a trailer container
    number of selected rows. So, I can not use SQL % ROWCOUNT and I don't know how to get this number.
    Someone gave me an idea of the number of lines of wc file and add it as a trailer, but I can't do it like in the conduct of the trailer I need to display a number that is an oracle
    sequence. The file format will be something like this-

    01, testing, 5667889, 9999999, AXCCRTR1
    000001, TESTSOURCE, 1--> it's the trailer (oracle_seq, constant varchar, not of selected lines)

    Is there a way I can get the number of rows affected by the last query in sqlplus. Any help will greatly be appricaited.
    I can go ahead and do it with Pl/sql, but I'm not leaving until I'm absolutely sure thery no way on this.

    Thank you
    ru

    Add a hidden column rownum to your query and save its last value:

    SQL>set feedback off
    SQL>column rownum new_value num_rows noprint
    SQL>select rownum, object_name, object_type from all_objects where rownum < 7;
    
    OBJECT_NAME                    OBJECT_TYPE
    ------------------------------ ------------------
    /1005bd30_LnkdConstant         JAVA CLASS
    /10076b23_OraCustomDatumClosur JAVA CLASS
    /10297c91_SAXAttrList          JAVA CLASS
    /103a2e73_DefaultEditorKitEndP JAVA CLASS
    /1048734f_DefaultFolder        JAVA CLASS
    /10501902_BasicFileChooserUINe JAVA CLASS
    SQL>prompt &num_rows
    6
    

    HTH, Urs

  • How to defragment the drive d error: some files on this volume could not be defragmented. Please see the report for a list of these files defragmentation.

    Original title: how to defragment the d drive

    Defragmentation is complete for: (c :)) some files on this volume could not be defragmented. Please see the report for a list of these files defragmentation.   I solve this problem with pagedefrag but same problem with the D: drive. What can I do? is a D: disk defragmentation program at system startup? Please help me :(

    Its a simple but problem ongoing with the pagefile... The hd is in use & cannot defragment parts of it

    because of this, use to defrag times. To fix the files fragmented on any hard drive, open the system

    Properties, performance, advance, the page file, change the button, select the hd, press "no paging file" value

    Enter 2 X, close, restart the pc. Once in xp, open cmd, type: CLEANMGR then select the hd,

    type: Defrag D: D: being fragmented, once through, hd output cmd, return to system properties, set

    the swap file for hd to "let the system manage", click 2 x game, close, you get a couple of windows

    saying: 'replace the file' say Yes close... Sometimes you have to try several, but you will succeed...

  • get the number of rows affected by their table top

    Hello, I need to count the number of rows updated in table form. In the process of ApplyMRU, I can use the string substitution #MRU_COUNT # to show the lines updated in a success message, but I need to get this value and store it on a table. Any help would be much appreciated. Thank you.

    oscarjavier99 wrote:

    Hello, I need to count the number of rows updated in table form. In the process of ApplyMRU, I can use the string substitution #MRU_COUNT # to show the lines updated in a success message, but I need to get this value and store it on a table. Any help would be much appreciated. Thank you.

    For that you would benefit from the APEX$ ROW_STATUS integrated substitution string.

    1. create a page element display only (in my case P15_UPDATED_ROWS) Save Session State set to Yes and the Type of Condition is set to never.

    2. Add a calculation after the shows with a Type of static assignment and calculation value 0 to reset the counter whenever the page is sent.

    3. Add an On submit - after calculations and Validations process of PL/SQL page linked to your tabular presentation with a Status of Type PL/SQL Expression and Expression 1 :apex$row_status = 'U' and the code of the following process :

    :p15_updated_rows := :p15_updated_rows + 1;
    

    If you don't actually means "day" in the strict sense, and then change the status of process to include possible APEX$ ROW_STATUS 'C', 'U', and "D" values as needed. If you want to count all created, updated and deleted lines, do not add the condition to the process, but make sure the extended run is set to createand changed lines.

  • Tecra S3: Ghost bootdisk does not see the HARD drive to create an image file

    Hello
    I have a T - S3 newly installed with all my programs and utilities. Now, I want to make an image of my drive file hard so I have everything set up again. I try to make my image with GhostCast (multicast) but my Ghost boot disk doesn't have a hard drive (as a result of the RAID system?).

    Anyone know if there is a back-pilot work for the raid system so that I can boot in Dos and see the hard drive?

    GTX
    Franzie

    Hello

    I use Norton Ghost for years with great success, but if you test Acronis True Image please let us know how it works.

  • What is the privilege to see the definition of a view or SQL view

    Hi DBAs,

    I gave the user to select all points of view (only read access) with the following query.


    Select ' grant select on ' | OWNER | '.' || view_name | « à » || '< USER name >;' from dba_views;


    Now the problem is the user after connection to the DB via SQL Developer fails to see the definition of the view tab option to SQL.


    Any help so that I can give the necessary privilege the user?

    I gave "grant select_catalog_role username" and it worked fine. are there problems with the security concerns of DBA?

  • number of rows affected by report

    Hi all

    I want to show the number of result rows to a query on a report page. my test query returns 52 sets of data (also when I execute the same statement with select count (*)) but the #TOTAL_ROWS variable # said that 11.
    I think it's because I put the value in pagination of row 10...

    is there a known issue with this? is #TOTAL_ROWS # only supposed to show the number of lines of recoveries?

    Thanks in advance hendrik

    Hendrik,

    This will not work unless you paging system is set (with pagination). You can always count your rows in a separate process and get this value by using the same SQL as in your report.

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    -------------------------------------------------------------------

  • How to see the "VIEW" in sqlplus script?

    Hello gurus,

    Can I know how to watch the plu "VIEW" in sql script?

    So far I used the editor to look at the script, but I don't know how to watch the view SQL script?


    Any idea?


    Thank you!!

    Hello

    Capitalize the name:

    select dbms_metadata.get_ddl('VIEW', 'TEST_VIEW') from dual;
    

    Do not forget that the text inside the quotation marks (quotation marks single or double quotation marks) is case-sensitive.

    The parser takes advantage of all that is not in quotes, so when you say:

    create or replace view xyz.test_view as select sysdate x from dual;
    

    What is actually esecuted is

    CREATE OR REPLACE VIEW XYZ.TEST_VIEW AS SELECT SYSDATE X FROM DUAL;
    

    and the view is called "TEST_VIEW" (uppercase), which is not the same thing as "test_view" (with all lowercase letters).

    It may be not important if the other argument to get_ddl ('view') is capitalized or not. Often people write procedures to forgive if you forgot something, and the error is obvious. There is a database object that is called 'VIEW' is not a database object called 'view', and so the function can be written to correct an obvious mistake to say "view" rather than "VIEW". But it cannot be assumed that, when you say "test_view", you really wanted "TEST_VIEW": you can actually have two different objects to these two names. It would not be a very good idea (I do not use lowercase letters in the names is a good idea in any case), but you could do it.

    Published by: Frank Kulash, Sep 15, 2010 15:40

  • Rows affected the dynamic SQL


    Hello

    VERSION - Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64 bit Production

    I want the number of rows affected by SQL dynamic, as shown below in the code where insert statement will be repeated for each record in the CURSOR.

    for rec in c1
    loop


    ABC: =' insert into test
    Select a.*,' | recomm. OP_ID |', "' | recomm. OP_NAME | " 'of BL_testI' | recomm. OP_ID: ' where START_DATE > = trunc(sysdate-2) and START_DATE < trunc(sysdate-1)';

    insert into str_test values (abc);

    immediately run abc;

    commit;

    When exit c1% notfound;
    end loop;

    In a normal query I would do it spontaneously SQL COUNT but cannot use it here.

    Thnx in advance

    Just use SQL % ROWCOUNT. What is the problem with that?

    Here is an example.

    SQL > declare
    l_sql 2 varchar2 (4000);
    3. start
    4 l_sql: = ' insert into t select * from emp';
    5. immediately run l_sql;
    6 dbms_output.put_line(l_sql ||) ': Number of inserted rows = ' | to_char(SQL%RowCount));)
    7 end;
    8.

    insert into t select * from EMP: number of inserted rows = 11

    PL/SQL procedure successfully completed.

    SQL >

  • The performance analysis section

    Hello
    We are in 10g R2 on Win 2003 server. In 2 day s/n, page 10-9 (http://download.oracle.com/docs/cd/B19306_01/server.102/b14196.pdf B14196-02), I saw to see the Performance analysis:

    1 - the article on the home page of the database, as shown in Figure 10-6 under the performance analysis.
    You can see by clicking on the conclusion. Performance Results Details page appears, outlining the findings and recommended actions.
    2 - the diagnosis summary next to Performance results the number of results, as appropriate. Click on this link to access the page of the ADDM.

    But on my homepage of database grid control I can't see these. This means that ADDM found nothing? How be sure the ADDM runs every hours a? How to activate the ADDM?
    Thank you.

    Click RUN ADDM

    Then click on the check time on the chart where it shows enrichment to see performance issues.

    SS

  • I still don't see the lyrics on windows support

    I followed all the instructions in the Help menu, and I still don't see the words, why? I wrote the lyrics on 'advanced tag editor', then, Play menu, lyrics, captions, and subtitles , and I clicked on if Available . And they does not appear:(aide s'il vous plaît quelqu'un!!)

    VV1sper - please do the following test:

    -Go to start all programs accessories sound recorder-->-->-->
    -Early check, if you do not have a microphone which is very well, saving a blank audio file in this case is not a problem, record for 30 seconds to a minute.
    -Save the WMA file on your desktop
    -Open Windows Media Player 11 and go to your library
    -Drag the newly created file in the box that says 'Elements Drag here'
    -Read the file and click on read the list (but not the menu topic is on-air)
    -Right click on the file and go to Advanced Tag Editor
    -Insert the words; Type some text in there manually, about 10 lines, do not cut & paste the lyrics from another source.
    -Now click on the menu item Now Playing

    Do you not see the words on it displays newly created file?

    If this isn't the case, please perform the following steps:

    -Click Start, type CMD in the search bar and right click the icon calls command that appears and click left on run as administrator
    -Type:
    SFC/scannow
    and press ENTER.

    This analysis of your Windows installation, corrupted files and repair them.

    Also, please proceed as follows in Media Center 11:
    -Press the Alt key
    -Go to help and Windows Media Play
    -Click on the link to the Technical Support information

    Please copy and paste all the information under Audio & Video Codecs and filters MPEG/DVD so that we can take a look.

    -Thank you

  • Windows Experience Index problem: could not measure the performance of video playback

    My pc is not yet rated. When I click on rate appears on this computer, a msg error saying that Windows Experience Index for your system could not be calculated, could not measure the PERFORMANCE of VIDEO PLAYBACK. What should I do. Help, please

    Hello

    Here are a few things to check before launching performance index Windows (WEI).

    • Quit all running programs, and restart the computer before running the assessment (WEI).
    • Check with the manufacturer of the computer or the motherboard manufacturer for BIOS updates.
    • Make sure you have the latest Windows 7 compatible drivers for the graphics device installed (video card).
    • If you have any third-party media players installed, uninstall them until the end of the evaluation of the WEI.
    • If you have installed any third-party Media Codecs, try to uninstall them until the end of the evaluation of the WEI.

    Open Windows Explorer and navigate to the folder C:\WINDOWS\Performance\WinSAT .

    You should see the following 8 videos.

    2 files with .mp4 extension.

    3 files with the .mpg file extension.

    3 files with .wmv file extension.

    Double-click each of these files. They should open and play in Windows Media Player. These are the files that WEI runs video performance.

    One thing to remember is that the WEI score is only an indicator of the ability of the main components of hardware on the computer. It has no effect on the performance of the system.

    Tell us what you find.

    Concerning

  • can't see the new startup experience and recent file

    I installed the latest version of Photoshop 2015.1 nov. on the two PC Win 10, Italian version, but no way to see the new experience of starting or recent files. In 'General Preferences', I activated the 'show beginning workspace... '. "and"see the recent file... ». So, what can I do?

    Hi patty,

    The new splash screen in only supported in English, French, German and Japanese now

    From now there is no information about the language support.

    Kind regards

    ~ Mohit

  • Query to see the list of tables is selected frequently

    Hi all


    Please tell me is it possible to find out the list of tables is repeated selected, (Please exclude the insert + updates + deletions truncated drop).


    Concerning

    Hi Sameer

    You can check V$ SQL_PLAN to see the objects being accessed by your SQL queries. If you have a diagnostic license, you can also consult DBA_HIST_SQL_PLAN

    select distinct object_owner, object_name from v$sql_plan;
    
    select object_name, count(*) from v$sql_plan group by object_name
    

    Remember, this is only a crude way to find this information.

    Concerning
    Vincent

Maybe you are looking for

  • Port of question - no video - DVI double separator i7-HDMI &gt; DVI

    What I'm missing here? I have an i7 2.3 g-Mini late2012.  10.8.5. in a studio where I fed a dual display using a separator of video signals by - everything first, Tripp Lite, now an Aluratek - DVI 2-port video splitter (powered units). Followed by al

  • Satellite A100: No stereo mix in my record control

    Hello I need a stereo mix in the control record. But how?Name of the sound card: Realtek HD Ty

  • Call a DLL in TestStand by reference

    All, I developed a DLL that control a USB based power. The call of the dll works from TestStand 4.1 most of the time. What I think is happening, is that whenever I call the dll in my main sequence of the file as well as other files in sequence, as se

  • Be able to get rank to 4.0.4

    Hello I live in Israel and I got phone Xperia Ray. It comes with Go 2.3.6 and continues to say that my phone is up to date. I tried the two Sony PC Companion and on the phone itself the settings-> about phone-> software update. No luck - the phone si

  • Unable to connect to the database server messages

    I checked all the posts here on this subject and can not find a solution if we go I have a new C410 all-in-one Premium fax - sets up a fine on a wired network or wireless and prints & Fax etc. without any problem, but when I try to activate eprint I