Insert SQL % number of ROWS in the table for forest exploitation

Hi Experts,

I have a stored procedure that I want to write to a log table the actual number of lines inserted for the audit later if necessary.

Despite,.

var_year is a parameter

but the error is thrown to the SQL % ROWCOUNT, saying: the symbol is not recognized.

INSERT IN T_LOG (var_Year, time, message) VALUES (year, SYSDATE, TO_CHAR(SQL%ROWCOUNT) |' xxxxx ' |) VAR_year | 'inserted');

Any ideas?

Declare a variable of type NUMBER.

Immediately after your INSERT, copy SQL ROWCOUNT % to this variable.

Then use this variable to insert in the newspaper.

declare

number of l_rowcount;

Start

-Insert stuff

l_rowcount: = SQL % ROWCOUNT;

INSERT IN T_LOG (var_Year, time, message) VALUES (year, SYSDATE, TO_CHAR (l_rowcount): ' xxxxx ' |) VAR_year | 'inserted');

--

end;

/

Tags: Database

Similar Questions

  • number of rows in the table

    Hi master,

    I have a requirement. During the passage of a table, I need to get the number of rows in this table. Sometimes, when I spend 2 or more table names, I need to get the same count of result of lines. I got the below function. but it shows all the rows in the table. I want pariticular tabels only. How I can I get it.

    Select table_name, num_rows from all_tables where table_name in ('EMP', 'Department');  I tried.  I need to a procedure or function. who will pass the name of the table as a parameter and 1 or more than the name of a table if I pass, I need to display information from table name and number of lines.

    CREATE OR REPLACE

    TYPE t1_obj AS OBJECT)

    table-name VARCHAR2 (30),

    CNT NUMBER

    )

    /

    CREATE OR REPLACE

    TYPE t1_obj_tbl AS THE t1_obj TABLE

    /

    CREATE OR REPLACE

    FUNCTION (f1)

    p_schema_name VARCHAR2

    )

    RETURN t1_obj_tbl

    PIPELINED

    IS

    v_retval t1_obj: = t1_obj (null, null);

    BEGIN

    FOR v_rec IN (SELECT table_name FROM dba_tables where owner = upper (p_schema_name) and nvl (iot_type, 'X')! = "IOT_OVERFLOW") LOOP

    v_retval.table_name: = v_rec.table_name;

    RUN IMMEDIATELY "SELECT COUNT (*) FROM" | p_schema_name | '.' || v_rec.table_name

    IN v_retval.cnt;

    PIPE ROW (v_retval);

    END LOOP;

    RETURN;

    END;

    Select * from table (f1 ('scott'));

    The above function returns information from the table in SCOTT scheama. I need only perticular table info.

    Please notify.

    AR.

    Hi Sven,

    Front end people ask me the requirement. They wanted a proc or function as I want.

    Please help me.

    Concerning

    AR

  • Question on the number of rows in the table bean

    Hello

    I have a table with the name of column to column, change the image...

    I 100 columns like that, and I set the number of lines to display in the 30

    Suppose that when I am in the 55th row in the table by clicking next... I clicked on the image for that particular line, it opens the new page. And now if I select Cancel button on this new page... I go to the previous screen that has table.
    But what my problem is it shows lines from the opening of the table... not the page (55th place) where I went to the new page. Is it possible to go to previously visited set of rows in the table?

    Please solve my problem.

    Hello

    When you browse the page, you can capture the index of the scope of the
    current line selected in the object attached to the table view and store
    the session

    OAViewObject oaviewobject = (OAViewObject) oaapplicationmodule.findViewObject ("YourVOName")
    int l = oaviewobject.getRangeStart ();
    pageContext.putSessionValue ("range", l);

    so when you return to the page and in process request you can reset the index of the range as previously selected.

    Range of String = (String) pageContext.getSessionValue ("range");
    int k = (int) Integer.parseInt (range);
    oaviewobject.setRangeStart (k);

    Thank you
    Gerard

  • Display the option button if the number of rows in the table is equal to 1

    I'm having issues there buy maybe a simple script out there.

    I have a table which can have up to four lines. If the table contains only one row, an option button can be clicked to change the format/entry of cells in this row. I have to hide this box of a user option, if they added more of a line to the table and make it available again if they reduce the number of lines to one.

    I have everything else works well (radio buttons change line format, add/delete rows in the table using buttons, number of rows in the first column)

    Anyone have any ideas?

    See you soon

    Bobby

    You can place it in the code that adds more lines when running... If you have questions send the fomr to [email protected] so I can check it out...

    Thank you

    Srini

  • Download sql % number of rows on a table

    We have

    REMOVE from X WHERE Y = "aaa";

    Dbms_output.put_line (number of rows sql %);

    The above shows the number of deleted rows.

    You want to load the value of rowcount % sql on a table. Using the below

    INSERT IN the AUDIT (COUNTY) VALUES (number of rows sql %);

    -error.

    Please let me know how to load this value in an audit table. Thank you

    Store it in a variable after remove it and insert the contents of the variable by using the insert statement later.

    HTH

  • How to find how the number of rows in the table of all the

    Hi all,

    Is it all tables $ v of information on how many rows the table holds?


    Thank you and best regards,
    Delphine K

    Vijay

    It does not reflect the exact number of lines because they don't are filled whenever there is a record inserted instead they are updated when tables are analysed

    If you insert a record and compare the two ALL_tables and count (*) you can find the difference

      1* select num_rows,owner from dba_tables where table_name='LOGONTRIGGER'
    SQL> /
    
      NUM_ROWS
    ----------
    OWNER
    --------------------------------------------------------------------------------
    
    SYS
    
     analyze table LOGONTRIGGER compute statistics;
    
    SQL> select num_rows,owner from dba_tables where table_name='LOGONTRIGGER';
    
      NUM_ROWS
    ----------
    OWNER
    --------------------------------------------------------------------------------
          2961
    SYS
    

    There is always difference

  • How can I get the number of rows in the table using Sunopsis API target in ODI 10 g?

    Hi guys,.

    In fact, I want to send an alert message as soon as the interface is run from a package. I've included alert OdiSendMail that sends an email once the interface is running.

    Could someone please tell how to get the number of rows inserted into the table the Sunopsis API target.

    I tried to use < % = odiRef.getNbRows () % >, but this has not worked for me. Since I am a beginner, could you please help out me

    This is my mail to send ODI format

    "The population of data managed to < % = odiRef.getSysDate () % >

    Total of lines in the target table is: < - need an API code-> "


    Kind regards

    Clinton

    Published by: LawrenceClinton on February 25, 2013 20:53

    Hello

    Create the project with details below variable

    Nom_de_variable: Total_Row_Count

    Type of variable: Variable discount

    Definition tab:
    Data type: digital
    Action: No persistent

    Refresh the tab:
    Schema: provide the schema of your repository to work and be

    SELECT log.nb_row
    THE journal of snp_step_log, snp_scen_step step
    WHERE log.nno = step.nno
    AND step.scen_no = (SELECT scen_no FROM snp_scen_step WHERE step_name='<%=odiRef.getPrevStepLog ('STEP_NAME") % > ')
    AND log.sess_no = '< % = odiRef.getSession ("SESS_NO") % >' code at low
    AND step.step_name = ' < % = odiRef.getPrevStepLog ("STEP_NAME") % > '

    Note: add this variable after the stage of interface in your package (after the interface anywhere you can place), you can add this variable before ODISendEmailNotification in your package

    call this varciable * #Total_Row_Count * in the Notification of ODISendEmail

    for example :

    Data has been fulfilled successfully in < % = odiRef.getSysDate () % >
    Total no of lines filled are: * #Total_Row_Count *

    it will work

    cordially,
    Phanikanth

    edited by: Phanikanth on February 28, 2013 01:13

    edited by: Phanikanth on February 28, 2013 01:14

  • Number of rows in the tables of a schema

    Hello!

    I compare the amount of lines in a diagram
    Select "select count (*) ' |" table_name |' a ' | owner: '. ' || table_name | ';' from dba_tables
    SQL > select count (*) MY_TABLE_NAME of MY_TABLE_NAME;

    MY_TABLE_NAME
    ------------
    10
    you could you please help me to create the script that will be displayed as lines in the table:
    10 MY_TABLE_NAME1
    MY_TABLE_NAME2 20
    thanks and regards,.
    Pavel
    declare
    lcount number;
    lquery varchar2(200);
    begin
    for data in(Select * from user_tables)
    loop
    lquery:= 'select count(*) from '||data.table_name;
    execute immediate lquery into lcount;
    dbms_output.put_line( data.table_name ||----|| lcount);
    end loop;
    end;
    
  • Displays the number of rows in the table displaying a named criteria query data

    I created a test named for my View, called 'Criteria1' and Criteria1 to create a group of ADF with Table query. I want to display the number of rows in result when a search is performed. How can I do?

    Thanks in advance,
    Tom

    As mentioned, you can add outputText and you must give OutputText partialTriggers as query component your Id. Thus, when you give a search on the query component, it will refresh the outputText with the number of lines.


    ID = "ot1" partialTriggers = "id of the component of motion here" / > ""

  • Add the number of rows in the table on the Page Framework OA

    Hi all

    I need to add a line at the bottom of a table in the OA framework to display the number of lines for the underlying table VO. Can someone point me in the right direction to get there?

    Thanks in advance!

    Kristopher

    Hi Kristopher,

    As directed by your post, my understanding is that you want to have a line at the bottom of the table that contains a field that displays the number of rows found in the t... RT?

    You can implement the same in the following way,
    You can add a footer to your table and add a messageStyledText point in it. At this point, you can assign the value of VO.getFetchedRowCount ().

    Hope this is what you are looking for.

    Kind regards
    REDA Papdeja

  • TKPROF output - lines processed / rows in the table anomaly?

    Hello

    TKPROF confusion for me more...

    Oracle 10.2.0.4 on Windows Server 2003.

    I formatted my Trace SQL with TKPROF file and the first query that I am focusing me causes some confusion. It's here (the names have been changed to protect the innocent, but everything remains intact):
    ********************************************************************************
    
    SELECT A.COL1, A.COL2, MIN(A.COL3) AS 
      COL_SYNONYM 
    FROM
     OUR_TABLE A WHERE NVL(A.COL4, NVL(:B4 , -1)) = NVL(:B4 , 
      NVL(A.COL4, -1)) AND NVL(A.COL5, NVL(:B3 , -1)) = NVL(:B3 , 
      NVL(A.COL5, -1)) AND A.COL6 = NVL(:B2 , A.COL6) AND 
      A.COL7 = NVL(:B1 , 1) GROUP BY A.COL1, A.COL2 ORDER 
      BY A.COL1, A.COL2
    
    
    call     count       cpu    elapsed       disk      query    current        rows
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    Parse        1      0.00       0.00          0          0          0           0
    Execute     83      0.01       0.01          0          0          0           0
    Fetch       83      1.01       1.11         12       3154          0      260371
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    total      167      1.03       1.13         12       3154          0      260371
    
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 148  (OUR_SCHEMA)   (recursive depth: 2)
    
    Rows     Row Source Operation
    -------  ---------------------------------------------------
     260371  SORT GROUP BY (cr=3154 pr=12 pw=0 time=956798 us)
     260371   CONCATENATION  (cr=3154 pr=12 pw=0 time=1072560 us)
     260371    FILTER  (cr=3154 pr=12 pw=0 time=630121 us)
     260371     TABLE ACCESS FULL OUR_TABLE (cr=3154 pr=12 pw=0 time=306867 us)
          0    FILTER  (cr=0 pr=0 pw=0 time=201 us)
          0     TABLE ACCESS FULL OUR_TABLE (cr=0 pr=0 pw=0 time=0 us)
    
    
    Rows     Execution Plan
    -------  ---------------------------------------------------
          0  SELECT STATEMENT   MODE: ALL_ROWS
     260371   SORT (GROUP BY)
     260371    CONCATENATION
     260371     FILTER
     260371      TABLE ACCESS   MODE: ANALYZED (FULL) OF 'OUR_TABLE' 
                     (TABLE)
          0     FILTER
          0      TABLE ACCESS   MODE: ANALYZED (FULL) OF 'OUR_TABLE' 
                     (TABLE)
    
    
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file scattered read                          2        0.01          0.02
    ********************************************************************************
    What confuses me is that 'lines' (column 'lines' for the operation "Fetch" = * 260371 *, also 'lines' in the 'line Source operation' and "The execution Plan" = * 260371 *).

    Actual number of rows in the table = * 3138 *.


    I think that because we have performed 83 times, then the value of "lines" should be:
    83 x number_of_rows_in_table = 83 x 3138 = * 260454 *.

    What we have is 260371, who looks like me:
    3137 = 83 x 83 x ( number_of_rows_in_table - 1 )


    I misinterpreted the news (I guess I!)?

    Why seems to be number_of_rows_in_table - 1 ? (Or is it pure coincidence?)


    Kind regards

    ADOS

    That remains a record satisfied with the given list of a predicate in the WHERE clause?

    If this isn't the case, then I don't see anything wrong here.

  • LOV in richeTableau resets the value after the deletion of rows from the table

    Hello. I'm on 11g R2

    I have a table with columns in the box and a button in the toolbar that removes the lines checked

    I have build it based on the following article in her string code

    http://www.Oracle.com/technetwork/developer-tools/ADF/learnmore/index-101235.html


    When I run the "delete" button I execute the following code (taken as is article)


    public void deleteSelectedRows() {}

    create a second line, the value do not affect all lines

    used in ADF

    Set of rows duplicateRowSet = this.createRowSet ("duplicateRowSet");

    first row to avoid "the attempt to access the value of lines."

    exception line was dead.

    duplicateRowSet.first ();

    retrieve the current row of the table for after

    re-running the VO

    Line currentRow = this.getCurrentRow ();

    Boolean currentRowDeleted = false;

    get all rows that have the transoent attribute

    "MarkForDelete' set to true

    Row [] rowsToDelete =

    duplicateRowSet.getFilteredRows ("MarkedForDelete", true);

    If (rowsToDelete.length > 0) {}

    run only throizgh this code, if there is something to

    delete

    for (line rw: rowsToDelete) {}

    If the row is marked as the current in VO, ts value

    Boolean flag

    If (rw.getKey () .equals (currentRow.getKey ())) {}

    currentRowDeleted = true;

    }

    remove the line - do not yet commit

    RW. Remove();

    }

    rerun VO

    this.executeQuery ();

    reset the current line if it has not been removed

    If (! currentRowDeleted) {}

    this.setCurrentRow (currentRow);

    }

    duplicateRowSet.closeRowSet ();

    }

    }

    "MarkedForDelete" is a transient attribute used to mark the line delete

    The lines are removed very well.

    The problem is with lines that I do not delete.

    For example I LOV column. I chose the value LOV in a few lines, and after that choose to delete several lines (not the same lines where I modified the LOV) but some other lines.

    After I click "delete", the lines that I marked to remove deleted indeed, but the value of the LOV in other rows (I have not scored for delete) are disabled.

    How to preserve value LOV so it will remain also after I deleted some lines?

    P.S. I've tried autosubmit = "true" - it did not help

    It is expected because I see that you rerun the query.

    Once you re - run, it retrieves from the database again. Thus, your values are lost because they are not posted.

    I don't think that run query is necessary, try to have a programmatic part trigger on the table after you remove all of the lines.

    Thank you

    Alisson.

  • Get the number of rows in the oracle table

    Hi all
    I want to get the total number of rows in the sql to the appmodule table.
    After you apply the criteria to view some on the view object. If he try with getallrowsinrange the number of rows found within the viewobject was but I want a total number of rows in the sql table.

    How can I get that

    I use jdev 11.1.1.5

    Thanks in advance

    I threw something together, quick and dirty, don't hesitate to optimize.

    Assuming you want the County table, I put the code in a subclass of EntityDefImpl since it is representing a table in the middle tier.

    public class EmpDefImpl
          extends EntityDefImpl {
      /**
       * This is the default constructor (do not remove).
       */
      public EmpDefImpl( ) {}
    
      //~ Methods ****************************************************************************
    
      public long getTableRowCount( DBTransaction transaction ) {
        String query = getQuery( );
        String countQuery = String.format( "SELECT COUNT(*) FROM (%s)", query );
        long count = 0;
    
        ViewObject vo = transaction.createViewObjectFromQueryStmt( countQuery );
    
        try {
          vo.executeQuery( );
    
          Row row = vo.first( );
          Number number = (Number)row.getAttribute( 0 );
          count = number.longValue( );
        } finally {
          vo.remove( );
        }
    
        return count;
      }
    }
    

    Depending on your card type, you may not get an oracle.jbo.domain.Number, but something else, so the cast may need correction.

    Usage example:

    public class EmpEditViewImpl extends ViewObjectImpl {
      public EmpEditViewImpl() {
      }
    
      protected void executeQueryForCollection( Object object, Object[] object2, int i ) {
        super.executeQueryForCollection( object, object2, i );
    
        EmpDefImpl def = ( EmpDefImpl )getEntityDef( 0 );
        long tableRowCount = def.getTableRowCount( getDBTransaction() ) );
    
        // Do something with it
      }
    }
    

    As you can see, the code is fairly generic. Also, you might be able to put this in a base extension ADF class.

    Sascha

    Published by: Sascha Herrmann on June 7, 2012 14:39

  • Count the number of rows in each table

    I have a list of table names, how to write a query to find out the number of rows in each table.

    Select the table table_name from all_tables where owner = 'XXX' and num_row > 100
    or
    Select the table table_name from all_tables where owner = 'XXX' and sample_size > 100


    isn't quite working.
    Why?

    Thanks in advance,

    Published by: mpt_fz on January 12, 2010 12:06

    In recent versions of the db (11g):

    SQL> select table_name, column_value cnt
      from user_tables, xmltable (('count(ora:view("'||table_name||'"))'))
    where table_name in ('EMP', 'DEPT', 'BONUS')
    /
    TABLE_NAME                     CNT
    ------------------------------ -----
    BONUS                          0
    DEPT                           5
    EMP                            14   
    
  • Game max fixed the number of rows in a table

    Hi all

    I created a table that should contain only one line and avoid the possibility to add other lines to it, I used the following:
    CREATE TABLE <table_name> (
        <field_1> <field_type> unique,
        ...
        <field_2> <field_type>
        CONSTRAINT <field_1_ck> CHECK (<field_1> = <value>) 
    );
    It works, but it seems a bit heavy for me... Is there a better way to define a fixed/maximum number of rows in a table?

    See you soon,.

    Valerio

    PS: how to view the code snippets in mode 'IDE-like' (i.e. fixed fonts) spaced, showing dashes, etc.?

    Published by: valerio75 on February 4, 2010 01:48 - now shows the code correctly

    PS: how to view the code snippets in mode 'IDE-like' (i.e. fixed fonts) spaced, showing dashes, etc.?

    Put the

     tag before and after your snippets.
    See the [FAQ|http://forums.oracle.com/forums/help.jspa] for more information regarding tags (scroll down a bit there) .                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
    

Maybe you are looking for