Using DBMS_APPLICATION_INFO.SET_MODULE to get the number of updated rows.

hi.
i have 2 tables to sync so i use the following code. however i included DBMS_APPLICATION_INFO.SET_MODULE to track the number of rows to be updated, but its not showing in v$sessions view. can anyone tell me what am i missing over here ?
DECLARE
l_count NUMBER (20, 0) := 0;
l_updates NUMBER (20, 0) := 0;
l_inserts NUMBER (20, 0) := 0;
BEGIN
FOR i
IN (SELECT date_value,
book_id,
amount
FROM bookstore.book_master_transit)
LOOP
BEGIN
UPDATE bookstore.book_master
SET amount = i.amount
WHERE date_value = i.date_value
AND book_id = i.book_id;
IF (sql%ROWCOUNT > 0)
THEN
BEGIN
l_updates := l_updates + 1;
END;
ELSIF (sql%ROWCOUNT = 0)
THEN
BEGIN
INSERT INTO bookstore.book_master (     date_value, book_id, amount)
VALUES (i.date_value, i.book_id, i.amount);
l_inserts := l_inserts + 1;
END;
END IF;
l_count := l_count + 1;
DBMS_APPLICATION_INFO.set_module ('sync_book_info','total = '|| l_count|| '; updates = '|| l_updates|| '; inserts = '|| l_inserts);
IF (MOD (l_count, 1000) = 0)
THEN
COMMIT;
END IF;
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;
END LOOP;
COMMIT;
END;
when i query v$sessions after running this i couldnt find any entry with the value 'sync_book_info' as the module name. please advice me what i am doin wrong and how to do it right..
thanks in advance,
noviceDBA

novicedba wrote:
hi.
i have 2 tables to sync so i use the following code. however i included DBMS_APPLICATION_INFO.SET_MODULE to track the number of rows to be updated, but its not showing in v$sessions view. can anyone tell me what am i missing over here ?
DECLARE
l_count NUMBER (20, 0) := 0;
l_updates NUMBER (20, 0) := 0;
l_inserts NUMBER (20, 0) := 0;
BEGIN
FOR i
IN (SELECT date_value,
book_id,
amount
FROM bookstore.book_master_transit)
LOOP
BEGIN
UPDATE bookstore.book_master
SET amount = i.amount
WHERE date_value = i.date_value
AND book_id = i.book_id;
IF (sql%ROWCOUNT > 0)
THEN
BEGIN
l_updates := l_updates + 1;
END;
ELSIF (sql%ROWCOUNT = 0)
THEN
BEGIN
INSERT INTO bookstore.book_master (     date_value, book_id, amount)
VALUES (i.date_value, i.book_id, i.amount);
l_inserts := l_inserts + 1;
END;
END IF;
l_count := l_count + 1;
DBMS_APPLICATION_INFO.set_module ('sync_book_info','total = '|| l_count|| '; updates = '|| l_updates|| '; inserts = '|| l_inserts);
IF (MOD (l_count, 1000) = 0)
THEN
COMMIT;
END IF;
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;
END LOOP;
COMMIT;
END;
when i query v$sessions after running this i couldnt find any entry with the value 'sync_book_info' as the module name. please advice me what i am doin wrong and how to do it right..
Totally, 100%, remove & eliminate entire EXCEPTION handler.
Then you will be able to see error being RAISED; like No Privs

Similar Messages

  • Need help using split, how to get the number of inputs?

    I am trying to write a program in which a user inputs several numbers, then the output is how many numbers were input. I am thinking that the best way to do this is to use split, however I am pretty new and can't get it quite down. Thanks

    Sorry, I guess I didnt explain it correctly. The input would be something like this-
    90 87 76 23 99
    Here is what I have-
    import java.util.*;
    public class Scores {
      public static void main(String args[]) {
              int score;
              System.out.println("Input UNC Basketball scores, each separated by a space.");
              Scanner keyboard = new Scanner(System.in);
       int count = args[0].trim().split(?\\s?).length;
    }The int count line was given to me by someone, however I dont know how to get there. Thanks

  • OCI8 OCIStmtFetch() the number of processed rows

    Hello,
    Would someone help me, please.
    How may I get the number of returned rows at the end of the table after OCIStmtFetch() for multiple rows?
    The OCI7 function ofen() returns the number of processed rows.
    Thanks.
    null

    Simon
    For  deleting significant number of rows best practice is to delete rows in small batches of known size (e.g. 10 K) inside a while loop. 
    This keeps transaction log from filling up as well.
    Also between two iterations of delete you can give some wait to make sure that you do not monopolize the server. Sleep could be for a fixed number of seconds (e.g. 5) or for randomized number say from 1 to whatever makes sense.
    Typically "set rowcount " is used to set up the batch size and "waitfor delay" to sleep between iterations.
    Global variable @@rowcount gives yo actual rows deleted. For the last batch this may be lower than the batch size you set up.
    HTH
    Avinash

  • Use SQL function to get the original order number using the invoice number

    Hi All,
    wondering is someone can help me with this challenge I am having?  Often I need to return the original order numbers that created the resulting invoce.  This is a relatively simple seriese of joins in a query but I am wanting to simplify it using a SQL function that can be referenced each time easily from with in the SELECT statement.  the code i currently have is:
    Use SQL function to get the original order number using the invoice number
    CREATE FUNCTION dbo.fnOrdersThatMakeInvoice(@InvNum int)
    RETURNS nvarchar(200)
    AS
    BEGIN
    DECLARE @OrderList nvarchar(200)
    SET @OrderList = ''
    SELECT @OrderList = @OrderList + (cast(T6.DocNum AS nvarchar(10)) + ' ')
    FROM  OINV AS T1 INNER JOIN
          INV1 AS T2 ON T1.DocEntry = T2.DocEntry INNER JOIN
          DLN1 AS T4 ON T2.BaseEntry = T4.DocEntry AND T2.BaseLine = T4.LineNum INNER JOIN
          RDR1 AS T5 ON T4.BaseEntry = T5.DocEntry AND T4.BaseLine = T5.LineNum INNER JOIN
          ORDR AS T6 ON T5.DocEntry = T6.DocEntry
    WHERE T1.DocNum = @InvNum
    RETURN @OrderList 
    END
    it is run by the following query:
    Select T1.DocNum, dbo.fnOrdersThatMakeInvoice(T1.DocNum)
    From OINV T1
    Where T1.DocNum = 'your invoice number here'
    The issue is that this returns the order number for all of the lines in the invoice.  Only want to see the summary of the order numbers.  ie if 3 orders were used to make a 20 line inovice I only want to see the 3 order numbers retuned in the field.
    If this was a simple reporting SELECT query I would use SELECT DISTINCT.  But I can't do that.
    Any ideas?
    Thanks,
    Mike

    Thanks Gordon,
    I am trying to get away from the massive table access list everytime I write a query where I need to access the original order number of the invoice.  However, I have managed to solve my own problem with a GROUP BY statement!
    Others may be interested so, the code is this:
    CREATE FUNCTION dbo.fnOrdersThatMakeInvoice(@InvNum int)
    RETURNS nvarchar(200)
    AS
    BEGIN
    DECLARE @OrderList nvarchar(200)
    SET @OrderList = ''
    SELECT @OrderList = @OrderList + (cast(T6.DocNum AS nvarchar(10)) + ' ')
    FROM  OINV AS T1 INNER JOIN
          INV1 AS T2 ON T1.DocEntry = T2.DocEntry INNER JOIN
          DLN1 AS T4 ON T2.BaseEntry = T4.DocEntry AND T2.BaseLine = T4.LineNum INNER JOIN
          RDR1 AS T5 ON T4.BaseEntry = T5.DocEntry AND T4.BaseLine = T5.LineNum INNER JOIN
          ORDR AS T6 ON T5.DocEntry = T6.DocEntry
    WHERE T1.DocNum = @InvNum
    GROUP BY T6.DocNum
    RETURN @OrderList 
    END
    and to call it use this:
    Select T1.DocNum, dbo.fnOrdersThatMakeInvoice(T1.DocNum)
    From OINV T1
    Where T1.DocNum = 'your invoice number'

  • [Win VC++ 6.0 ]How to get the number of files count in a folder using VC++ 6.0?

    Hi all,
    Can any one tell how to get the number of files(.EPS) count inside a folder when the folder path is specified in VC++ 6.0?
    Thanks in Advance.
    Regards
    myriaz

    I'm a little confused by the question, but it sounds like you're asking how to count the number of files with a particular extension in a given directory? That's not really an AI SDK question, but it's a fairly easy one to find if you google it. If you're trying to use Illustrator to do it, AI doesn't have a general purpose file API. It has a few functions to do some things that Illustrator needs, but I don't think enumerating directories is one of them.

  • What api would I use to get the number of chars in string?

    What api would I use to get the number of chars in string?

    Assuming that you really mean that you want the number of charaters in a String (not string), that would be documented in java.lang.String
    The method is length()

  • Getting the number of pages in excel sheet or current page using OLE2

    Hi,
    I fill an excel sheet using CLIENT_OLE2 from Oracle 10g form,
    I want to get the number of pages in sheet or the number of current page,
    after searching for solution I found this example on VB:
    Sub GetPageCount()
    Dim iView As Integer
    Dim iHorizontalBreaks As Integer
    Dim iVerticalBreaks As Integer
    Dim iPageCount As Integer
    On Error Resume Next
    'go to the range and set PrintArea to the range name
    Application.Goto Reference:="ABC"
    ActiveSheet.PageSetup.PrintArea = Selection.Address
    'turn monitor flickering/updating off
    Application.ScreenUpdating = False
    'remember current View setting
    iView = Application.ActiveWindow.View
    'refresh the print area
    Application.ActiveWindow.View = xlPageBreakPreview
    'set view back
    Application.ActiveWindow.View = xlNormalView
    'turn monitor flickering/updating back on
    Application.ScreenUpdating = True
    'calculate the # of pages
    iHorizontalBreaks = ActiveSheet.HPageBreaks.Count + 1
    iVerticalBreaks = ActiveSheet.VPageBreaks.Count + 1
    iPageCount = iHorizontalBreaks * iVerticalBreaks
    How can I implement this using CLIENT_OLE2?
    Any assistance would be welcome.
    Thanks

    IF all the panels were exactly the same width (highly doubtful for a roll-fold) and IF ID supported 12 pages per spread (it doesn't) then it might be less work to make 12-page spreads and place the PDF twice, but since I think there's a really good chance you'll need to adjust the positioning for at least 22 pages, that seems doomed.
    I wouldn't even bother, in this case, with facing pages. Presumably they want this for the screen, so there's nothing gained from facing pages or multiple columns. You can either make the file with 24 pages and place the PDF 12 times for each page of the PDF, or place each page of the PDF once in a 2-page file, then copy the pages and reposition the image in the frame for each panel. The big thing here is to put the PDF into frames that are the same size as the new page (so they get cropped down to one-panel on each page). Then it's just a case of sliding the the PDF left or right in the frame to expose the next panel.

  • Creative Cloud Student and Teacher Edition .I use the Macbook.I got the mail that said my order was checked,but I don't get the number.So I still use trial.Hoe can I change my character into member?

    Creative Cloud Student and Teacher Edition .I use the Macbook.I got the mail that said my order was checked,but I don't get the number.So I still use trial.Hoe can I change my character into member?

    This is an open forum, not Adobe support... you need Adobe support to help
    Adobe contact information - http://helpx.adobe.com/contact.html
    -Select your product and what you need help with
    -Click on the blue box "Still need help? Contact us"

  • Indesign CS3: How to get the number of the current layer?

    Hallo!
    How to get the number of the current layer in a page?
    Thanks,
    Alois Blaimer

    InterfacePtr<ILayerList> layerList(documentUIDRef, UseDefaultIID());          <br /><br />int32 layerCount = layerList->GetCount();<br /><br />To findout layer name use<br /><br />IDocumentLayer* documentLayer = layerList->QueryLayer(layerIndex);<br />                         <br />PMString layer=documentLayer->GetName();

  • Date - how to get the number of the week

    I have a Date - string - w/e can be convered thats not the problem
    but how do I get the number of the week cuz the database holds events per week so I need to know the number of the week.
    I tried going true the api but I failed to find the right fuction, aldoh I recall seeing it somewhere a while ago.
    anyways got a deathline so easy dukies, first come first serve.

    how's this then?int weekOfYear = 0;
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); //your String format
    Date date = null;
    String dateString = "2003/06/16";
    try {
      date = sdf.parse(dateString);
    } catch (ParseException pe) {
      //hande bad date format
    if (date != null) {
      GregorianCalendar calendar = new GregorianCalendar();
      calendar.setTime(date);
      weekOfYear = calendar.get(Calendar.WEEK_OF_YEAR);
    Warning: Be careful of your locale settings when using week of year, you may need to investigate setFirstDayOfWeek(int value) and setMinimalDaysInFirstWeek(int value) to ensure you get the results you expect.

  • FORMS 9i issue: Is there a [b]SYSTEM build-in to get the number of records?

    In master-detail data blocks, a query generally return multiple records from the detail table. I'd like to know how to get the number of the records:
    1. I use NEXT_RECORD to navigate these records
    2. use SYSTEM.CURSOR_RECORD to know the current record
    3. use SYSTEM.LAST_RECORD to know when the last record is reached.
    What is missing is the total number of the records.
    Thank you in advance for helping

    My tip would also be the summary item

  • Any table or program to get the number of records in P, A and F tables

    HI all
    any table for program to get the number of records in P, A and F tables. I want to create SQ01 queries to get the status of number of records. We are gng for a production cutover next week. Want to capture all the data before and after Upgrade cutover.
    Also suggest me how to create sq01 queries.
    Thanks in advance
    regards
    Janardhan KUmar K.

    Use Transaction LISTSCHEMA to see all the tables assosciated with ur cube
    Total number would be what you find in both the E & F fact tables. If there is no compression in the cube then E table will be empty.
    Alternatively u can use se16 transaction and enter E table and F table manually
    E table - /BIC/E(Cube name) and Ftable -  /BIC/F(Cube name)
    Or else u can go to the manage of the cube and without selecting any field for O/P and ticking the option output number of hits execute. The total of Row Count will give u the total no of records in the cube.

  • How to get the number of issued active certifcates from a CA

    Hi,
    We have a PKI infrastructure still running on Windows Server 2003. How can I get the number of active certificates issued?  I have used the filter option on the issued certifcates node listing the certificates with expiry date after the current
    date, but this list only all the certs without the actual total number of certs.
    Any help is appreciated
    Thanks
    Johan Marais
    JkM6228

    On Wed, 22 Jan 2014 08:57:59 +0000, Martin Rublik wrote:
    certutil -config -view -out "Issued Distinguished Name" -restrict "Certificate Expiration Date > 22. 1. 2013" | findstr Rows
    It will dump CA database look for issued distinguished name (name in the subject of the certificate) and outputs only certificates expiring after 22.1.2013. The output is piped to findstr command that filters the total number of rows.
    There are a couple of problems with the above:
    1. Not every certificate will have a Subject name.
    2. This won't filter out certificates that have been revoked but are still
    time valid.
    3. I couldn't get the "findstr Rows" to return anything and when I look at
    the help for findstr I don't see that as an option for the command.
    This command worked for me, make sure you enter it all on a single line:
    certutil -view -restrict "Disposition=20,NotBefore<January 22 2013" -out
    SerialNumber | findstr /C:"Serial Number:" | findstr /r /n "^" | find /c :"
    Also, if you copy and paste from this post into the cmd window, be careful
    that the quotes and dashes don't get converted into the wrong type.
    Paul Adare - FIM CM MVP
    "for thing in $(fnord $(frob $(./gazonk foo bar baz bletch thud grunt)));
    do
    zot --wodchuck ${thing}; done"
    -- Stig Sandbeck Mathisen making a point about the beauty of shell scripts

  • How to get the number of community members from outside the community

    Hi everyone.
    I need to know if there is any way to get the number of community members from outside the community, I mean, not using the "What's happening" webpart. I want to build up a page with a Webpart that summarize my three most visited communities indicating
    number of members, three last messages in the newsfeed, and number of posts in blog, wikis, document libraries, etc.
    Do I need statistics to get this kind of information? Should I use Sharepoint Object model instead?
    Here is an example of what I need:
    - Community name
    - Number of members
    - Community activity (messages, docs uploaded to library, etc)
    - Number of posts in calendar, blog, wiki that belongs to community
    Thank you all!

    Hi Thuan.
    Thanks for your answer but it does not help me because these communities are Sharepoint Communities not external sites so I need to get that information using SP object model and BCS in this case is useless.
    EDIT
    I found the solution using the search objects but I was only able to get members, discussions and replies
    using (ClientContext clientContext = new ClientContext("URL_OF_ENTERPRISE_SEARCH_CENTER"))
    KeywordQuery keywordQuery = new KeywordQuery(clientContext);
    keywordQuery.QueryText = "The_Name_of_the_Community WebTemplate:COMMUNITY";
    SearchExecutor searchExecutor = new SearchExecutor(clientContext);
    ClientResult<ResultTableCollection> results = searchExecutor.ExecuteQuery(keywordQuery);
    clientContext.ExecuteQuery();
    System.Collections.Generic.IDictionary<string, object> ret = null;
    foreach (System.Collections.Generic.Dictionary<string, object> resultRow in results.Value[0].ResultRows)
    Console.WriteLine("{0}: {1} ({2})", resultRow["CommunityMembersCount"], resultRow["CommunityTopicsCount"], resultRow["CommunitiyRepliesCount"]);
    This is a Console Application.
    I hope someone helps

  • Getting the number of active connections in a connection Pool

    Hi,
    I have an application deployed on jboss. DB used is db2. For monitoring purpose i need to get the number of active and idle connections at any point of time. I am trying to use commons-dbcp jar to get this data using BasicDataSourceClass. Following is the piece of code.
    Context initialContext;
    try {
         initialContext = new InitialContext();
         DataSource ds = (DataSource) initialContext.lookup(myjndiname);
         logger.info("************CONNECTION POOL DATA->" + ds.getClass().getName() + "************" + ds.getClass() + "**************");
         BasicDataSource bds = (BasicDataSource) datasource;
              logger.info("************CONNECTION POOL DATA-> ACTIVE CONN=" + bds.getNumActive() + " IDLE CONN=" + bds.getNumIdle() + " INIT SIZE=" + bds.getInitialSize());
    catch (NamingException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
    This code gave a class cast exception at the point datasource is cast to BasicDataSource. The class name returned by ds is WrapperDataSource. I have few queries on this:-
    1. What configurations do i need so that datasource returned by InitialContext is BasicDataSource? FYI i tried to add the BasicDataSourceFactory in db2-ds.xml. But it still didnt work
    2. Is there any other way to find the number of active connections in a connection pool? I dont want any server specific solution.
    Pls help.
    Thanks

    user13642196 wrote:
    Hi,
    I have an application deployed on jboss. DB used is db2. For monitoring purpose i need to get the number of active and idle connections at any point of time. I am trying to use commons-dbcp jar to get this data using BasicDataSourceClass. Following is the piece of code.
    Context initialContext;
    try {
                 initialContext = new InitialContext();
                 DataSource ds = (DataSource) initialContext.lookup(myjndiname);
                 logger.info("************CONNECTION POOL DATA->" + ds.getClass().getName() + "************" + ds.getClass() + "**************");
                 BasicDataSource bds = (BasicDataSource) datasource;
              logger.info("************CONNECTION POOL DATA-> ACTIVE CONN=" + bds.getNumActive() + "  IDLE CONN=" + bds.getNumIdle() + "   INIT SIZE=" + bds.getInitialSize());
    catch (NamingException e) {
                 // TODO Auto-generated catch block
                 e.printStackTrace();
    }This code gave a class cast exception at the point datasource is cast to BasicDataSource. The class name returned by ds is WrapperDataSource. You can only cast an object to an interface it implements or to a class it extends (directly or indirectly).
    I have few queries on this:-
    1. What configurations do i need so that datasource returned by InitialContext is BasicDataSource? FYI i tried to add the BasicDataSourceFactory in db2-ds.xml. But it still didnt workhttp://commons.apache.org/dbcp/api-1.2.2/org/apache/commons/dbcp/package-summary.html#package_description

Maybe you are looking for

  • Sharepoint excel data not refreshed

    Hi All, I have SharePoint foundation 2010, add one excel document after that trying to open that excel document it is showing error message. Error message:- Unable to referesh data for a data connection in the workbook. try again or contact your sha

  • Vista..Can't connect to the iTunes store... Could before, but not now...

    I recently had a problem with not being able to connect to the iTunes store on Vista. I was able to connect, and then all of a sudden one day it wouldn't connect. When I tried to go to the iTunes store it would give me the box that is the same as the

  • IPhone no longer syncs with computer--"Cannot access the iTunes store"

    My iPhone 2G has decided to no longer sync with my iTunes. I do not have internet on my computer (I'm doing this on a friend's), so when I connect my iPhone to my computer, an error message pops up that says "Cannot access the iTunes store". Since my

  • Import remarks with multiple lines

    Hi, How can I import using DTW for Item remarks with multiple lines?

  • Approvers of Shopping carts / po & po versions

    Hi, Is there any way to find information about who approved a given shoppingcart / po & po versions? An we are using N-step approval we would like to show a list with all shoppingcarts / po & po version a given user has approved. Thanks in advance. B