Need PL/SQL Command for to check all rows value for child record and update

Hi All,
i want to update one field following by
one to many relationship for example
in child applet status field is value is "Closed" for all child record then parent value also should update to closed
Note: if one child record field status is "Open" don't do the update operation

You can do it in single UPDATE operation.
Here is sample & Result:
create table PA (id varchar2(3), name varchar2(12), STATUS varchar2(12));
insert into pa values('001','Cary','Open');
insert into pa values('002','TOM','Open');
create table boy (par_id varchar2(3), id varchar2(4), name varchar2(12), status varchar2(12));
insert into boy values('001','ABC1','Cary','Open');
insert into boy values('001','ABC2','Mac','Closed');
insert into boy values('001','ABC3','Ray','Closed');
insert into boy values('001','ABC4','NALLY','Open');
insert into boy values('002','ABC5','ME','Closed');
insert into boy values('002','ABC6','SHE','Closed');
UPDATE PA
SET STATUS='Closed'
WHERE NOT EXISTS
  (SELECT 1
  FROM BOY
  WHERE BOY.PAR_ID=PA.id
  GROUP BY BOY.PAR_ID,
    BOY.STATUS
  HAVING SUM(DECODE(BOY.STATUS,'Open',1,'Closed',0,0))>0
select * from pa;
001     Cary     Open
002     TOM     Closed

Similar Messages

  • I get "mail server does not recognize your Apple ID and password" when I try to share a picture via email in iPhoto.  My iCloud email works ok otherwise.  I have check all mail settings for ID and password.

    I get "mail server does not recognize your Apple ID and password" when I try to share a picture via email in iPhoto.  My iCloud email works ok otherwise.  I have checked all mail settings for ID and password.

    In the iPhoto preferences ==> accounts delete the account and re-enter it - sometimes that resolves this
    Or IMHO the best long term solution is to set Apple Mail as the iPhoto e-mail client in the iPhoto preferences and use it - it has a number of advatages and has fewer problems
    LN

  • I have files that say they are missing or offline. I have checked all my folders off of lightroom and they can not be found. I have used the ? mark settings to find and still not found. I can see the images on lightroom so they have to be in my system som

    I have files that say they are missing or offline. I have checked all my folders off of lightroom and they can not be found. I have used the ? mark settings to find and still not found. I can see the images on lightroom so they have to be in my system some how. How can I retrieve these images? Is there a re boot for lightroom? Need help ASAP!

    You have probably moved the files outside of Lightroom. The images you see in LR are previews that were made before you moved the files.
    Do a search for the files/folders using your computers operating system. (Explorer/Finder)
    Once you have found them, you can point LR to the right location.

  • Delete command is not deleting all rows

    Hi All,
    Database version 10.2.0.2
    Delete command is not deleting all rows and deleting some subset of rows which it should delete, ever time I delete and do the roll back, next time it will delete some random rows, count is different everytime with in the range but not complete in anyway. see the following -
    select count(*) from test where evt_id in (select evt_id from test1);
    COUNT(*)
    27105
    delete from test where evt_id in (select evt_id from test1);
    16045 rows deleted.
    select count(*) from test where evt_id in (select evt_id from test1);
    11060
    rollback;
    Againg the same procedure -
    select count(*) from test where evt_id in (select evt_id from test1);
    COUNT(*)
    27105
    delete from test where evt_id in (select evt_id from test1);
    14320 rows deleted.
    select count(*) from test where evt_id in (select evt_id from test1);
    COUNT(*)
    12785
    why its not deleting all the 27k rows in one shot? Is there any bug related to that?
    Thanks
    Abhinav

    Odd that what looked like identical statements produced different results, both the counts and the deletes. The most likely cause of that is your data is changing - as Fahd suggested perhaps a simultaneous load taking place.
    The delete issue is probably not due to a bug. Possible but unlikely.
    If any evt_id values are NULL they won't be deleted with the subquery - a NULL in test.evt_id will never match a NULL in test1.evt_id.
    Have you tried alternative subqueries - a correlated EXISTS subquery for instance?

  • Finance for Wire , Check request ,Fixed Assets for the Capital Expenditure

    Hi,
    We are trying integrate the Finance for Wire , Check request ,Fixed Assets for the Capital Expenditure with adobe forms.
    Where would i find more information regarding the same?
    what tables are used and what are related t-codes which can give more information?
    any documentation is appreciated.
    rgds
    vara

    Hi,
    We are trying integrate the Finance for Wire , Check request ,Fixed Assets for the Capital Expenditure with adobe forms.
    Where would i find more information regarding the same?
    what tables are used and what are related t-codes which can give more information?
    any documentation is appreciated.
    rgds
    vara

  • When I connected my sony mp3 player to iMac for first time all music deleted.  why?  and can I retrieve it?

    When I connected my sony mp3 player to mac for first time, all music deleted.  Why?  and where did it go?  Can I retrieve it?

    carol1963 wrote:
    When I connected my sony mp3 player to mac for first time, all music deleted.  Why?  and where did it go? 
    No idea.
    Can I retrieve it?
    Restore from your most current backup.

  • I need URGENT help, My company just changed all our iphones to Samsung Notes and i am now unable to get ANY messages from current iphone friends and colleagues colleagues.... This is certainly unfair and inconvenient.... Once loved apple not so much now

    I need URGENT help, My company just changed all our iphones to Samsung Notes and i am now unable to get ANY messages from current iphone friends and colleagues colleagues.... This is certainly unfair and inconvenient.... Once loved apple not so much now

    Go to: https://supportprofile.apple.com/MySupportProfile.do
    Log in if not already logged in.
    Click on "Edit Products"
    Click on the "X" to the right of the product.
    Click "Unregister".
    If that doesn't work, you're going to need to call AppleCare and have them remove your phone from the system.
    Best of luck.

  • I am having all kinds of trouble with itunes and updating my ipad. when I open up itunes, it seems to just sit there, never going to itunes store. when I connect my ipad, I check update and it starts, but then I get this message:backup can't be saved on

    I am having all kinds of trouble with itunes and updating my ipad. I open itunes up but it doesn't do anything except open to a blank screen. I try to access the itunes store but it won't go there. When I connect my ipad, and try to update it, it starts and then I get a message that says backup cannot be saved on this computer. I have tried everything suggested to no avail. This is the 2nd or 3rd time I have had problems with itunes. Sometimes I even get a message that I am not connected to the internet.
    I have uninstalled and re-installed. Any help?

    You might not have enough space left on your hardrive.

  • How to access each row value for a database item

    On my form I have a database datablock that represents a table in my database.
    5 rows are shown with a scroll bar that can be viewed to show the rest.
    The user is able to change some of the Database Item values represented in this datablock for any row shown in the datablock.
    I need to validate the correctness of the users change before allowing the database datablock to update the table in the database.
    But a database item in a datablock will represent a value for every row in the table. So how do I access each row value for a database item separately. What is the PL/SQL syntax?
    thanks,
    michelle

    In my situation it was better to use the loop instead
    of a when validate trigger because...Well it was clearly not better to use a loop that doesn't work. I don't understand what you're not clear on about the item and record validation triggers. If you have a specific validation rule for a single field (such as a date that cannot be in the future), that would go in a When-Validate-Item trigger on the date item. If the user enters a future date, your code would display an error message and raise a failure. Raising a failure prevents the item from being marked as valid. Invalid items prevent the record from being inserted/updated. Sometimes you have a validation rule that requires looking at more than one item at a time, such as two items that must either both be NULL or NOT NULL. In that case, you could not use a When-Validate-Item trigger because you can't clear or populate both at once. So then you would use a When-Validate-Record at the block level and if one field is NULL and the other isn't, you would display an error message and raise a failure. Forms is very civil in this respect; we don't throw exceptions around here, but then I digress.

  • For Grant nnnnnn, specify a value for object FUND error -Urgent

    I work in SRM area and my knowledge of Grants management is almost nil. We have a PO in SRM which has account assignment associated with a Workorder and Fund. When we look at the Grant it has all green lights and is confirmed by our FI/CO team everything is correct. But since R/3 is giving this message "For Grant nnnnnn, specify a value for object FUND" , I am sure there is something missing somewhere. Some additional information, the PO is from last fiscal year but it was changed for account assignment this fiscal year. But we checked the Fund itself is valid for some more time to come.
    Any ideas on which transaction codes to see, what to look at etc. will be appreciated.
    Thanks

    Hi Manjula,
    You have been facing this issue becuase the sequence of the fields while mapping them is not perfect, hence the 0date field is capturing some other data rather than picking the exact date value.
    Check the order of fields and match it with the file (if you are loading data from a flat file)
    Also, have a look at the weblog which talks about general mistakes in loading from file.
    /people/sergio.locatelli2/blog/2006/11/02/upload-file-in-bw-common-mistakes-and-hints-to-take-in-mind
    Cheers!
    Amit

  • Hide row values for certain column in GRR2

    Hi Experts,
    Looking for some help in report painter. I need to hide row values for certain columns in report painter. The requirement is I have 5 columns in the report, the 5 th column is the sum of col 1 to 4 and in my row i have a formula setup to sum of values for each column, what i would like to do is for column 1 thru 4 i didnt want to display the total values in row total but i wanted to dispaly value for column 5 in row total. I have been trying my best with putting formula, but couldnt succeed.
    Could somebody let me know is there an way to get this addressed.
    Thanks in advance
    Best Regards,
    gj

    How was it achieved ? Did you use sections for the columns for which rows needed to be hidden?
    I have a smiliar issue of hiding certain rows for few columns.

  • I want better solution for adjusting the Material stock values for the last

    my Customer  need to adjust( Decrease)  the closing stock values for the following materials / plant wise as on 31.03.2006 for meeting statuary compliance.
    Material1 :  RS: 4149599    QTY : 10181.03 Ltrs
    Material 2  : RS: 1318596     QTY:  2152.76   Ltrs
    As per my knowledge MM posting periods can open current month and Previous month only. For the reason I proposed the solution as follows:
    Step 1 : post FI Journal Entry on 31.03.2006
    Opening Balance G/L  Account Dr 4149599 + 1318596
    Closting Stock a/c                      Cr 4149599 + 1318596
    Step 2.
    Change the Material Price in MM through T.Code: MR21
    ( Posting will be allowed in current or previous months)
    This makes our CO reports accurate.
    Please  suggest the better solution if it is possible in MM for adjusting the Material stock values for the last financial year.
    WIth Best Regards,
    Rajesh
    <b></b>

    Hi Madhavan,
    Unfortunately this forum deals with migrations from non-Oracle
    environments to Oracle. You seem to be dealing with migrations in
    an Oracle environment mainly.
    I would recommend that you contact Oracle Applications and RDBMS
    support directly. They will have the most up to date
    information/advice on performing these actions.
    Regards
    John
    Madhavan (guest) wrote:
    : Hi John
    : Thanks for your reply.
    : Actually I am planning to upgrade the system.
    : 1. I Want to Upgrade Oracle Financials release 10.7 to the
    : latest version (11.x)
    : 2. Oracle 7 database to oracle 8 or 8i.
    : 3. Oracle is running on NT service pack 3. Do I need to upgrade
    : this?. If not what is the impact on Windows NT?
    : 4. Is the majority still running smart client 10.7 and database
    : 7?
    : 5. What is the necessary time to implement these upgrades? What
    : type of consulting I need to have?
    : 6. I have some employees working on it? Will these changes
    : affect them?
    : What type of precautions I need to take on the whole??
    : Thank You
    : Madhavan
    Oracle Technology Network
    http://technet.oracle.com
    null

  • I need a script to help me check all the AD Computers for a certain file.

    What I'm looking for is a script that I can use to check all the AD computers in my domain for a file that was created by Malware. It would be great if the script could export the results as a csv and have a column for the computer name, IP address, and
    if the file/path exists.
    I'm new to Powershell and I've been trying to script it on my own but no luck so far. I would be extremely great-full for any help, or a point in the right direction.
    I messed around with different commands:
    I'm not sure if I should be using test-path or get-childitem with recursive and wildcards.
    This is a sample of what I'm working with... I know it probably horrible but like I said I'm new.
    $date = [DateTime]::Today.AddDays(-90)
    $AllComps = get-adcomputer -filter {(Enabled -eq 'true') -and (lastlogondate -gt $date)} | select name
    $Allcomps = $AllComps[100..125]
    foreach ($ADcomputer in $AllComps)
    function check-remotefile {
        PROCESS {
                    $file = "\\$_\C$\Windows\notepad.exe"
                    if (test-path $file)
                    echo "$ADcomputer: .exe exists"

    You fail to ask a question.  What is it you do not know or understand?
    Start simple and learn how to best post code:
    $date=[DateTime]::Today.AddDays(-90)
    Get-adcomputer -filter 'Enabled -eq $true -and lastlogondate -gt $date' |
    Where{test-path "\\$($_.Name)\C$\Windows\notepad.exe"} |
    ForEach-Object{echo "$($_.Name): .exe exists"}
    Learn the basics. The pipeline is you friend.
    ¯\_(ツ)_/¯

  • XML validation: how to check ALL validation problem for XHTML

    I have a lot of documents in HTML format (not very good) that I would like to convert in XML (XHTML). I know it is not so easy and I would use this strategy in a Java program:
    1. Try to check the well-formness and validation with a XML parser (SAX or Xerces)
    2. If not valid: try to individuate ALL the problems the file has (*and not only the first one that halts the processing process*)
    3. Try to transform the HTML to a validable XHTML with some approach: regular expression or other methods
    So the questions I do to you are the following:
    1. What XML parser do you think is the best for this purposes? SAX or Xerces?
    2. How can I understand what are all the validation problems in the file and not only the first one (If I remember well XML parsers halt the parsing process at the first error...)?
    3. How can I transform the HTML to a valid XHTML? I have only to use RegEx or is there other tools to do this for XHTML and HTML problem?
    Thanks
    r
    Edited by: robertobat on Feb 21, 2009 7:09 PM

    >
    1. Neither of them. (Disregarding the fact that SAX and Xerces aren't in the same category and don't cover all the possibilities.I would say SAX default implementation in JRE and SAX parser in Xerces.
    2. I think you have "valid" and "well-formed" confused. And HTML isn't a dialect of XML so the idea of trying to use an XML parser to handle HTML isn't a good idea.I know very well what is the difference between valid and well-formed but I've used "validation" to represent all the conversion problem. But you are right. I'm convincing myself that using a XML parser as the first step is not a good idea.
    3. Well, this is the real question, isn't it? Those other two were just a waste. Don't screw about with regex, for one thing it doesn't work well for hierarchical structures and for another you won't finish in a finite time. Just use an HTML parser which can produce a DOM, like TagSoup for example. Or run them through HTMLTidy. You could also submit them to one of the internet sites which will validate XHTML for you.I've seen Tidy and its capability to convert an HTML to a XHTML and I think it is better then TagSoup because I have to implement this mechanism in a production environment and I want to use only open source projects that have a very long story and that are strong. But I'll see TagSoup as you say.
    I cannot use an Internet service to convert millions of private documents.

  • Is there a way to programmatically check the Row Selector for a row?

    Greetings,
    I have a report that has the Row Selector column. I am processing the rows that are checked by the user when they click a button, so I am already looping thru FOR ii IN 1 .. Apex_Application.g_f01.COUNT.
    I need some of the rows to always be processed in the loop, so I would like to:
    1. have certain rows checked automatically. Is that possible?
    2. using the same logic that automatically checks certain rows I would also like to insure they stay checked, or are process in the loop. (You know, I may automatically check certain rows, but the user may uncheck them.) So, even if the user doesn't check them, I would like to programmatically check them before the FOR ii IN 1 .. Apex_Application.g_f01.COUNT looping occurs.
    3. If it is possible to prevent the unchecking of a row that is automatically checked it would be awesome and would mean that requirement 2 is moot. If that's possible let me know. That would be sweet. :-)
    I hope that makes sense, and that you understand what I need to do. If not, let me know.
    Thanks in advance for your help, Tony

    Hi Shunt,
    That's a great help ! ! ! Thanks much ! ! ! :-)
    I did some additional research from what you told me, and I found out that the apex_item.checkbox is a page item and it is included in the SQL that builds a report. Your code got me on the right track. That's great. Also, it's great to know I can do what I need. My next question is 'How do I get there from here?' :-)
    I built my current report using the report builder, then used the trick to change it to a type of 'SQL Quey (updatable report)' just so I could click the setting to add the checkbox column, then I set the type back to 'SQL Query'. So, I don't have apex_item.checkbox in my SQL. I guess Apex (thru its magic) prepends it to the SQL somewhere along the way. What do I need to do now?
    Do I need to rebuild the report without using the above 'trick' and code the checkbox into my SQL myself? Or, can I just add it to the existing SQL? Or, with that cause 2 checkboxs to be on the report (mine and the one Apex generates)? That's one set of questions. :-)
    Also, whether the checkbox is checked (and disabled) is based on a value in the table the SQL is running over. Would it be possible to put a subselect, or something along those lines, in the main SQL (that has the checkbox item) that would programmatically check the checkbox?
    Sorry for my newbie questions, but I'm relatively new to Apex and PL/SQL, so there's still a lot I have to learn. All you need to do is point me in the general direction and I'll take it from there. I just want to know the right way to go about this before I start coding. :-)
    To give you and idea of what I'm doing now and want to do I have my simple SQL below:
    = = =
    select
    ecn_approval_master_id, mandatory, approval_type,
    htmldb_item.hidden(50,ecn_approval_master_id) idalias
    from
    ecn_approval_master
    where ecn_plant_master_id = :P0_PLANT
    order by mandatory DESC, approval_type
    = = =
    The 'mandatory' column contains 'Y' or 'N'. If it is 'Y' I want the checkbox to be checked and disabled. If it would help in the coding I could have the values of the mandatory column 'Y' and NULL. But, I'm not sure if it will help, because it looks like the checked rows are listed in parm 4. Then, when the htmldb_application.g.f10.count.... routine processes the selected they mandatory ones will automatically be processed. Course, you probably figured that out already.
    Thanks, Tony

Maybe you are looking for

  • Can I partition an external hard drive?

    So like check it homes I b al liek hay nah man I ned 2 partition muh herddrove so eye can enstal windoze? Can dis b dun?

  • HT204053 how do i add a second ipod device to my account?

    how do i add a second ipod device (ipod touch 4th gen) to my account?

  • Upgraded from 6.04 to 6.05. Now Itunes will not open at all

    I had 6.04 on an XP Pro PC working fine. I did the suggested upgrade to 6.05 and the install appeared to go fine, but when I click on the program I get an hour glass for a few seconds and then nothing. I have repaired and reinstalled and same thing.

  • NT CWS erroring out.

    We have installed 5.0.2 and the optional web services on a dev box. I get the following errors when trying to create a remote data source. The Server Configuration Interface for this Remote Data Source is unavailable. Check the URL configuration in t

  • Error in table maintenance

    Hi Experts      I have done a table maintenance program and assigned to a transaction.     First time it works fine. Due to some reason, i deleted the table maintenance and created new one.      When i transport this request to the testing client, it