DELETE FROM Subquery Question

When having to delete form a subquery (based on two unique identifiers) I concantenate the two columns to make them unique to an entry. Are there issues w/ this method and can any suggest something different (if any).
delete from ACCT_TEMP a where upper(a.id_name) || a.system_id in (
select upper(a.id_name) || a.system_id from ACCT_TEMP a, ACCT b
where upper(trim(both ' ' from a.id_name)) = upper(trim(both ' ' from b.account_name)) and a.system_id = b.system_id)

Topher34 wrote:
I had this problem before. Because, say I have an ID ABC123 on System 12345. And, the ABC123 also existed on system 98765. That is the reason I concant.
But, when I did the delete from table where (col1, col2) in (select blahblahblahblah) it would delete the entire table. I played w/ it forever and forever!You need to be careful when using uncorrelated subqueries like the ones used with the IN operator. If you're accidentally referring to columns from the outer query, they will get used without warning which can lead to such side effects, since you effectively say e.g. "from table_1 where (col1, col2) in (select col1, col2 from table_2)", but in table_2 there is no "col1" or "col2", see the following small example:
SQL> create table test_1 as
  2  select 1 as col1, 2 as col2
  3  from dual;
Table created.
SQL> create table test_2 as
  2  select 3 as col3, 4 as col4
  3  from dual;
Table created.
SQL> desc test_1
Name                                      Null?    Type
COL1                                               NUMBER
COL2                                               NUMBER
SQL> desc test_2
Name                                      Null?    Type
COL3                                               NUMBER
COL4                                               NUMBER
SQL> delete from test_1
  2  where (col1, col2) in (
  3    select col1, col2
  4    from test_2
  5  );
1 row deleted.
SQL> rollback;Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/

Similar Messages

  • My locked posts are not getting deleted from my questions

    Hi,
    Can someone remove the posts that have been reported as abused from id.Thanks a ton in advance.

    I see that you have quite a number of unlocked and yet open threads. You need to go and close those threads manually. Don't you think you are obliged to get back to the people who spent time on your issues to go back and update them of the progress and close those threads?
    These are only some of the examples:
    Database growth
    HTTP sessions struck
    Issue with trusted system
    List of all spool tables
    Issue in ESS
    Issues uploading a file
    pk

  • Delete from recents question

    what is a "recent" contact? 

    If you open the phone app, click on Recents, those are the calls you have recently made or received.

  • HT201317 dear, i have a question please.  if i want to keep a folder of pictures in my icloud account; then delete this folder off my phone would it be deleted from icloud account too?? cause im running out of memory on my iphone

    dear, i have a question please.  if i want to keep a folder of pictures in my icloud account; then delete this folder off my phone would it be deleted from icloud account too?? cause im running out of memory on my iphone
    thanks

    You can't use icloud to store photos.  There's a service called photo stream which is used to sync photos from one device to another, but this can't be used to store photos permanently.
    Always sync photos from a device to your computer,  Then you can delete them from the device.
    Read this...  import photos to your computer...
    http://support.apple.com/kb/HT4083

  • Maybe this question has been found already, but I have yet to find the answer. How can I restore my bookmarks after it has been deleted from my 'bookmarkbackups' folder?

    So it has been a couple months now since I last cleaned up my bookmarks toolbar. And I could remember a couple of bookmarks tabs I wish I did not delete. I found some articles saying I could try restoring previous versions of my bookmarks from the dates of recent system restore points. But the earliest date I found was of only last week's. I've checked everywhere in my Firefox profile for anything that I could restore to date back into that time, but they too only tracked back as early as last week. I believe the automatic backups Firefox had made during that time has now long been deleted from the system in order to make room for my most current ones. How am I going to be able to retrieve those bookmarks when their aren't any backups available now to restore from?

    If you do not have backups of your bookmarks, either in the bookmarkbackups folder or saved elsewhere, then you can't restore your bookmarks.
    For future prevention: http://kb.mozillazine.org/Backing_up_and_restoring_bookmarks_-_Firefox

  • Very important question need immediate answer please very serious, is there any way possible i can get recent text messages from the last 2 days and print them off after they have been deleted from my phone?

    is there anyway i can retrieve recent text messages from the last 2 days and have them printed off after they have been deleted from my phone?  this is seriously important i need this for an attourney!

    click here:
    Re: Can I request to get the content of old text messages

  • 8900 IMAP questions - Deleting from Outlook 2007

    Just got a new BB 8900. I have set up my personal IMAP email account on both my BB and my MS Outlook 2007.  When I delete from Outlook, messages linger on the BBerry. I do have the email settings on my phone so that it is supposed to delete on the mailbox and handheld.
    What am I missing here? Can it take awhile before deleting on the desktop and then having it be deleted on my handheld?  More than 15 minutes?

    Sorry. I meant to put in "BES"  
    Here's a good article describing the differences between BES and BIS
    http://crackberry.com/blackberry-101-lecture-2-bes-and-bis-whats-difference
    If you have Yahoo mail, supposedly 2-way synchronization is supposed to work
    http://www.blackberry.com/btsc/KB13954
    Even though it says it's supposed to work 2 ways, I've seen people on the boards that only says it goes one-way. Since I've had a BlackBerry it only does a one-way sync to me. Take a look at these links:
    http://supportforums.blackberry.com/rim/board/message?message.uid=124553
    http://www.blackberry.com/btsc/KB05133
    If someone has been helpful please consider giving them kudos by clicking the star to the left of their post.
    Remember to resolve your thread by clicking Accepted Solution.

  • I have a iphone 5, purchased dec 2013. Had no problems with downloads and syncing until yesterday. I updated to the latest 7.1.1 and now my purchased ringtones have bern deleted from ....Try providing more room for peoples questions ...

    I have a iphone 5, purchased dec 2013. Had no problems with downloads and syncing until yesterday. I updated to the latest 7.1.1 and now my purchased ringtones have bern deleted from my library and my phone, Where are they ????
    I have gone to download again and told i can purchase them again
    But there is no option to download all ready purchased items..
    Can you provide an explanation and solution .

    Are you using the same Apple id as used to originally purchase them
    and are you using iTunes on a PC/Mac

  • Error while deleting from BIA index

    HI EXPERTS GETTING BELOW ERROR PLZ GIVE CLARITY ON THIS:
         1.A communication error occured, with the TREX TcpIp     
         2.Error while deleting from BIA index; reconstruction required     
    THANKS &REGARDS,
    rAMESH,

    Dear Ramesh,
    Please check the connection with BIA. Please ask the Basis team to check the BW to BIA connection if they maintain it.
    YOu can go to rsddbiamon2 and check BIA connection availibility for more details.
    If that is right please try redoing the step at which you faced error and it should help.
    Please close the question if you have got the answer or solved it.
    Regards,
    Den

  • ITunes store says app is 'downloaded'. It's been accidentally deleted from my mac, so iTunes can't find it. How do I redownload it?

    Due to changing backup disks, some apps were deleted from my mac. iTunes says it can't find them, but when I look for them on the App Store, the button says 'downloaded', and there's nowhere to click to re-download them. Where do I go from here?

    Hey NeilJones,
    Thanks for the question. You’ll want to delete the app from your computer (even though technically it cannot be found). Once deleted from iTunes, you can return to your purchase history and re-download it:
    How to delete content you've downloaded from the iTunes Store, App Store, iBooks Store, or Mac App Store
    http://support.apple.com/kb/HT5772
    Mac or PC
    Open iTunes.
    From the Library pop-up menu, choose Apps.
    Click the app you want to delete.
    Press Delete on your keyboard.
    Download past purchases
    http://support.apple.com/kb/ht2519
    Thanks,
    Matt M.

  • After updating my iphone 5 of ios 7, I delete or trash my emails rorm my inbox and they pop back up in my inbox.  How do I fix this?  They are deleted from the main server but show up in my email on my phone and will not stay deleted.

    I recently updated my iphone 5 to IOS 7 and since doing this, i cannot get my email messages to stay deleted when I trash them.  They have been deleted from the main mail server but show up on my phone.  When I trash them, they disappear for a few seconds and then re-appear in the inbox. I tried deleted my mail account from my phone and re-adding it, but this worked for about 12 hours and now its doing it again. I also have shut my phone off and rebooted it but this did not work.  How do I fix this?

    Have you tried restarting or resetting your iPhone?
    Restart: Press On/Off button until the Slide to Power Off slider appears, select Slide to Power Off and, after It shuts down, press the On/Off button until the Apple logo appears.
    Reset: Press the Home and On/Off buttons at the same time and hold them until the Apple logo appears (about 10 seconds).
    Also consider deleting and reinstalling the Mail Account in question.

  • There are songs on my icloud that I deleted from my itunes, but still show up on icloud. I want to delete them from icloud, but can't since they don't appear in my itunes!

    I have a large library on icloud- 26203 songs is the count when I'm playing over my apple TV, but my itunes only shows 25989 songs. There are songs on icloud that no longer are in my itunes library, or show up in itunes as being on icloud. I want to delete these songs but can't figure out how. I have reset my itunes match on both my computer and my apple tv to no avail.

    No. It's on and I update it daily.
    When I talk about removing songs from my shuffle play, I'm referring to listening over apple TV. My cloud limit is nearly maxed out, so I am constantly removing/adding songs. That's why I was surprised when I went to delete a song I no longer wanted in the mix and was surprised to find it already deleted from my itunes, but still present in the cloud. I've signed in and out of itunes/and match on apple tv as well, but that didn't remove the tunes in question!

  • Photos deleted from iPhoto, but still in Library folder

    iPhoto 9.5.1
    Strange behavior in iPhoto : let's say I imported 100 photos. Then, in iPhoto, deleted 80, keeping 20. Emptied trash in iPhoto. Then emptied Trash in Finder.
    Let's say the "_DSC1234.JPG" photo was among deleted files. When searching "_DSC1234.JPG" in Spotlight, I find it in the "Master" folder of the "iPhoto Library" folder (Photothèque in French).
    I've got a lot of photos deleted, but kept in Library, Not good for privacy, not good for hard drive space.
    For exemple, I find 514 ".NEF" photos in the iPhoto searchbox. But when searching in the iPhoto LIbrary folder with Spotlight for files with ".NEF" in their names, I find 1048 ! No duplicates, no previews or "faces" (hey are in JPEG), but photos I deleted, before emptying iPhoto and Finder trash !!
    Rebuilding Library didn't help.
    I'm using a user account not allowed to administrate the computer. Maybe a link ?
    The question was already asked, but never answered :
    Growing iPhoto Library, deleted photos still in folders
    Deleted Photos:  Why are they still in my iphoto library folder?
    Photos deleted from within iPhoto are still in Library folder
    Thanks for your help !

    Strange behavior again, with the original library : If I select NO event and use the menu Information, I've got 14.634 photos. If I select all events, I've got 15.760 photos. How can I have more photos in all events than in my Library ??????
    Check, if you have hidden photos.
    File > New Smart Album,  with a rule: Photo is hidden
    In my iPhoto Library the "Hidden" flag accounts for the difference in the Photos count between selecting all events and no events.
    Make sure, "View > Hidden Photos" is enabled in the View menu, so you can recognize hidden photos by the X.

  • All Values Deleted from Target System when transporting new values added

    Hi,
    Wasn't really sure where to put this question.
    I created a maintenance view between two Z tables. A main key table and a text table.
    I added the new values to the maintenance view and transported successfully.
    I then had a request to create 3 more values.
    I added these three and transported these to the target QA system.
    However when the transport completed, all entries bar one had been deleted from the Z table but the Z text table had all existing entries plus the three new ones.
    I've tried manually creating a transport and adding all 10 entries but this has the same problems.
    If I SCC1 the entry from one dev client to another it works fine.
    Has anyone come across this problem befor and know how to resolve it?
    Many Thanks
    David

    Yes, I managed to sort it.
    This is what I did:
    I created a new blank transport.
    For the task created under the transport I then opened the task object list.
    I then added two entries in this list. i.e. one for each table that was in the view.
    My entries where:
    Entry 1:
    Program ID: R3TR
    Object Type: TABU
    Object Name: ZNR_REASON
    Then click on the key icon and add:
    Table Name: ZNR_REASON
    Table Keys: 200* (NOTE 200 is our development client). The '*' is needed to that ALL entries are included in the transport.
    Entry 2:
    Program ID: R3TR
    Object Type: TABU
    Object Name: ZNR_REASONT
    Then click on the key icon and add:
    Table Name: ZNR_REASONT
    Table Keys: 200* (As above 200 is our development client). Again the '*' is needed to that ALL entries are included in the transport.
    I hope this helps.
    Regards
    David

  • Deleting from iTunes Library and Computer

    I have alot of music in my library that I would also like to remove from my computer. I know that when you select a song and press the delete key that i prompt pops up asking you if you want to delete the song from your computer as well as your library...for some reason i think i may have clicked the "don't show me this again tab" and now when i delete a song from my library it only gets deleted from the library. If I want to delete it from my computer I have to go and search for the file in the folder where it is stored...this is a royal pain in the butt because sometimes music files aren't labeled conveniently. So my question is : Is there some way that I can turn that prompt back on so that I can delete songs from my computer and iTunes library alot easier and faster? Any insight would be greatly appreciated.
    HP Tablet PC   Windows XP  

    Do you keep your songs in the iTunes Music folder or do you use another folder of your own making? iTunes will delete songs from the library and move them to Trash only if they are in the iTunes Music folder. (iTunes will ask if you want to trash the file if this is the case, it doesn't trash it automatically). If your songs are kept outside of this folder then deleting only removes the reference to the song from the library and you have to go to the folder they are located in to trash the file itself.
    Message was edited by: Zevoneer

Maybe you are looking for