May someone tell me  something about the thread

The ODP.NET document seems to have little words about the thread,or maybe it is the database who deals with the thread. i have some question aboue it.
I define a variable in a package specification,
CREATE OR REPLACE PACKAGE TSTpkg
is
counter NUMBER DEFAULT 0;
END TSTpkg;
then deal with it in a function
FUNCTION addc RETURN NUMBER
AS
cnt NUMBER:=0;
BEGIN
LOOP
EXIT WHEN admin.tstpkg.counter>100;
tstpkg.counter:=admin.tstpkg.counter+1;
cnt:=cnt+1;
END LOOP;
RETURN cnt;
the cnt indicate the number the loop runs,in a single thread program,it will always return 100,for counter is default by 0.Then in C#, i wrote a methord to invoke the funciton"addc" and return the value the function"addc" returns.As far as I am concerned,the variable defined in the package specification should be seen as static element,so if two thread access it, there is just one counter,and the sum of the values return by the two methords invoked in two threads should be 100. But the result is each of the thread returns 100.
How does the database treat the variable defined in the package specification on the earh?And shouldn't I see it as static one ?
Who can tell me truth?3ks very much
(PS: I am Chinese, please forgive me poor engilsh)

Hi,
Each database session gets it's own copy of plsql package variables, they're not shared between sessions.
Cheers
Greg

Similar Messages

  • Would someone tell me something about multithread and multiprocessor

    Hey, would you be so kind to tell me something about how to progrmme with using multithread in multiprocessro? and where can I find something about it? My problem is that
    Assume that you have to write a computer program that will receive as input a single array
    storing a large number of integers. The program has to compute the prefix sums of the
    number sequence.
    Given a sequence of numbers x1, x2, ..., xn, the prefix sums are the partial sums:
    s1 = x1
    s2 = x1 + x2
    sn = x1 + x2 + ... + xn
    �You have to be prepared to write a program for program should be able to use a variable, user-specified, number of processors. For
    example, the user should be able to run the program using any number of processors P
    between 1 and 16. The number of processors P can either be selected using a command
    line argument or the program can prompt the user.
    �Your program should be able to sum a variable, user-specified, number of integers. The
    integers in the input sequence should be randomly generated inside your program. (That
    is, the user will input n, and the program will then randomly generate n numbers.)
    �Your program should print out (either to the standard output or to a file) in ascending
    order the prefix sums computed: s1, s2, �, sn.
    Can someone give me some help? I have no idea about how to do it?
    thanks a lot of

    I think perhaps you are asking about how to create threads in Java? I'm not sure, but I'll give you some background anyway. Basically all that you need to know is documented in the class java.lang.Thread. If you want a class to run on a separate thread then you can do one of two things:
    (a) define a class that extends Thread.
    (b) define a class that implements Runnable.
    I prefer the latter, but it's up to you. So, for example, if I have some computationally expensive algorithm to execute I would define a class like this:
    public class ImExpensive implements Runnable {
    ����public void run() {
    ��������<insert code here>
    ����}
    Then when you want to run the algorithm you do this:
    ����ImExpensive o = new ImExpensive();
    ����new Thread(o).start();
    The second line in this case constructs a thread that the object 'o' can run on (the start() method causes the run() method in the ImExpensive class to execute).
    Now, as for running on multi-processors, I have never done this so I am not too sure. But all that you have to do is figure out a way of associating the thread that was created with a particular processor.
    Also, be careful when using threads. Everything will be OK if your computations are mutually exclusive (ie: they aren't interdependent). If they aren't then you might run into what is sometimes called "the racehorse problem". This is a phenomenon that occurs because you can't guarantee which threads are going to finish first or indeed the order of interleaved operations. It's difficult to describe but this tutorial may help you out.
    http://java.sun.com/docs/books/tutorial/essential/threads/
    Hope that helps. :)
    Ben

  • Signed Applet--please tell me something about the basics of it

    Hi guys .
    I am in the process of developing a GUI using an applet.The GUI involves reading a file given as input and parsing it for punctuaion errors.
    This applet has to write to a file called "errors.txt" to report about errors.I came to know from a friend that applets do not have access permissions to write files to disk .This feature can be achieved using Signed Applets .If there is anyone who can tell me about the basics of Signed Applets then please help me as to how I can make changes in my program and elsewhere so that my program is able to do that.
    My program is as follows(if youm need it):
    import java.io.*;
    import java.awt.*;
    import java.applet.*;
    public class textcopy extends Applet
    public void init()
    Choice ch=new Choice();
    ch.addItem("Click Next to continue.");
    ch.addItem("Framework Properties");
    Label l1=new Label(" ");
    Label nm=new Label("Please specify the errors that you want to be checked for in the file:");
    Label a1=new Label("Write the pathname here:");
    ta=new TextArea(1,20);
    B=new Button("OK");
    Checkbox b1=new Checkbox("Punctuation errors");
    Checkbox b2=new Checkbox("Finding whether a key string is misspelt");
    Label l2=new Label("Please select the key string from one of these:");
    add(a1);
    add(ta);
    add(B);
    add(l1);
    add(nm);
    add(b1);
    add(b2);
    add(l2);
    add(ch);
    TextArea ta;
    Button B;String str="";
    public boolean action(Event e,Object obj)
    if(e.target instanceof Button)
    repaint();
    return true;
    return false;
    public void paint(Graphics g)
    String s=ta.getText();
    try{
    FileReader fin=new FileReader(s);
    PrintWriter fout=new PrintWriter(new BufferedWriter(new FileWriter("c:\\avichal\\java\\errors.txt")));
    parse(fin,fout);
    fin.close();
    fout.close();
    catch(IOException e)
    Label avi=new Label("arsehole!!!");
    add(avi);
    //g.drawString("SOme Error",500,300);
    //e.printStackTrace();
    public static void parse(FileReader fin,PrintWriter fout)throws IOException
    String str="Punctuation Errors:\n"; /*Heading*/
    fout.println(str);
    fout.println("========================================================");
    int i=0,j=0,k=0,l=0;
    j=fin.read();
    do{
    do{
    i=j;
    j=fin.read();
    }while((!((char)i=='('&&(char)j=='R'))&&(j!=-1));
    if(j==-1)break;
    j=fin.read();
    j=fin.read();
    j=fin.read();
    j=fin.read();
    j=fin.read();
    j=fin.read();
    j=fin.read();
    char refnum[]=new char[5];
    l=0;
    while((char)j!=')')
    j=fin.read();
    if((char)j!=')')
    refnum[l++]=(char)j;
    fout.write("REF. NUM: ");
    for(int a=0;a<l;a++)fout.write(refnum[a]);fout.write(": ");
    j=fin.read();
    l=0;
    do{
    i=j;
    j=fin.read();
    if((char)i=='\n')
    k++;
    //'k' gives the line no. and finally the no. of lines and neglects the lines before first occurence of "Ref Num
    if(((char)i==',')&&((char)j!=' '))
    l++;
    String st=l+". error at line number "+ (k+1) + ": There should be "+
    "a space after comma(,) \n";
    fout.println(st);
    if(((char)i=='.')&&((char)j!=' '))
    l++;
    String st=l+". error at line number "+ (k+1) + ": There should be "+
    "a space after period(.) \n";
    fout.println(st);
    if(((char)i=='.')&&((char)j=='.'))
    l++;
    String st=l+". error at line number "+ (k+1) + ": There should not be "+
    "two periods(.) together \n";
    fout.println(st);
    if(((char)i==' ')&&((char)j=='.'))
    l++;
    String st=l+". error at line number "+ (k+1) + ": There should not be "+
    "a space before a period(.) \n ";
    fout.println(st);
    }while((!((char)i=='-' && (char)j=='T')) && j!=-1);
    fout.println(" ");
    /*if(l==0)
    fout.println("No errors!!!!");*/
    if(j==-1)break;
    }while(j!=-1);

    You need to understand many concepts before you start work on .
    Here is some useful links for you
    1. http://mindprod.com/jgloss/signedapplets.html
    2. http://java.sun.com/products/plugin/reference/codesamples/index.html examples of 1.4 plugin
    3. http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/contents.html
    4. http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/faq/basics.html
    5. http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/rsa_signing.html

  • Could someone tell me alittle about the AbstractDocument please

    Hi, hope someone can help,
    I am making a small internet chat program, and had it working great using JTextArea, but I wanted to style the text, and so switched to JTextPane, and using the AbstractDocument.
    Here these two code chunks are setting up my editable input text area, for typing, and a view area, for viewing.
            StyledDocument styledDoc = viewArea.getStyledDocument();
            if (styledDoc instanceof AbstractDocument) {
                doc = (AbstractDocument)styledDoc;
                //doc.setDocumentFilter(new DocumentSizeFilter(MAX_CHARACTERS));
                doc.setDocumentFilter(new DocumentFilter());
            } else {
                System.err.println("Text pane's document isn't an AbstractDocument!");
                System.exit(-1);
            StyledDocument styledDoc2 = typeArea.getStyledDocument();
            if (styledDoc2 instanceof AbstractDocument) {
                doc2 = (AbstractDocument)styledDoc2;
                //doc.setDocumentFilter(new DocumentSizeFilter(MAX_CHARACTERS));
                doc2.setDocumentFilter(new DocumentFilter());
            } else {
                System.err.println("Text pane's document isn't an AbstractDocument!");
                System.exit(-1);
            }I have only got Bold working in the input box at the minute, I have it implemented as a JButton, when pressed does this:
         if(!hasViewAreaFocus)                    
              new StyledEditorKit.BoldAction().actionPerformed(null);     Where that boolean lets me know if the selected text is in the viewArea, so I don't style already 'sent' text.
    I am currently sending text to this other area as so
         try{doc.insertString(doc.getLength(), typeArea.getText() ,new SimpleAttributeSet());}
         catch (BadLocationException ble) {System.out.println("ble");}Forgetting the network thing for the minute, as you can see, I'm using SimpleAttributeSet() to get the text into the viewArea, so the style disappears when it arrives in the new document in the JTextPane.
    The question is basically, how do I get the styles to go with the text to the viewArea ? I don't understand how when I toggle 'Bold' on, where java is remembering that the text that I selected should be bold ? Is it storing all the text in some area of memory in a markup style way ? If so, can I pass this markup text to the other document so it knows what to style?
    The problem is I don't understand how java is remember what to style in the first place, and therefore how to pass it on. Maybe it's stored in AttributeSet?
    Thanks in advance for any light you can shed on this for me,
    Cheers

    ok,
    At this little tutorial here:
    http://www.developer.com/tech/article.php/610011
    It says
    "The Document interface is the content model for Swing text components. Every Swing text component has an instance of Document associated with it. The Document contains both the content for its component as well as any style information for the rendering of the content. All content is stored in the Document's Element array. Style information is stored in each Element as an AttributeSet. We'll get into AttributeSets in the next article, when we discuss styled text components. "
    Mainly concentrating on :
    All content is stored in the Document's Element array. Style information is stored in each Element as an AttributeSet.
    This would indicate that each time a new attribute is applied to something that it is stored as a separate String in an array, along with the attribute relating to it, would it ?
    I've looked here:
    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JTextPane.html#getParagraphAttributes()
    And here :
    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/text/Document.html
    But still cannot figure out a way to do this, I presume I must get at the Document 'array', and if I had this everything would be fine.
    Should I run through every single charactor in the 'editable' JTextPane, check its attribute and add it my my own special made class?, and pass this class to 'non-editable / viewable-only' JTextPane ?
    Any opinions would be very helpful.

  • I have 2 game centers on 1 Apple ID and it willl only access 1 of them may someone tell me how to access the other one

    I have 2 game centers on 1 Apple ID and it will only access 1 of them may someone tell me how to access the other one

    You don't have to use the same ID for iCloud as you do for purchasing.  You can just set up iCloud using your other ID. 
    If your have already have another account, you have to go to Settings>iCloud, tap Delete Account, choose Keep on My iDevice when prompted, set up your new account with the other ID, turn on your iCloud data syncing and when prompted, choose Merge to upload your data to the new account.

  • Hi, i have a macbook air and i've been having problems with the camera when i'm using skype. i know im no the 1st one and i'd like to know when apple or someone 'll do something about this.

    hi, i have a macbook air and i've been having problems with the camera when i'm using skype. i know im no the 1st one and i'd like to know when apple or someone 'll do something about this.

    Try reinstalling Combo Update.
    http://support.apple.com/kb/DL1676
    Best.

  • HT4623 I cannot install my ipod to my computer. Says something about the device driver. I did not get it new either and so have no info about it. And I have never used one before and have no friends who have either. Can someone help me?

    I cannot install my ipod to my computer. Says something about the device driver. I did not get it new either and so have no info about it. And I have never used one before and have no friends who have either. Can someone help me?

    See
    iOS: Device not recognized in iTunes for Windows
    - I would start with
    Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP
    or              
    Removing and reinstalling iTunes and other software components for Windows Vista, Windows 7, or Windows 8
    However, after your remove the Apple software components also remove the iCloud Control Panel via Windows Programs and Features app in the Window Control Panel. Then reinstall all the Apple software components
    - New cable and different USB port
    - Run this and see if the results help with determine the cause
    iTunes for Windows: Device Sync Tests
    Also see:
    iPod not recognised by windows iTunes
    Troubleshooting issues with iTunes for Windows updates
    - Try on another computer to help determine if computer or iPod problem

  • Tell me something about bending of iPhone 6Plus

    Tell me something about bending of iPhone 6Plus ?

    What's to tell?  If you put enough pressure/force on any smartphone, it will bend or break.  There isn't a smartphone in the world that won't suffer damage if enough pressure/force is used, and the iPhone 6 Plus is sturdier than the average, based upon Consumer Reports tests.
    Put it in a protective case to help minimize the risk.

  • Pls tell me something about Bank configuration

    Hi,
    Please tell me something about Bank configuration
    Thanks

    Hi,
    Please refer the following for Bank Configuration steps:
    Bank configuration:
    To set up Electronic Bank Statements (EBS)
    1. Create House Bank and Account ID (FI12)
    2. Setup EDI Partner Profile for FINSTA Message Type (WE20)
    3. Configure Global Settings for EBS (IMG)
    - Create Account Symbols
    - Assign Accounts to Account Symbols
    - Create Keys for Posting Rules
    - Define Posting Rules
    - Create Transaction Types
    - Assign External Transaction Types to Posting Rules
    - Assign Bank Accounts to Transaction Types
    4. Define Search String for EBS(Optional)
    - Search String Definition
    - Search String Use
    5. Define Program and Variant Selection
    Additional information is also available in the SAP Library under:
    Financial Accounting > Bank Accounting (FI-BL) > Electronic Bank Statement >
    Electronic Account Statement Customizing.
    Bank Reconcilliation Statement
    The following are the steps for BRS:
    Create Bank Master Data - This can be created through T.Code FI01 or you can also create the house bank through IMG/FA/Bank accounting/Bank account
    2. Define House Bank
    3. Set up Bank selection payment programe- IMG/FA/ARAP/BT/AUTOIP/PM/Bank selection for payment prg.
    a. setup all co codes for payment transaction - Customer and vendors
    b.setup paying co codes for payment transactions
    c.setup payment method per country
    d.setup payment method per co code for payment transaction
    e.setup bank determination for payment transaction
    Please go for Cheque mangement using T code FCHI (IMG/FA/ARAP/BT/OP/AutoOp/PaymentMedia/CheckManagement) and for void reasons FCHV. You can create Bank Reconcilliation statement by TC FF67 (SAP/AC/Treasury/CashManagement/Incomings/ManualBankStatement) . Don't forget to keep the opening Balance as zero. Use FBEA for post process.
    All the steps together will lead to (FF67) Bank reconciliation statement.
    Thanks,
    Prithwiraj.

  • TS1702 Sometimes an app goes mute, and it is not something about the volume, it just doesn´t have any sound any more. What should I do?

    Sometimes an app goes mute, and it is not something about the volume, it just doesn´t have any sound any more. What should I do?

    If you lose sounds for keyboard clicks, games or other apps, email notifications and other notifications, system sounds may have been muted.
    System sounds can be muted and controlled two different ways. The screen lock rotation can be controlled in the same manner as well.
    Settings>General>Use Side Switch to: Mute System sounds. If this option is selected, the switch on the side of the iPad above the volume rocker will mute system sounds.
    If you choose Lock Screen Rotation, then the switch locks the screen. If the screen is locked, you will see a lock icon in the upper right corner next to the battery indicator gauge.
    If you have the side switch set to lock screen rotation then the system sound control is in the task bar. Double tap the home button and in the task bar at the bottom, swipe all the way to the right. The speaker icon is all the way to the left. Tap on it and system sounds will return.
    If you have the side switch set to mute system sounds, then the screen lock rotation can be accessed via the task bar in the same manner as described above.
    This support article from Apple explains how the side switch works.
    http://support.apple.com/kb/HT4085

  • I am unable to play a downloaded HD movie from iTunes. SD movies play OK. An error popped up saying something about the display not suitable for HD movies but now all I get is a blank window. I have tried changing the display resolution to no avail.

    I have sownloaded an HD movie from iTunes store and when I attempted to play it on my Windows 7 PC a error message popped up saying something about the display not being compatible for HD movies. I have tried changing the display resolution several times but it didn't help. Now it just comes up with a blank screen when I attempt to play it. SD movies work fine. I have the latest version of iTunes installed.
    Can anyone help me resolve this problem?

    Apparently the display is required to be HDCP compatible to view HD movies in iTunes. My display isn't so this is my problem. I contacted Apple support and they have agreed to credit me for the HD movie and I have now downloaded the SD version.

  • Is apple going to come out with a iso that lets ppl who have the iphone 3g to put up backgrounds its bs that i cant do it when ever i see something about the iphones even befor the 4g that all ways had backgrounds so what the **** is with that

    is apple going to come out with a iso that lets ppl who have the iphone 3g to put up backgrounds its bs that i cant do it when ever i see something about the iphones even befor the 4g that all ways had backgrounds so what the **** is with that

    iPhone 3G has received its last iOS update. If wallpapers behind the homescreen icons is such an important feature for you, you'll need a newer model iPhone.

  • The audio is played through the tv, but the picture plays the first still shot of the moment it is connected then says a message saying "we're sorry" then something about the network provider.

    The audio is played through the tv, but the picture plays the first still shot of the moment it is connected then says a message saying "we're sorry" then something about the network provider.

    Welcome to the Apple Community.
    Please provide a little more detail, such as what you are trying to do when this occurs and exactly what the message says.

  • HT1923 wen i try to install itunes  it say i have ti uninstall the old one so i try to uninstall it an it say something about the path

    wen i try to install itunes  it say i have ti uninstall the old one so i try to uninstall it an it say something about the path

    Download the Windows Installer CleanUp utility from the following page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    To install the utility, doubleclick the msicuu2.exe file you downloaded.
    Now run the utility ("Start > All Programs > Windows Install Clean Up"). In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

  • I can't get the leapfrog connect to open.  It says something about the Testgen fonts.  Please help.

    I need help with the leapfrog connect application.  It won't open and it keeps saying something about the font Testgen.  Please help me if you can.

    Considering that the "Most recent updates" link on the Leapfrog Connect homepage is dated November 2009, I wouldn't hold out too much hope that your software is compatible with Lion, released in July 2011.

Maybe you are looking for

  • Best Way to Sync Lists Across Multiple Site Collections?

    A quick query I'm hoping someone might be able to help me with... Within our university intranet I am assigning each department a team site within its own Site Collection. So that departments can associate Document Library files with a set list of ac

  • Struts support for netbeans

    Hi Can some one please guide me through the steps for adding struts support to Netbeans 4.1. If you can give me a link to a tutorial which explains it. Thanks

  • Abap user for SLD Destination

    Hello! I have small question. I'm adding system to SLD and on the system where SLD is located i have to create Destination (for RFC in abab system). In this Destination i need to set user from abap system. But which roles this user should have? I use

  • Pager tag library

    The Pager Tag Library is the easy and flexible way to implement paging of large data in JavaServer Pages (JSP). and we can display something like 1 2 3 4...... How can we display A B C D E..... instead of 1 2 3 4 .....

  • Version says 2.2 but wont update to newer software

    I am using my daughters old I Pod touch.  I want to load my apps on it, but I get a message that says that I need newer software to do so.  when I run a check version I am told that I am up to date with version 2.2.  Can I update the software to a ne