Nested FOR cursor and now results

Hi Guys,
I have a simple nexted FOR cursor but the second cursor does not retrieve
anything at all. The first cursor retrieves values from a-z in low caps letters.
If I replace in cursor 2 the clause
SUBSTR(key#,1,1) = SUBSTR(key_rec1.key#,1,1);
with
SUBSTR(key#,1,1) = 'a'
It works fine, if I leave it without my manuall fix it does not retrieve
any rows. Anyone an idea? I use Oracle 11g.
DECLARE
CURSOR c1 IS
SELECT DISTINCT(SUBSTR(key#,1,1)) AS key# FROM mytable;
key_rec1 c1%rowtype;
CURSOR c2 IS
SELECT key#,
FROM mytable
WHERE
*SUBSTR(key#,1,1) = SUBSTR(key_rec1.key#,1,1); --key_rec1.key#;*
key_rec2 c2%rowtype;
BEGIN
FOR key_rec1 in c1
LOOP
FOR key_rec2 in c2
LOOP
INSERT INTO mytable2
key#
*          SELECT key#*
*          FROM mybookingtab bsch*
*          where bsch.key# = key_rec2.key#*
END LOOP; -- c2
*END LOOP; --c1*
END;
*/*

One should think you'd have learned how to use tags withing 400+ posts...
not tested:{code}declare
CURSOR c1 IS
SELECT DISTINCT (SUBSTR (key#
                       ,  1
                       ,  1
                  AS key#
  FROM mytable;
-- key_rec1 c1%ROWTYPE; -- needing this should have triggered some thinking...
CURSOR c2 (p_key_rec1 c1%ROWTYPE)IS -- declare a parameter
SELECT key#,
FROM mytable WHERE SUBSTR(key#,1,1) = SUBSTR(p_key_rec1.key#,1,1);  --key_rec1.key#;
--key_rec2 c2%ROWTYPE;
BEGIN
  FOR key_rec1 IN c1 LOOP
    FOR key_rec2 IN c2(key_rec1) LOOP -- pass the outer loops current row
      INSERT INTO mytable2 (key#)* (*
* SELECT key#*
* FROM mybookingtab bsch*
* where bsch.key# = key_rec2.key#*
END LOOP; -- c2
END LOOP; --c1
END;
/{code}
bye
TPD                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Did up date for 10.7.4 to 10.7.5 and update for Aperture and now  Aperture doesn't open.  How do I fix?

    Did up date for 10.7.4 to 10.7.5 and update for Aperture and now  Aperture doesn't open.  How do I fix?

    I heard dump the app and reinstall?  How do I go about that?

  • TS1506 I just updated my IOS to 7.1 and now I can't open Microsoft attachments - I used to always do it. Help - I use my iPad for work and now can't see any attachments.

    I just updated my IOS to 7.1 and now I can't open Microsoft attachments - I used to always do it. Help - I use my iPad for work and now can't see any attachments. I've tried opening straight into other apps and just get error messages, and I the mail preview there is just a grey screen telling me the file name and size. It worked fine until I did the IOS upgrade

    Troubleshooting apps purchased from the App Store
    http://support.apple.com/kb/TS1702
    Delete the app and redownload.
    Downloading Past Purchases from the iTunes Store, App Store and iBooks Store
    http://support.apple.com/kb/ht2519
     Cheers, Tom 

  • I have an iPad 1 and after I got the latest update for keynote and Now  it crashes every time I try to open it

    I have an iPad 1 and after I got the latest update for keynote and Now  it crashes every time I try to open it

    Do you have iOS 5.1.1 on your original iPad? If not update the iOS.
    You might also try quitting the app and then reset the pad.
    Go to the Home screen and double click the Home button. That will reveal the row of recently used apps at the bottom of the screen. Tap and hold on the app in question until it wiggles and displays a minus sign. Tap the minus sign to actually quit the app. Then tap anywhere on the screen above that bottom row to return the screen to normal. Then reset your device. Press and hold the Home and Sleep buttons simultaneously ignoring the red slider should one appear until the Apple logo appears. Let go of the buttons and let the device restart. See if that fixes your problem.
    Still no joy? Delete the Keynote app, reset the iPad and then reinstall Keynote. You will not have to pay for downloading it again.

  • I have been playing 7 Little Words game for months and now when I try to open it...I get "plug-in" message that says dwnld the latest Adobe Flash...I downloaded it 8 times - still can't open 7 Little Words...HELP!

    I have been playing 7 Little Words game for months and now when I try to log in it gives a "plug-in" code and tells me to download an updated Adobe Flash Player...I have download it 8 times and still now access to this little game....HELP!

    https://discussions.apple.com/docs/DOC-3591

  • I just downloaded the latest version of itunes for Windows and now itunes crashes every time i launch it

    I just downloaded the latest version of iTunes for Windows and now iTunes crashes everytime I launch it.  I have tried re-downloading and selecting Repair with no luck.  Any suggestions?
    thanks

    For general advice see Troubleshooting issues with iTunes for Windows updates.
    The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down page in case one of them applies.
    Your library should be unaffected by these steps but there is backup and recovery advice elsewhere in the user tip.
    If you've already tried a complete uninstall and reinstall try opening iTunes in safe mode (hold down CTRL+SHIFT as you start iTunes) then going to Edit > Preferences > Store and turning off Show iTunes in the Cloud purchases. You may find iTunes will now start normally.
    tt2

  • I make Rest for iPad, and now every time i open it , i chose the country and the network  and tells me he works the activation and then tell me the iPad could not be activated, try again what can i do

    i make Rest for iPad, and now every time i open it , i chose the country and the network  and tells me he works the activation and then tell me the iPad could not be activated, try again what can i do

    Those are the instructions for your computer's iTunes (i.e. using the Store menu at the top of your computer's iTunes and selecting 'View My Account' on it). If you are doing it on your iPad then are you following the instructions for iOS devices :
    To unhide your purchases
    Depending on the content type, open the App Store, iBooks, or iTunes Store on your device.
    Scroll to the bottom of the main page.
    If you're not already signed in, tap Sign In.
    Tap your Apple ID name, then tap View Account.
    Scroll down on the Account pane, and tap Hidden Purchases.
    Locate the item you would like to unhide then tap the Unhide button.

  • Use of FOR Cursor and BULK COLLECT INTO

    Dear all,
    in which case we prefer to use FOR cursor and cursor with BULK COLLECT INTO? The following contains two block that query identically where one is using FOR cursor, the other is using BULK COLLECT INTO . Which one that performs better given in the existing task? How do we measure performance between these two?
    I'm using sample HR schema:
    declare
    l_start number;
    BEGIN
    l_start:= DBMS_UTILITY.get_time;
    dbms_lock.sleep(1);
    FOR employee IN (SELECT e.last_name, j.job_title FROM employees e,jobs j
    where e.job_id=j.job_id and  e.job_id LIKE '%CLERK%' AND e.manager_id > 120 ORDER BY e.last_name)
    LOOP
      DBMS_OUTPUT.PUT_LINE ('Name = ' || employee.last_name || ', Job = ' || employee.job_title);
    END LOOP;
    DBMS_OUTPUT.put_line('total time: ' || to_char(DBMS_UTILITY.get_time - l_start) || ' hsecs');
    END;
    declare
    l_start number;
    type rec_type is table of varchar2(20);
    name_rec rec_type;
    job_rec rec_type;
    begin
    l_start:= DBMS_UTILITY.get_time;
    dbms_lock.sleep(1);
    SELECT e.last_name, j.job_title bulk collect into name_rec,job_rec FROM employees e,jobs j
    where e.job_id=j.job_id and  e.job_id LIKE '%CLERK%' AND e.manager_id > 120 ORDER BY e.last_name;
    for j in name_rec.first..name_rec.last loop
      DBMS_OUTPUT.PUT_LINE ('Name = ' || name_rec(j) || ', Job = ' || job_rec(j));
    END LOOP;
    DBMS_OUTPUT.put_line('total time: ' || to_char(DBMS_UTILITY.get_time - l_start) || ' hsecs');
    end;
    /In this code, I put timestamp in each block, but they are useless since they both run virtually instantaneous...
    Best regards,
    Val

    If you want to get 100% benifit of bulk collect then it must be implemented as below
    declare
         Cursor cur_emp
         is
         SELECT     e.last_name, j.job_title
         FROM     employees e,jobs j
         where     e.job_id=j.job_id
                   and  e.job_id LIKE '%CLERK%'
                   AND e.manager_id > 120
         ORDER BY e.last_name;
         l_start number;
         type rec_type is table of varchar2(20);
         name_rec rec_type;
         job_rec rec_type;
    begin
         l_start:= DBMS_UTILITY.get_time;
         dbms_lock.sleep(1);
         /*SELECT e.last_name, j.job_title bulk collect into name_rec,job_rec FROM employees e,jobs j
         where e.job_id=j.job_id and  e.job_id LIKE '%CLERK%' AND e.manager_id > 120 ORDER BY e.last_name;
         OPEN cur_emp;
         LOOP
              FETCH cur_emp BULK COLLECT INTO name_rec LIMIT 100;
              EXIT WHEN name_rec.COUNT=0;
              FOR j in 1..name_rec.COUNT
              LOOP
                   DBMS_OUTPUT.PUT_LINE ('Name = ' || name_rec(j) || ', Job = ' || job_rec(j));          
              END LOOP;
              EXIT WHEN cur_emp%NOTFOUND;
         END LOOP;
            CLOSE cur_emp;
         DBMS_OUTPUT.put_line('total time: ' || to_char(DBMS_UTILITY.get_time - l_start) || ' hsecs');
    end;
    /

  • My dad and I shared an iTunes account for years and now I'm getting my own, how can I keep my music and apps?

    My dad and I shared an iTunes account for years and now I'm getting my own, how can I keep my music and apps? I'm worried that I won't have any ability to access my apps and music. We have our itunes separated on different computers, so I have all of my stuff separated from his, but I don't know how to put them in my new account.

    Well... there really isn't any fully legal way to do this.
    The simplest solution is to continue sharing the same iTunes purchasing acct, but create different ones for iCloud (assuming that's why you needed to do the split).
    Slightly less kosher: Burn AUDIO CD's, of the music then copy them back to your new account.
    BE sure to do this from original acount, To keep the music info, you'll  copy over the CDDB file (in prefs somewhere) - since this maintains the data of CDs that you've had in library.... (it isn't carried over onto a user created CD.)
    There's also

  • Safari will no longer open.  I was using firefox until I could find a fix for safari.  I made the mistake of changing my default search to firebox later for convenience and now I can't open my system preference or many safari or apple linked files.

    Safari will no longer open. It just goes back to my desktop.  When I right click on the safari icon in my dashboard it says it is open.  I was using firefox until I could find a fix for safari.  I made the mistake of changing my default search to firebox later for convenience and now I can't open my system preference or many safari or apple linked files. Some of my emails from trusted sites won't open and does the same thing. 
    I upgraded my original system from 10.4.11 to I believe 10.6. something about a year or so ago.  I thought about re installing my safari app but when I go to open anything connected to safari my screen goes back to the desktop.  I cant open any files that I have on my desktop that I set up through safari, like my banking program. Prior to changing system preference to safari default I was able to open those files and now I can't get into change it back.  Can you guide me through this?
    Thanks,
    Betty

    Try running the 10.6.8 combo update.
    10.6.8 Combo Updater
    System Preferences or Safari Preferences?
    Do a backup.
    Quit the application.
    Go to Finder and select your user/home folder. Select Library. Then go to Preferences/com.apple.Safari.plist. Move the .plist to your desktop.
    Restart the computer, open the application and test. If it works okay, delete the plist from the desktop.
    If the application is the same, return the .plist to where you got it from, overwriting the newer one.

  • I accepted a recent update for iTunes and now my version of Spin Doctor can't communicate with it any more. I don't think I can upgrade the Spin Doctor without buying a new program.  Is there a way to undo the last iTunes update?

    I accepted a recent update for iTunes and now my version of Spin Doctor can't communicate with iTunes, specifically, I can't get music files to go over to iTunes.  Spin Doctor gives me a message indicating that iTunes isn't working properly.
    I am using iTunes 9.1.1(12) and Spin Doctor 3.1.1.304t.  I have investigated upgrading the Spin Doctor but I think too much time has passed and the version available are too far advanced. 
    Any ideas?  Can I undo the iTunes upgrade?  Is there a website that I can go to to get the upgrade for my Spin Doctor?
    Thanks.
    Mary

    If your iMac is an Intel CPU model, you can upgrade the OS to OS X 10.6 Snow Leopard.
    Then use software update to update 10.6 Snow Leopard to OS X 10,6.8.
    Then you can run the latest iTunes to sync your iPad running iOS 6
    You can purchase OS X 10.6 Snow Leopard by calling Apple at 1-800-MYAPPLE. Ask for retail software sales and purchase a copy of 10.6 for $19.99 plus shipping.

  • I clicked update for facebook And now my iPod touch 4th gen won't let me download the Facebook app I've turned it on and off like 5 times and it still won't work can you please help me

    I clicked update for facebook And now my iPod touch 4th gen won't let me download the Facebook app I've turned it on and off like 5 times and it still won't work can you please help me

    Seems to be an Apple or FB app problem. Nothing you can do but wait for it to be fixed.

  • I got a new email, changed my email for itunes and now it won't let me

    I got a new email, changed my email for itunes and now it won't let me even listen to my songs I purchased under my old email! I even got to where apple knows I changed it and they deleted my old email information. What am i supposed to do?? Please help, thanks

    Contact iTMS
    http://www.apple.com/support/itunes/musicstore/email/

  • I have a 4 yr. old iMac. I recently got a trojan on it that sent out emails to my address book. I got Norton Internet Security for Mac, and now my Mac is running slow, with way too many spinning beach balls of death. Was it a mistake to install Norton?

    I have a 4 yr. old iMac. I recently got a trojan on it that sent out emails to my address book. I got Norton Internet Security for Mac, and now my Mac is running slow, with way too many spinning beach balls of death. Was it a mistake to install Norton?

    yankeecat wrote:
    I have a 4 yr. old iMac. I recently got a trojan on it that sent out emails to my address book.
    There is no such Trojan or other malware known today that will do that using OS X nor has there ever been one. The most probable explanation is that somebody hacked into your e-mail account on the server, so you should change that password to something stronger right away. If it had come from your Mac then there would almost certainly be copies of those messages in your Sent Mail mailbox.

  • HT1338 I'm running MacOS 10.7.5 with all updates and did an update last night for aperture and now aperture doesn't open.  What's Zup?

    I'm running MacOS 10.7.5 with all updates and did an update last night for aperture and now aperture doesn't open.  What's Zup?  Help!

    Also when I do the system update it's not giving me an update for the latest Snow Leopard. I never knew that was available until I started looking around this site and it seems that since I have the internal dual core I should be able to update to mountian lion...is this correct? Will someone please help me and walk me through this. I love my mac I want to have it running like it should be.

Maybe you are looking for

  • Difference between vector obj.clear() and Vector obj = null

    What is the difference between clearing the Vector object with .clear() method and assigning null value to Vector object? As per memory point of view, is it advisable to first clear vector and then assaign it to null for garbage collection or it does

  • Change of Ship to address for a shopping cart

    Hi, could any body inform me that how to change the ship to address for a company code in SRM. We are using SRM 4.0 and classic system. Thnaks, Pijush

  • Hot spot?

    What is the best way to create an anchor link from the "smoothies", "food" and "coffee" links in the navigation to different spots on this page?  The page is a whole image so not sure how to do it.  Hotspot (which I don't know how to do)? Thanks much

  • Where is the database panel in Dreamweaver CC?  Was this feature removed?

    Where is the database panel in Dreamweaver CC?  Was this feature removed? Mike

  • Metadata from Media Expression 2

    Hi, I am considering switching from Media Expression to Aperture. How do I transfer all of the metadata that I have produced in media expression to my imported folders in Aperture. Of particular importance are the colored labels and star ratings. The