How to implement multi threading in pl/sql

Hi,
I have to run a pl/sql procedure which calls multiple instances of another procedure of some other package.
How should I proceed to do it?
Bhaskar.

Actually the final table that need to be updated has
millions of records.
Hence I am thinking of multithreading.1) Why are you updating millions of records? Frequently, it is more efficient to do a direct path insert of the final data from a staging table into the final table rather than trying to update millions of rows in place.
2) Are you using parallel DML? SQL already provides the ability to enable parallelism if that is going to improve the performance of your queries. There is, in general, no need to re-implement that in PL/SQL.
And all the information are communicated within the
same session.I'm not sure I understand what you're saying here...
Justin

Similar Messages

  • How should implement multi-thread in single-threaded Operating system using

    How should implement multi-thread in single-threaded Operating system using java?
    Java supports "Multi-threading".Is there is any way run the multiple threads (Implementing multi threading) using java in a Single-threaded Operating system (That is the operating system does not support for multi-threading).

    Previous questions from OP suggest they are using J2ME, so the question might be possible.
    806437 wrote:
    How should implement multi-thread in single-threaded Operating system using java?
    What is the actual question/problem?
    A java app doesn't do threads or not do threads. It uses classes. The VM does threads.
    So if you have a platform that does not have threads and you want to support the thread class then the VM, not a java app, must provide some pseudo mechanism, such as green threads, to support that.
    If your question is about java code and not the VM then you must build a task engine and insure that the tasks are of short enough duration that it is an effective use for your system.

  • How to implement multi threading without using Java's synchronization

    I have a shared Object called "tradeObj" whose attributes are "Price" and "Quantity".
    Thread1 is going to change the price and Thread2 is going to change the quantity but not stepping on each other's update.
    Because of the cost of synchronization, I dont want to use "Synchronize", but still want to make sure both threads make their update in a proper manner.
    Any ideas?

    Soph wrote:
    I have a shared Object called "tradeObj" whose attributes are "Price" and "Quantity".
    Thread1 is going to change the price and Thread2 is going to change the quantity but not stepping on each other's update.given above I would guess [your interviewer|http://forums.sun.com/thread.jspa?messageID=10976469#10976469|interview] had in mind reducing locks contention (google for "java concurrency locks granularity" or "java concurrency locks contention" if you're interested)
    // disclaimer: I didn't test this code with compiler
    class TradeObj {
      private int price, quantity;
      // locks
      private final Object priceLock = new Object();
      private final Object quantityLock = new Object();
      public int getPrice() {
        synchronized (priceLock) { return price; }
      public void setPrice(int price) {
        synchronized (priceLock) { this.price = price; }
      public int getQuantity() {
        synchronized (quantityLock) { return quantity; }
      public void setQuantity(int quantity) {
        synchronized (quantityLock) { this.quantity = quantity; }
    Because of the cost of synchronization, I dont want to use "Synchronize", but still want to make sure both threads make their update in a proper manner.what you want above doesn't make much sense to me sorry
    Any ideas?Edited by: gnat on Apr 23, 2010 9:44 AM

  • How to implement multi-source XSLT mapping in 11g PS3 BPEL  ?

    Hi
    How to implement multi-source (single destination) XSLT mapping in 11g PS3 BPEL ? Is there any good example step by step ?
    thx
    d

    Hi d,
    Also there's a sample available at samplecode.oracle.com mapper-105-multiple-sources.zip.
    Regards,
    Neeraj Sehgal

  • Can anybody know how to configure Multi threaded server?

    Hi
    All,
    Can anybody know how to configure Multi threaded server?
    Thanks,
    Vishal

    Values are just samples only. use what ever appropriate for your environment. Understand each of them before using in production.
    alter system set DISPATCHERS="(PROTOCOL=tcp)(DISPATCHERS=3)(CONNECTIONS=1000)"
    alter system set shared_servers=100
    replace "DEDICATED" with "SHARED" in tns names
    Ready to go.
    select username,server from gv$session (server should show none or shared)

  • How to implement email facility in PL/SQL programs.

    Is there any Oracle package which supports email facility?
    I have some dbms automatic jobs fires every half hour, in case there is any failure in the process I would like to send an email to user or the person who is running the job.
    Can some body tell me how to implement it in PL/SQL?????????????

    You might find this article useful..
    visit..
    http://www.oracle.com/oramag/code/tips2000/090400.html

  • How to use Multi Thread to make a animation

    Hello
    Currently i am writing a router simulator using Java SE 1.4.2. I am facing a problem that is I cannot use multithread to update my Jframe animation.
    Here i give my approach.
    My idea is I used a JPanel in JFrame and I used Graphics g draw all background in Jpanel and add it into Jframe. It works since there is no animation invovled. I want to do some animation based on this background which i draw. But all animation should be controled by other threads due to i want other threads can control all animation. But i hit a error which is nullpointexception. The reason looks like which i used another to do animation, it cannot find the reference which is point to the Jpanel and Jframe. May u teach me a correct way to do multi threads animation in Jframe? thanks.
    all the best and regards!

    A simple annimation moving a circle round a screen. This uses a model that defines the dynamics of the annimation, a view to display a visual representation of the model and an event system (observer/observable) to notify the view that the model has changed.
    I hope this helps.
    import java.awt.*;
    import javax.swing.*;
    import java.util.*;
    public class Test20041023 extends JFrame
        public Test20041023()
            super("Simple Annimation Demo");
            AnnimationModel annimationModel = new AnnimationModel();
            AnimationView animationView = new AnimationView(annimationModel);
            setContentPane(animationView);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            pack();
        private static class AnimationView extends JPanel
            private static final int PREFERRED_WIDTH = 512;
            private static final int PREFERRED_HEIGHT = 256;
            AnimationView(AnnimationModel annimationModel)
                // Save a reference to the model for use
                // when the view is updated
                annimationModel_ = annimationModel;
                // Listen for the events indicating that the model has changed
                annimationModel_.addObserver(new Observer()
                    public void update(Observable o, Object arg)
                        // All we need to do is to get the view to repaint
                        AnimationView.this.repaint();
            public void paintComponent(Graphics g)
                super.paintComponent(g);
                // Update the view based on the information in the model.
                g.setColor(Color.red);
                // Convert the model positions to view positions
                // in this case by scaling to the actual width and height.          
                int xScreenPosition = scaleValue(annimationModel_.getX(), getWidth() - 20 ) + 5;
                int yScreenPosition = scaleValue(annimationModel_.getY(), getHeight() - 20 ) + 5;
                // Display the position of the point
                g.fillOval(xScreenPosition, yScreenPosition, 10, 10);
            private int scaleValue(double v, double size)
                return (int)((v+1.0)*0.5 * size + 0.5);
            public Dimension getPreferredSize()
                return new Dimension(PREFERRED_WIDTH, PREFERRED_HEIGHT);
            // The saved reference to the model
            private AnnimationModel annimationModel_;
        private static class AnnimationModel extends Observable
            AnnimationModel()
                Thread annimationThread = new Thread()
                    public void run()
                        // Loop forever updating the model
                        // and notifying the observers.
                        while(true)
                            // Wait 0.05 seconds until the next frame update point
                            try
                                sleep(50L);
                            catch (InterruptedException e)
                                // Nothing to do
                            // Update the model - in this case it is very simple
                            theta_ += 0.1;
                            // Notify the observers
                            setChanged();
                            notifyObservers();
                annimationThread.start();
            // Model access methods
            public double getX()
                return Math.cos(theta_);
            public double getY()
                return Math.sin(theta_);
            // The angular position of the point
            private double theta_;
        // Simple test main
        static public void main(String[] args)
            new Test20041023().setVisible(true);
    }

  • How to implement optemistic locking in pl/sql for oracle database

    i have search the net to find example of how i can do the optimistic locking in pl/sql, all the resources i found were old , for example "Optimistic Locking with Concurrence in Oracle.
    As " by Graham Thornton Snr. Database Architect / Oracle DBA in 2001, but at the end he said that the approach will not work fine if the update being made is a relative update, this apprach includes:-
    1.add a timestamp column to an exsiting table.
    2.add a preinsert trigger on the table to set the timestamp.
    3.add a preupdate trigger to comapre the old time stamp with the new one.
    So where i can find updated resources about this issue.
    Edited by: 812643 on 17-Nov-2010 12:39

    totally plagiarized from expert oracle database architecture 9i, 10g, 11g by Tom Kyte pg201
    one popular implementation of optimistic locking is to keep the old and new values in the application and upon updating the data use and update like this
    update table
    set column1 =: new_column1, column2 = : new_column2, ...
    where primary_key = :primary_key
    and decode( column1, :old_column1, 1 ) = 1
    and decode( column2, :old_column2, 1 ) = 1
    another implementation
    optimistic locking using a version column
    add a single column to each database table you wish to protect from lost updates. this column is generally either a number or date/timestamp column
    It is typically maintened via a row trigger on the table, which is responsible for incrementing the number column or updating the date/timestamp column
    every time a row is modified.
    another one on page 204
    optimistic locking usin a checksum
    similiar to the version column implementation but it uses the base data itself to compute a virtual version column.
    the ones suggested where owa_opt_lock.checksum, dbms_obfuscation_toolkit.md5, dbms_crypto.hash, ora_hashEdited by: pollywog on Nov 17, 2010 3:48 PM
    might be a good book for you to look into getting it has a whole chapter on locking and latching.
    Edited by: pollywog on Nov 17, 2010 3:54 PM

  • How to implement  multi-companies schemas?

    I need to implement a multi-companies data base. There will be only one server and all the clients of the differents companies will have access to this server.
    How can I do this?
    - Tables with a company column
    - A schema per company
    Any suggestion?
    Regards

    In my mind, the simplest possible thing that could work would be a single schema where most if not all tables had a COMPANY_ID column, a context that gets populated with the COMPANY_ID, and a view layer that reads the data from the context to limit the set of rows that the current session can access. That way there is only one view that provides company-specific data regardless of the company rather than one view per company. This would be relatively similar to the VPD solution replacing policies on tables with views.
    You can create a context
    CREATE OR REPLACE CONTEXT your_context_name USING your_authorization_pkg;where YOUR_AUTHORIZATION_PKG is a package that determines which COMPANY_ID a particular session will have access to. That's one of the more vulnerable pieces of the infrastructure here, so you'll want to make sure that it is well secured. Within YOUR_AUTHORIZATION_PKG, you would set the value of the context
    DBMS_SESSION.SET_CONTEXT( 'YOUR_CONTEXT_NAME', 'COMPANY_ID', <<computed company id>> )where <<computed company id>> is the company ID that your package has determined the user has access to. Your view layer can then reference the value in the context
    CREATE OR REPLACE VIEW vw_employee
    AS
    SELECT *
      FROM employee
    WHERE company_id = SYS_CONTEXT( 'YOUR_CONTEXT_NAME', 'COMPANY_ID' );This isn't as easy or as secure as VPD, but it's often close enough.
    Justin

  • How to implement Dynamic Sort to an SQL classic report?

    Hi,
    I'm trying to implement dynamic sort to my working sql classic report, when user selects order by column from select item(action as submit page), the report should be refreshed and display with the selected column sort order.
    But not able to do so.
    Report Query:
    Select a, b, c from sample order by :P1_ORDER_BY
    P1_ORDER_BY - Select Item:
    STATIC2: Column 1;a, Column 2;b, Column 3;c
    Running page, report doesnt sorts in any of the column priority.
    Kindly guide.
    Regards,
    Krishna

    Of course the select item is in use.
    It should submit the the page on select so you can retrieve the current value in you report select statement.
    look here:
    http://apex.oracle.com/pls/apex/f?p=21296:2:
    table:
    create table sample
      a varchar2(30)
    , b varchar2(30)
    , c varchar2(30)
    insert into sample values('a','z','k');
    insert into sample values('b','y','d');
    insert into sample values('c','x','a');
    insert into sample values('d','w','b');
    commit;
    Select List:
    P2_ORDER_BY
    STATIC:Order by A;A,Order by B;B,Order by C;C
    Report select:
    select
    a,b,c
    from sample
    order by
      decode(:P2_ORDER_BY,'A',a,null)
    , decode(:P2_ORDER_BY,'B',b,null)
    , decode(:P2_ORDER_BY,'C',c,null)Marc
    Edited by: telemat on Aug 24, 2012 1:50 PM

  • How to implement a vector in PL/SQL?

    I have a very simple question. I would like to implement
    a vector like data[i][j] in PL/SQL. What is the best way to do this?
    Thanks in advance.

    Look here:
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/05_colls.htm#1059
    Rgds.

  • How to regulate multi threads

    so i have a server code that looks like this (just the essential part)
    System.out.println("Listening...");
    new ServerClient(serverSocket.accept(), display, shell,textField).start();so it should first print "Listening," and when a connection is accepted, make a new ServerClient thread and it should print the IP of the client, and then back to "Listening." here's a sample output:
    Connected to port 5555
    Listening...
    Listening...
    /169.237.49.186:1607 connected.so that second "Listening..." line should be printed after "blabla connected." how do i regulate this?

    after "blabla connected." how do i regulate this?Why do you want to?
    Usually, the idea behind havine multiple threads is that they can run independently of each other. You normally don't--and shouldn't--care which one gets cycles when.

  • EJB3 Stateful Sessionbean how to implement multi business interfaces?

    Hi All,
    I met up some issue, can't make the session bean implement 2 business interfaces? Please kindly throw me some light! thanks
    Business sessionbean
    @Stateful
    @ConversationScoped
    @Named
    @Local( { IWizard.class, IRegisterWizard.class })
    public class RegisterWizard extends WizardBean {
    @Local
    public interface IWizard extends Serializable {
            public String back();
            public boolean hasBack();
            public boolean hasNext();
            public String next();
            public String abort();
    @Local
    public interface IRegisterWizard{
            public String submit();
    }error message of glassfish3 below:
    Caused by: java.lang.IllegalArgumentException: Not enough type information to resolve ejb for  ejb name class wizard.RegisterWizard
            at org.glassfish.weld.services.EjbServicesImpl.resolveEjb(EjbServicesImpl.java:121)
            at org.jboss.weld.bean.SessionBean.createReference(SessionBean.java:422)
            at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.<init>(EnterpriseBeanProxyMethodHandler.java:76)
            at org.jboss.weld.bean.SessionBean.create(SessionBean.java:298)
            ... 53 more

    There does appear to be a bug in the handling of the bean with multiple business interfaces. I filed an issue for it :
    https://glassfish.dev.java.net/issues/show_bug.cgi?id=11826. The inheritance is a separate issue. Are you getting the same error or a different one after applying @LocalBean.

  • What is multi threading?

    Hi all,
    What is multi threading? How to implement multi threading in ABAP?
    Regards,
    Bryan

    Hi
    How the vision connector framework works
    The connector interacts with an SAP application using connector modules. The connector modules make calls to SAP's Native Interfaces and pass data (business object or event data) to and from an SAP application. The connector's flexible design enables different modules to be used for different tasks such as initializing the connector with the SAP application or passing business object data.
    Communication between the connector and an SAP application
    The connector uses SAP's Remote Function Call (RFC) library to communicate with an SAP application. SAP's RFC API allows external programs to call ABAP function modules within an SAP application.
    Processing business objects
    The connector is metadata driven. Metadata, in the WebSphere business integration system, is application-specific data that is stored in business objects and that assists a connector module in its interaction with the application. A metadata-driven connector module handles each business object that it supports based on metadata encoded in the business object definition rather than on instructions hard-coded in the connector module.
    Business object metadata includes the structure of a business object, the settings of its attribute properties, and the content of its application-specific information. Because connector modules are metadata driven, they can handle new or modified business objects without requiring modifications to the connector-module code.
    The vision connector framework uses the value of the verb application-specific information in the top-level business object to call the appropriate connector module to process the business object. The verb application-specific information provides the classname of the connector module.
    The verb application-specific information of most top-level business objects must identify the classname of the connector module. The syntax of this verb application-specific information is:
    AppSpecificInfo = PartialPackageName.ClassName,
    For example,
    AppSpecificInfo = sap.sapextensionmodule.VSapBOHandler,
    In this example, sap.sapextensionmodule is the partial package name, and VSapBOHandler is the classname. The full package name includes the com.crossworlds.connectors prefix, which the WebSphere business integration system adds to the name automatically. In other words, the full text of the example is:
    com.crossworlds.connectors.sap.sapextensionmodule.VSapBOHandler
    Note:
    The verb application-specific information of most top-level business objects must use a comma (,) delimiter after the connector classname. However, the Server verb, which is used by the RFC Server Module, is delimited instead by a semi-colon (;). For information about the Server verb, see How the RFC Server Module works and Supported verbs.
    You need not specify the package name and classname for the verb application-specific information if the business object is used:
    by the ALE Module to process application events; however, when you use the ALE Module to process service call requests, you must specify the package name and classname
    by the ABAP Extension Module, which uses the default business object handler (sap.sapextensionmodule.VSapBOHandler)
    Important:
    Customer-generated connector modules that process business objects for the RFC Server Module must specify a full package name, which must begin with bapi. For example, bapi.client.Bapi_customer_getdetail2. The full package name in this example is bapi.client, and the classname is Bapi_customer_getdetail2.
    Most business object processing is specific to each connector module. By default the connector uses the ABAP Extension Module. For more information on business object processing for the ABAP Extension Module, see Installing and customizing the ABAP Extension Module and Business object data routing to ABAP handlers. .
    For more information on specifying verb application-specific information for the ALE Module, see Event processing and Processing multiple IDocs with a wrapper business object.
    Processing multiple concurrent interactions
    The Adapter Framework can create separate threads for processing an application event and a business object request. When processing multiple requests from the integration broker, it can create multiple threads to handle multiple business object requests. For example, when InterChange Server is the integration broker, the connector can receive multiple business object requests from multiple collaborations or from a multi-threaded collaboration.
    Figure 4 illustrates the multi-threading architecture.
    Figure 4. Multi-Threading Architecture of the Connector for SAP
    Event processing
    The connector performs the following steps when handling a poll call:
    The Adapter Framework creates a single dedicated thread to handle poll calls. This thread calls the pollForEvents() method of the vision connector framework at the frequency specified in the PollFrequency configuration property.
    The thread polls SAP, which uses a dialog process to locate and return the event.
    Note:
    If the connector's MaxNumberOfConnections configuration property evaluates to a number greater than 1, the vision connector framework dedicates a connection to SAP for polling. If MaxNumberOfConnections evaluates to 1, event and service-call request processing share a single connection to SAP.
    The polling thread dies only when the connector shuts down.
    Note:
    Because the RFC Server connector agent pushes events out of SAP instead of polling for events, it spawns its own threads instead of using threads created by the connector framework. Because the ALE connector agent uses the RFC Server connector agent to access events, it also spawns its own threads instead of using threads created by the connector framework when it processes events.
    Request processing
    Independently of polling, the Adapter Framework can create multiple request-processing threads, one for each request business object. Each request thread instantiates the appropriate business object handler.
    For example, when processing business object requests from InterChange Server, the number and type of business object handlers depends on the number and type of the collaborations sending the requests:
    If multiple collaborations send business objects, each request thread instantiates a business object handler of the appropriate type.
    If a multi-threaded collaboration sends multiple business objects of the same type, the request threads instantiate an equal number of business object handlers of that type.
    If the connector's MaxNumberOfConnections configuration property evaluates to a number greater than 1, the vision connector framework dedicates one connection to SAP for polling and allocates the remaining connections to a pool used only for request processing.
    As illustrated in Figure 4, the connector performs the following steps when handling a business object request:
    The Adapter Framework creates a separate thread for each business object request. Each thread calls the doVerbFor() method of the Vision business object handler.
    If the connector's MaxNumberOfConnections configuration property evaluates to a number greater than 1, the Vision business object handler checks the vision connector framework's connection pool to determine if a connection handle is available.
    If the handle is available, the thread sends the request to SAP, which uses a dialog process to handle the request.
    If the handle is not available, the thread waits until one becomes available. Thread sequencing determines the order in which each business object handler thread claims or waits for an available connection handle.
    If the connector's MaxNumberOfConnections configuration property evaluates to 1, the Vision business object handler shares a connection with event processing.
    SAP releases the dialog process after it completes processing and sends a return code.
    The connector releases the connection handle after it receives the return code from SAP.
    Setting the number of available connections
    Use the MaxNumberOfConnections configuration property to specify the maximum number of connection handles available. The number of connections cannot exceed the number of dialog processes.
    SAP locks the dialog process while processing an interaction, releasing it only when the interaction completes. Therefore, multiple concurrent requests lock an equal number of dialog processes until processing finishes.
    Important:
    Before setting a value for MaxNumberOfConnections, contact your SAP BASIS administrator to determine an appropriate value to maximize throughput without negatively affecting performance on the application server.
    Support for multiple connections
    By default the connector supports multiple-threads.
    <b>
    REWARD IF USEFULL</b>

  • Multi-threading in Flash Builder 4.6

    Hello All,
    I am a new user of Flex and Flash Builder 4.6.
    Is there any built-in mechanism that allows to implement multi-threading in Flex/Flash Builder 4.6?
    I have done a little research via the Internet regarding this issue, and I understand that there are ways to implement multi-threading, but I am interested in a built in mechanism.
    Thanks in advance,
    Felix.
    P.S. Some links regarding this issue:
    http://cookbooks.adobe.com/post_Is_multi_threading_possible_in_Flash_or_ActionScri-12026.h tml
    http://www.flexjunk.com/2009/01/15/multi-threading-in-flexair/
    http://blogs.infosupport.com/flex-4-a-multi-threading-solution/

    Wokrers has been just announced today:
    http://www.bytearray.org/?p=3705
    Be patient around 3 more months and it will be out of the box.
    C

Maybe you are looking for

  • How to get my apple tv working

    I just got an apple tv and i am trying to get it to work for my macbook pro, ipad , iphone, and ipod to show up on my tv....is it the home sharing?? if so it does not let me log on with my apple id.

  • Chapters in iMovie 10.0.1

    In the new iMovie 10, I have not found how to put scoreboards of chapters. I believe that it is an indispensable function to make a familiar filming for DVD and to be able to locate the different situations. Does someone know some another way of putt

  • ISE 1.2 EAP Chaining and Windows 8 - Auth failures

    Hi All, I've got a couple sites that appear to have issues with EAP chaining, ISE 1.2 and Anyconnect client on windows 8 enterprise. Basically the windows 8 machines authenticate intermittently and randomly but largely fail auth.  Often the client wi

  • Reader enabling plug-in on Mac OS X

    Hi, I have successfully created and reader-enabled a plug-in on a Windows platform (prooving that the KeyPair and certificate I have are correct). The same plug-in works fine too with Acrobat on Mac OS X. But I could not manage to reader-enable it on

  • Purchase req. item overview data

    Hi all, Does anyone know how could I get the information of purchase requisition "item overview" in ABAP way? The reason I need this is to get item category to determine whether it is standard or consignment. Please help and advice. Thanks in advance