Problem with Synchronized block

Hi,
For me synchronized key word is not working (?) :-(
Here is the example :
I have three classes
package sample.test;
public class TestThreadMain {
     public static void main(String[] args) {
          Thread t1 = new ThreadOne();
          Thread t3 = new ThreadOne();
          t1.start();
          t3.start();
public class TestThread {
     int k = 0;
     public synchronized void method1(){
          System.out.println("Entered into method1 >>>>>>>>>");
          for (int i=0; i<1000; i++){
               for (int j=0; j<100000; j++){
                    k = j * 12345;
               System.out.println("method1 i value is "+i);
package sample.test;
public class ThreadOne extends Thread {
     TestThread t1 = new TestThread();
     public void run() {
               t1.method1();
If I run "TestThreadMain" class output is
Entered into method1 >>>>>>>>>
method1 i value is 0
method1 i value is 1
method1 i value is 2
method1 i value is 3
method1 i value is 4
method1 i value is 5
method1 i value is 6
method1 i value is 7
method1 i value is 8
method1 i value is 9
method1 i value is 10
method1 i value is 11
method1 i value is 12
method1 i value is 13
method1 i value is 14
method1 i value is 15
method1 i value is 16
method1 i value is 17
method1 i value is 18
method1 i value is 19
method1 i value is 20
method1 i value is 21
method1 i value is 22
method1 i value is 23
method1 i value is 24
method1 i value is 25
method1 i value is 26
method1 i value is 27
method1 i value is 28
method1 i value is 29
method1 i value is 30
method1 i value is 31
method1 i value is 32
method1 i value is 33
method1 i value is 34
method1 i value is 35
method1 i value is 36
method1 i value is 37
method1 i value is 38
method1 i value is 39
method1 i value is 40
method1 i value is 41
method1 i value is 42
method1 i value is 43
method1 i value is 44
method1 i value is 45
method1 i value is 46
method1 i value is 47
method1 i value is 48
method1 i value is 49
method1 i value is 50
method1 i value is 51
method1 i value is 52
method1 i value is 53
method1 i value is 54
method1 i value is 55
method1 i value is 56
method1 i value is 57
method1 i value is 58
method1 i value is 59
method1 i value is 60
method1 i value is 61
method1 i value is 62
method1 i value is 63
method1 i value is 64
method1 i value is 65
method1 i value is 66
method1 i value is 67
method1 i value is 68
method1 i value is 69
method1 i value is 70
method1 i value is 71
method1 i value is 72
method1 i value is 73
method1 i value is 74
method1 i value is 75
method1 i value is 76
method1 i value is 77
method1 i value is 78
method1 i value is 79
method1 i value is 80
method1 i value is 81
method1 i value is 82
method1 i value is 83
method1 i value is 84
method1 i value is 85
method1 i value is 86
method1 i value is 87
method1 i value is 88
method1 i value is 89
method1 i value is 90
method1 i value is 91
method1 i value is 92
method1 i value is 93
method1 i value is 94
method1 i value is 95
method1 i value is 96
method1 i value is 97
method1 i value is 98
method1 i value is 99
method1 i value is 100
method1 i value is 101
method1 i value is 102
method1 i value is 103
method1 i value is 104
method1 i value is 105
method1 i value is 106
method1 i value is 107
method1 i value is 108
method1 i value is 109
method1 i value is 110
method1 i value is 111
method1 i value is 112
method1 i value is 113
method1 i value is 114
method1 i value is 115
method1 i value is 116
method1 i value is 117
method1 i value is 118
method1 i value is 119
method1 i value is 120
method1 i value is 121
method1 i value is 122
method1 i value is 123
method1 i value is 124
method1 i value is 125
method1 i value is 126
method1 i value is 127
method1 i value is 128
method1 i value is 129
method1 i value is 130
method1 i value is 131
method1 i value is 132
method1 i value is 133
method1 i value is 134
method1 i value is 135
method1 i value is 136
method1 i value is 137
method1 i value is 138
method1 i value is 139
method1 i value is 140
method1 i value is 141
method1 i value is 142
method1 i value is 143
method1 i value is 144
method1 i value is 145
method1 i value is 146
method1 i value is 147
method1 i value is 148
method1 i value is 149
method1 i value is 150
method1 i value is 151
method1 i value is 152
method1 i value is 153
method1 i value is 154
method1 i value is 155
method1 i value is 156
method1 i value is 157
method1 i value is 158
method1 i value is 159
method1 i value is 160
method1 i value is 161
method1 i value is 162
method1 i value is 163
method1 i value is 164
method1 i value is 165
method1 i value is 166
method1 i value is 167
method1 i value is 168
method1 i value is 169
method1 i value is 170
method1 i value is 171
method1 i value is 172
method1 i value is 173
method1 i value is 174
method1 i value is 175
method1 i value is 176
method1 i value is 177
method1 i value is 178
method1 i value is 179
method1 i value is 180
method1 i value is 181
method1 i value is 182
method1 i value is 183
method1 i value is 184
method1 i value is 185
method1 i value is 186
method1 i value is 187
method1 i value is 188
method1 i value is 189
method1 i value is 190
method1 i value is 191
method1 i value is 192
method1 i value is 193
method1 i value is 194
method1 i value is 195
method1 i value is 196
method1 i value is 197
method1 i value is 198
method1 i value is 199
method1 i value is 200
method1 i value is 201
method1 i value is 202
Entered into method1 >>>>>>>>>
method1 i value is 0
method1 i value is 1
method1 i value is 2
method1 i value is 3
method1 i value is 4
method1 i value is 5
method1 i value is 6
method1 i value is 7
method1 i value is 8
method1 i value is 9
method1 i value is 10
method1 i value is 11
method1 i value is 12
method1 i value is 13
method1 i value is 14
method1 i value is 15
method1 i value is 16
method1 i value is 17
method1 i value is 18
method1 i value is 19
method1 i value is 20
method1 i value is 21
method1 i value is 22
method1 i value is 23
method1 i value is 24
method1 i value is 25
method1 i value is 26
method1 i value is 27
method1 i value is 28
method1 i value is 29
method1 i value is 30
method1 i value is 31
method1 i value is 32 .....
My question is as i delcared the method " method1()" as synchronized, after completion of printing the first 1000 only second thread has to enter in to this method.
Am I wrong any where ?
Thanks,
Sudhakar

1) When you post code, please use[code] and
[/code] tags as described in
[url=http://forum.java.sun.com/help.jspa?sec=formattin
g]Formatting tips on the message entrypage. It makes it much easier to read.
Sure. I will do it from next time.
2) Was it really necessary to post 200 lines or so of
output? Couldn't you have posted just a few to give
us the general idea?I think it will give better understanding. So ...
3) It's not clear to me what your question is. Are
you saying you expected something like
T1
T2
T1
T2
etc.
If so, then you're mistaken. The whole point of
multithreading is that you don't know or care which
thread executes which instructions when. There's no
"execute a statement then switch threads" rule. That
would occur ridiculous amounts of overhead.As per my understanding, If one thread enters into synchronized method, the other threads needs to wait until the completion of first one.
So, first it needs to print
method1 i value is 1
method1 i value is 2
method1 i value is 1000
then second thread should start printing.
Is my understanding wrong or ... ?

Similar Messages

  • Problems with synchronizing iCal with iCloud accounts on my Mac Pro

    I have problems with synchronizing iCal with iCloud calender accounts on my Mac Pro runnning OS 10.6.8
    (error message "HTTP/1.1 403 Forbidden" på handlingen CalDAVAccountRefreshQueueableOperation.)
    It works fine on iOS devices.

    Due to lacking hardware driver compatibility i our graphic production environment we can't upgrade to Lion.
    Does that mean that it after the closing of MobileMe is impossible to synchronize calenders to Mac's running OS 10.6.8 ??

  • Problems with synchronizing

    Hello,
    I am fairly new to using Dreamweaver CS5, but suddenly am having problems with synchronizing my projects. It was working fine until a few days ago, but I'll just list the steps of what happens now to try to make it clear.
    I refresh and click the sync button.
    I choose 'selected local files only' and 'put newer files to remote,' then 'preview.
    Then, Dreamweaver says it's connecting to my server, retreiving folder information, then complete.
    After that, it says that it's putting file temp2342.htm on my server.
    Then it says no synchronization is necessary...even though I do have newer files which haven't been put on my server.
    I've tried 'putting' individual files on the server, but it says 'file activity incomplete. 1 or more files not completed.'
    Up until a few days ago, the synchronization would work just fine and put the newer files on my server. I'm not sure what kind of setting I might have changed between now and then, but any ideas on how to fix this problem would be much appreciated!

    Call our customer care, they'll sort this out. You can find the details from "contact us" link on top of this page.

  • Problems with file block settings

    We manage file block settings via group policy.  I have run into problems with the file block settings not working as advertised.
    I've run into a couple of issues:
    First, in Excel 2010 I would like to open Web Page and XML files in protected view rather than blocking entirely.  Our "Set Default File Block Behavior" in the GPO is set to "Blocked Files are not opened."  According to the
    documentation, the settings for individual file types should be able to override this behavior but this is not the case in my testing.  If I set "Web pages and Excel 2003 XML spreadsheets" to "Allow editing and Open in Protected View"
    the files are still blocked and the Trust Center list the file as Do not open, not the GPO setting of open in protected view.  I have verified via GPresults that the GPO applied successfully, rebooted the PC, etc.  The "Set Default File Block
    Behavior" is NOT overridden by individual file type settings.
    According to the "plan file block settings" technet article:
    The “Set default file block behavior” setting specifies how blocked files open (for example: does not open, opens in protected view, or opens in protected view but can be edited). If you enable this setting, the default file block behavior you specify applies
    to any file format that users block in the Trust Center UI. It also applies to a specific file format only if you both enable its file format setting (for more information about individual file format settings, see the tables in this article) and select the
    Open/Save blocked, use open policy option. Otherwise, if you configure an individual file format setting, it overrides the
    Set default file block behavior setting configuration for that file type.
    Second, even if I do change the set default file block behavior to open in protected view, I still cannot open XML spreadsheets.  The trust center says that the file format is set to open in protected view but when I attempt to open a file it behaves
    as if the setting was still set to block entirely.
    The only thing that works is setting it to "do not block" which is not where I'd like to go - I would for security reasons like these types of files to open in protected view but there doesn't seem to be any way to do this contrary to the Technet
    documentation.

    Hi,
    I had opened a case at Microsoft in 2012 about the «Open/Save Block, use open policy» parameter about HTM/HMTL files... Here is the answer I got from the support.
    Hope it will help
    Thank you for contacting Microsoft regarding your recent Office 2010 Hotfix request (SR 112022071246968) in reference to File Block settings on web pages. We have conducted a thorough investigation into this matter
    and while we recognize the impact the issue is having on your business, we cannot accept this Hotfix request because it is acting as designed.<u5:p></u5:p>
    Office will block any files that are explicitly set in the File Block UI by an Administrator when there is no built in validator.  The Office File Validation scans and validates certain kinds of files and will
    only display those applicable files in Protected View.  We could provide a safe experience in Protected View for HTM, but it wouldn't be a useful experience. Linked content of the web page is not available (images, stylesheets, javascript, etc), so the
    user would effectively see plain text. This is not the experience we want in Protected View, and it would encourage users to leave Protected View, putting their machine at risk. So HTM/HTML files are blocked.<u5:p></u5:p>
    <u5:p></u5:p>

  • Problem with DECODE block in WHERE clause

    Hi,
    I'm facing problem with DECODE statement. I just simulated my problem in the simple way as follows. If I execute this following query, I should get "hello", but I'm not getting anything (ZERO rows returned).
    SELECT 'hello' FROM DUAL
    WHERE 'sample1' in (DECODE(1, 1, '''sample1'', ''sample2'', ''sample3''',
    2, '''sample4'', ''sample5'', ''sample6'''
    I think some problem is there in my WHERE clause.
    But When I'm exeucting the following query as a seperate query, then I'm getting the value of DECODE block properly, but didn;t understnad why its not returning the same way when I'm putting the same DECODE statement in WHERE clause.
    SELECT DECODE(1, 1, '''sample1'', ''sample2'', ''sample3''',
    2, '''sample4'', ''sample5'', ''sample6'''
    FROM DUAL;
    Please help me to get out of this problem. Thank you so much in advance.
    Thanks,
    Ramji.

    The value returned by SELECT DECODE(1, 1, '''sample1'', ''sample2'', ''sample3''',2, '''sample4'', ''sample5'', ''sample6''') FROM DUAL;
    'sample1', 'sample2', 'sample3' is a single string. Consider it x.
    SELECT 'hello' FROM DUAL WHERE 'sample1' in ( DECODE(1, 1, '''sample1'', ''sample2'', ''sample3''',2, '''sample4'', ''sample5'', ''sample6'''));
    is like SELECT 'hello' FROM DUAL WHERE 'sample1' in ('x');
    or
    SELECT 'hello' FROM DUAL WHERE 'sample1' in ('''sample1'', ''sample2'', ''sample3''') and not
    SELECT 'hello' FROM DUAL WHERE 'sample1' in ('sample1', 'sample2', 'sample3');
    For this same reason SELECT 'hello' FROM DUAL WHERE 'sample1' in (select '''sample1'', ''sample2'', ''sample3''' from dual);
    also does'nt work.
    Please use INSTR to find whether 'sample1' exists in the string 'sample1', 'sample2', 'sample3'.

  • Problem with synchronous calls

    Hello XI friends,
    I'm having a problem with a synchronous message sending through a RFC.
    This is the scenario I'm having. I call the RFC, the message is delivered to XI, and XI delivers de message to the Legacy System, this system responds to XI and XI delivers the message back to the SAP system.
    But after doing some successful tests with the RFC, for somehow the whole message is delivered to the Legacy System, and XI shows that has delivered back the message to the SAP system, but the RFC stays Idle, as if it was waiting for a response, after a while, the RFC gets a Dump with the following error:
    "call to messaging system failed:
    In order to get it working again, I'm doing a Restart of the J2EE instance, but after another series of tests with the same RFC, the problem comes up again.
    Does anyone knows what could be happening? 
    Thank you,
    Felipe
    Message was edited by: Felipe Andres Contreras

    Hi Felipe,
    Are you using a standard SAP RFC or a customized RFC interface???
    I would also suggest to check the System dumps in the SAP system where the RFC is hanging.
    Thanks
    Prasad

  • Problem with ParForEach Block

    Hi, Gurus.
    i have a strange problem with blocks (parallel processing).
    My Wf contain of:
    1. Dialog step, where user choose actors.
    2. parallel block for actors, the first step in the block - no-dialog step for getting instance of actor object.
    When I test this WF, and choose more than 5 actors, the parallel processing not working,
    all non-dialog task for each actor are in READY state, and not processing.
    But when I delete  dialog step and set actors manually, its working fine, and when I chosee less than 5 actors, it's working.
    I check mapping, everything ok. Thank you for advise.
    Regards,
    Oleg.

    Thank you for your reply.
    I have no rule in this Workflow, the processor of first dialog step is wf_initiator.
    This step base on standard method - WF_TASK.DISPATCH.
    Initiator chooses actor's (in my case it's org. units) and the table seem's like:
    O 01000000
    O 02000000
    O 03000000
    Then, I try to make paralllel steps for each line of this table. In WF Log, I see that parallel blocks is created,
    but the first step in this blocks (it's no-dialog step to generate instance of orgunit object), is in ready state (the line (object key) is transfer to this step, and the instance is not generated). As I said, when I delete the step with agent chose, and fill this table manually, its working fine...

  • Performance problem with synchronized singleton

    I'm using the singleton pattern to cache incoming JMS Message data from a 3rd party. I'm seeing terrible performance though, and I think it's because I've misunderstood something.
    My singleton class stores incoming JMS messages in a HashMap, so that successive messages can be checked to see if they are a new piece of data, or an update to an earlier one.
    I followed the traditional examples of a private constructor and a public getInstance method, and applied the double-checked locking to the latter. However, a colleague then suggested that all my other methods in the same class should also be synchronized - is this the case or am I creating an unnecessary performance bottleneck? Or have I unwittingly created that bottleneck elsewhere?
    package com.mycode;
    import java.util.HashMap;
    import java.util.Iterator;
    public class DataCache {
        private volatile static DataCache uniqueInstance;
        private HashMap<String, DataCacheElement> dataCache;
        private DataCache() {
            if (dataCache == null) {
                dataCache = new HashMap<String, DataCacheElement>();
        public static DataCache getInstance() {
             if (uniqueInstance == null) {
                synchronized  (DataCache.class) {
                    if (uniqueInstance == null) {
                        uniqueInstance = new DataCache();
            return uniqueInstance;
        public synchronized void put(String uniqueID, DataCacheElement dataCacheElement) {
            dataCache.put(uniqueID, dataCacheElement);
        public synchronized DataCacheElement get(String uniqueID) {
            DataCacheElement dataCacheElement = (DataCacheElement) dataCache.get(uniqueID);
            return dataCacheElement;
        public synchronized void remove(String uniqueID) {
            dataCache.remove(uniqueID);
        public synchronized int getCacheSize() {
         return dataCache.keySet().size();
         * Flushes all objects from the cache that are older than the
         * expiry time.
         * @param expiryTime (long milliseconds)
        public synchronized void flush(long expiryTime) {
            String uniqueID;
            long currentDate = System.currentTimeMillis();
            long compareDate = currentDate - (expiryTime);
            Iterator<String> iterator = dataCache.keySet().iterator();
            while( iterator.hasNext() ){
                // Get element by unique key
                uniqueID = (String) iterator.next();
                DataCacheElement dataCacheElement = (DataCacheElement) get(uniqueID);
                // get time from element
                long lastUpdatedDate = dataCacheElement.getUpdatedDate();
                // if time is greater than 1 day, remove element from cache
                if (lastUpdatedDate <  compareDate) {
                    remove(uniqueID);
        public synchronized void empty() {
            dataCache.clear();
    }

    m0thr4 wrote:
    SunFred wrote:
    m0thr4 wrote:
    I [...] applied the double-checked locking
    Which is broken. http://www.ibm.com/developerworks/java/library/j-dcl.html
    from the link:
    The theory behind double-checked locking is perfect. Unfortunately, reality is entirely different. The problem with double-checked locking is that there is no guarantee it will work on single or multi-processor machines.
    The issue of the failure of double-checked locking is not due to implementation bugs in JVMs but to the current Java platform memory model. The memory model allows what is known as "out-of-order writes" and is a prime reason why this idiom fails[b].
    I had a read of that article and have a couple of questions about it:
    1. The article was written way back in May 2002 - is the issue they describe relevant to Java 6's memory model? DCL will work starting with 1.4 or 1.5, if you make the variable you're testing volatile. However, there's no reason to do it.
    Lazy instantiation is almost never appropriate, and for those rare times when it is, use a nested class to hold your instance reference. (There are examples if you search for them.) I'd be willing to be lazy instantiation is no appropriate in your case, so you don't need to muck with syncing or DCL or any of that nonsense.

  • Synchronization problems in synchronized block

    I am facing problems in the synchronizaed block similar to this :
    sychronized(object)
    //object manipulations
    object notifyAll();
    I am facing a problem when 2 requests are fired at the same time and none of them enter this block. Since this is re\lated to the server, server is getting freezed and none of the further requests are entertained.
    Please help me in this.
    Thanks is advance.

    Thanks for all your replies.
    Let me a bit more clearer about my problem.
    I have
    1. 2 classes which have synchronized blocks on one object of a different class
    2. This object which is synchronized is shared among both the classes.
    When an individual request comes, it is processes without any issues. Sometimes, when multiple requests come simultaneously when lock on the object is free, none of requests get the lock on the object. I tried putting a breakpoint where lock is provided, none of the threads are entering the synchronized block.
    So at this point server is not able to entertain any of the further requests also.

  • Problem with synchronizing

    Hi everyone, I have a big problem with my iPod.
    It is a 120GB(with Windows Vista...), and when I plug the USB cable in the port, my iPod shows Connected, Eject before disconnecting, but iTunes is unable to read my iPod. I've tried to sync it with disk mode, and although my iPod appears, I'm not able to restore my data because the operation stops instantly at midway(along with error 1439, or something like that).
    Does anyone have a solution?
    Thanks

    has the same issue, mine i got error coe 1437 and 48.. help?

  • Problem with ForEach block in BPM

    Hi,
    I have a scenario as follows:
    Collecting Idocs and send them separately via file channel (Does not make so much sense but I want to get used using the forEach Block)
    Loop (as long as "control" != false)
    Fork
    1. branch: Wait step 1 minute and container operation assign "control" = false (if no more idoc is received, loop stops after 1 minute)
    2. branch: receive step with correlation, container operation with append to multiline message, container operation assign "control" = true
    Mapping
    multiline message to single line message (same interface)
    ForEach Block
    Send Step with single line message
    My problem:
    x idocs get collected by the BPM and my file channel posts x idocs to the directory but it is always the same idoc and not x different ones.
    Any idea on that?
    Regards.
    Oliver.

    Yes, that's the blog I used.
    I have used the same interface for Send/Receive Steps, the Multi-Line Element and the Current Line Element. I restricted the Current Line Element to the block. Any other definition would not show up in the dropdown list, anyway.
    These are my settings for the Block:
    Step Name: Block1
    Description: [Blank]
    Mode: ForEach
    MultiLine Element: Idoc_Multi
    CurrentLine: Idoc_Local
    End Condition, Exceptions and Local Correlations: [Blank]
    Here are the settings for the Send Step:
    Step Name: Send1
    Description: [Blank]
    Mode: Asynchronous
    Create New transaction: [Not marked]
    Message: Idoc
    Ack: None
    Receiver from: Send Context
    All others: [Blank]
    I don't see any error?
    Regards.
    Oliver.

  • Problem with synchronizing desktop software with Lotus Notes

    Problem: synchronizing between blackberry storm and my pc with the desktop manager. During the settings of the configuration is asked for the location of the NOTES.INI file. The configuration program finds the NOTES.INI file it's self.
    After selecting the NEXT button I get an announcement that the NOTES.INI file can't be opened and the configuration stops.
    I don't know what to do to select the right file or setting so the desktop manager can synchronize with my blackberry.
    I hope somebody can help me with this problem.
    Regards
    Erik

    Hi and welcome to the forums:
    Please read the attached regards your error:
    Thanks,
    Bifocals
    Please remember to resolve your thread.
    Put the check mark in the green box that contained your answer! Thanks   
    http://www.blackberry.com/btsc/search.do?cmd=displayKC&docType=kc&externalId=KB01534&sliceId=2&docTy...
    Click Accept as Solution for posts that have solved your issue(s)!
    Be sure to click Like! for those who have helped you.
    Install BlackBerry Protect it's a free application designed to help find your lost BlackBerry smartphone, and keep the information on it secure.

  • Problem with variant block

    Hi everibody
    I am nephiew with labview and i am trying to use "to variant" block.
    In the atteachment there is a picture of my VI.
    Where am i wrong?!
    Best regards
    Giovanni
    Attachments:
    variant.png ‏39 KB

    You are right but the problem is more complex.
    This is only a short vi.
    I am communicating with a PLC and to do that i have used a .NET library.
    The problem is that the library gives me some data from the plc in a To string variable. See the atteachment.
    Trhough the variable datatype i select the corrisponding case. In the case of boolean is not a metter. In the case of an int16 i don't know how i can do. I would like to make a different thing for all type of variables...
    is it clear?!
    in the atteachment there is the vi and two screenshot of it.
    Attachments:
    variant2.png ‏14 KB
    variant.png ‏11 KB
    Untitled 2.vi ‏33 KB

  • Problems with synchronous message in XI

    Hi
       I have the following scenario involving XI 3.0 ( SP 12 )
    XI has exposed a webservice ( WS provider ) and this webservice is being called from a web application. On receiving the webservice call, XI synchronously calls a RFC on the SAP backend and the response is mapped back as a webservice soap response to the calling web application.
    Now, I see sometimes ( not always ) - the incoming message from the web application has a status in SXMB_MONI -
    <b>Message scheduled (commit follows)</b>
    with a green flag and this message is never processed - i.e The message comes into XI from the webservice call - but beyond this - there is no call to the RFC receiver adapter ( the receiver adapter- comm channel  is ok as seen in the adapter monitoring )
    Since synchronous messaging does not involve any queues ( I hope my understanding is right ), I am not sure why this occurs and what to do to push the message forward in this synchronous messaging scenario ??
    Thank you in advance for your time .

    Hm we have a slightly different version of that problem.
    The message is wirtten into a queue, gets the green flag and the message is processed.
    But the flag as well as the status stay...
    Has anyone soem background information about how the queuing and scheduling and execution planning is done?
    I have quite an idea about queue filters and how to set-up queues. But I have no idea how the synchronous stuff fits in and what this "Message scheduled (commit follows)" exactly means.
    Cheers,
    helge

  • Problem with plsql block

    Hello All,
    I have a sql query which i am trying to put it in plsql block.It throws me an error saying i cannot have group function as my two select strings gives me more than one row. How to tackle this??
    declare
    uuid varchar;
    stat_date date;
    begin
    select 'I'||Lower(docfamily_uuid) into uuid, max(status_date) into stat_date from document_status where status_code=303 or status_code=305 group by docfamily_uuid;
    end;
    Thanks

    In addition to being mal-formed it is likely your problem stems from the fact that your query is returning more than one row. Now perhaps you are expecting only one row and your GROUP BY might be getting in the way. Try changing your GROUP BY to include the LOWER function that is in your SELECT statement. But realize that this in itself will not guarentee one row returning from the SELECT statement.
    WITH document_status AS
    SELECT 'xxx' docfamily_uuid, sysdate status_date, 303 status_code from dual
    UNION ALL
    SELECT 'XXX' docfamily_uuid, sysdate status_date, 303 status_code from dual
    SELECT 'I'||Lower(docfamily_uuid), max(status_date)
    FROM   document_status
    WHERE  status_code=303 or status_code=305
    GROUP BY docfamily_uuid;
    Ixxx     05-FEB-09
    Ixxx     05-FEB-09
    WITH document_status AS
    SELECT 'xxx' docfamily_uuid, sysdate status_date, 303 status_code from dual
    UNION ALL
    SELECT 'XXX' docfamily_uuid, sysdate status_date, 303 status_code from dual
    SELECT 'I'||Lower(docfamily_uuid), max(status_date)
    FROM   document_status
    WHERE  status_code=303 or status_code=305
    GROUP BY LOWER(docfamily_uuid);
    Ixxx     05-FEB-09Greg

Maybe you are looking for

  • How do I disable the "de-emphasise tabs" feature in the new version of Firefox?

    The new "tabs are visually de-emphasized" makes my tabs look all run together. Rather than reducing the clutter it makes it harder to distinguish what I've got open and what I don't have open. For the moment I'm using an add-on that that changes the

  • How can you escape a KeyTrap without a Mouse?

    Whenever I am on a website that has a flash or Java object in it such as YouTube or a game site, whenever the object is activated it traps the keyboard input and access to the Browser's shortcuts etc are unavailable. As an example in Ctrl + T opens a

  • Square box for character in jeditorpane

    Hi, I'm trying to display the middot character, integer value 183, in a jeditorpane, but all I'm getting is a square box. Any thoughts as to why? I believe I'm using the default encoding, ISO-8859-1. Do I need to set a different encoding, a font, or

  • Adding text to an image

    Is there a way to add text or a mark to an image directly from the browser in Aperture as easily as it can be done in Photoshop? So far, the only way I've been able to do it is by "editing" the image in Photoshop, which is just not practical. I'm edi

  • How can I view a VM heap ?

    Hi, I'm trying to write trace tool that will sample my application memory status (i.e. how many living instances exists for each class)periodically. Is anyone familiar with a way to retrieve this information ? thanks