How can i use the same cursor in a loop fro multipletimes.

I am using two cursors.One to fetch sites and the other to fetch participants under each site.I am performing some job with that participants data.Now the problem is i am using the 2nd cursor in a loop.So it fetches the data of participants falling under one state.But when it comes to the second state,as the second cursor is already open it is unable to fetch the records.Please help me .How can i use the same cursor in a loop fro multipletimes.
I am sending the code which i have written in When-Button-Pressed-Trigger...
declare
     sid number;
     pid number;
cursor csid is select distinct(site_id) from cyber_ppt;
cursor cpid is select pc_id,st_dt,ed_dt from cyber_ppt where site_id = sid;
     stdt varchar2(10);
     eddt varchar2(10);
     nom number;
     stmonth varchar2(10);
     edmonth varchar2(10);
     cjan number:=0;
     cfeb number:=0;
     cmar number:=0;
     capr number:=0;
     cmay number:=0;
     cjun number:=0;
     cjul number:=0;
     caug number:=0;
     csep number:=0;
     coct number:=0;
     cnov number:=0;
     cdec number:=0;
     i number:=1;
begin
     open csid ;
     loop
     fetch csid into sid;
          exit when csid %notfound;
          message(sid);
     open cpid;
     loop
     fetch cpid into pid,stdt,eddt ;
     exit when cpid %notfound;
     message(sid||'-'||pid);
     stmonth:=substr(stdt,4,3);
     edmonth:=substr(eddt,4,3);
     nom:= months_between(eddt,stdt);
while i <= round(nom)
     loop
     stmonth:=substr(stdt,4,3);
if stmonth='JAN' then
          cjan:=cjan+1;
elsif stmonth='FEB' then
          cfeb:=cfeb+1;
elsif stmonth='MAR' then
          cmar:=cmar+1;
elsif stmonth='APR' then
          capr:=capr+1;
elsif stmonth='MAY' then
          cmay:=cmay+1;
elsif stmonth='JUN' then
          cjun:=cjun+1;
elsif stmonth ='JUL' then
          cjul:=cjul+1;
elsif stmonth ='AUG' then
          caug:=caug+1;
elsif stmonth ='SEP' then
          csep:=csep+1;
elsif stmonth ='OCT' then
          coct:=coct+1;
elsif stmonth ='NOV' then
          cnov:=cnov+1;
elsif stmonth ='DEC' then
          cdec:=cdec+1;
end if;
     stdt:=add_months(stdt,1);
     i:=i+1;
     end loop;
     end loop;
     end loop;
     end;
     

try this /* untested */
DECLARE
sid           NUMBER;
pid           NUMBER;
CURSOR csid IS SELECT DISTINCT(site_id) FROM cyber_ppt;
CURSOR cpid(nSid NUMBER) is SELECT pc_id,st_dt,ed_dt FROM cyber_ppt WHERE site_id = nSid;
stdt        VARCHAR2(10);
eddt        VARCHAR2(10);
nom         NUMBER;
stmonth     VARCHAR2(10);
edmonth     VARCHAR2(10);
cjan         NUMBER:=0;
cfeb         NUMBER:=0;
cmar         NUMBER:=0;
capr         NUMBER:=0;
cmay         NUMBER:=0;
cjun         NUMBER:=0;
cjul         NUMBER:=0;
caug         NUMBER:=0;
csep         NUMBER:=0;
coct         NUMBER:=0;
cnov         NUMBER:=0;
cdec         NUMBER:=0;
i            NUMBER:=1;
BEGIN
FOR rec IN csid
LOOP
                  sid := rec.csid;
FOR cRec IN cpid(sid)
LOOP
                 pid := cRec.pc_id;
                 stdt := cRec.st_dt;
                 eddt := cRec.ed_dt;
stmonth:=  SUBSTR(stdt,4,3);
edmonth:= SUBSTR(eddt,4,3);
nom:= months_between(eddt,stdt);
WHILE i <= round(nom)
LOOP
          stmonth := SUBSTR(stdt,4,3);
IF stmonth='JAN'
THEN
         cjan:=cjan+1;
ELSIF stmonth='FEB' THEN
         cfeb:=cfeb+1;
ELSIF stmonth='MAR' THEN
          cmar:=cmar+1;
ELSIF stmonth='APR' THEN
          capr:=capr+1;
ELSIF stmonth='MAY' THEN
          cmay:=cmay+1;
ELSIF stmonth='JUN' THEN
          cjun:=cjun+1;
ELSIF stmonth ='JUL' THEN
          cjul:=cjul+1;
ELSIF stmonth ='AUG' THEN
          caug:=caug+1;
ELSIF stmonth ='SEP' THEN
          csep:=csep+1;
ELSIF stmonth ='OCT' THEN
          coct:=coct+1;
ELSIF stmonth ='NOV' THEN
          cnov:=cnov+1;
ELSIF stmonth ='DEC' THEN
          cdec:=cdec+1;
END IF;
         stdt:=add_months(stdt,1);
         i:=i+1;
END LOOP;
END LOOP;
END LOOP;
END;

Similar Messages

  • How can you use the same e-mail address for multiple ipads?

    I have two iPads.. an iPad and an ipad 2.  I registared my new ipad 2 and now my old ipad is will not let me log on and is telling me that my e-mail address is already in use.  how can you use the same e-mail address for multiple ipads?

    And by using the same Apple ID you can also share purchases.  If you have a different Apple ID for each iPhone then you can't share purchases.

  • How can i use the same front panel graph in more than one events in an event structure?

    i want to display the signals from my sensorDAQ in a graph.but i have more than one event in the event structure to acquire the signal and display it in the graph.the first event is to acquire the threshold signals and its displayed in the graph as a feedback.after the first event is executed, i will call the second event,where the further signals are acuired and compared with the threshold signals from the event 1.my question is how can i use the same front panel control in more than two events in the event structure?please answer me i'm stuck.
    Solved!
    Go to Solution.

    Hi,
    I have attached here an example of doing the same using shift registers and local variables. Take a look. Shift register is always a better option than local variables.
    Regards,
    Nitzz
    (Give kudos to good answers, Mark it as a solution if your problem is Solved) 
    Attachments:
    Graph and shift registers.vi ‏12 KB
    graph and local variables.vi ‏12 KB

  • How can we use the same package in our report used by some other report

    how can we use the same package in our report used by some other report

    Hi,
    You just need to assign package while saving your report.
    No extra is required providing you are aware of package to be used.

  • How can I use the same "I Tunes" on two different computers

    I’m using two different kinds of Personal Computer: One is Desktop PC And the other one is Notebook .
    In each computer there are the same songs and when I get the new ones to the Desktop I want them to be placed on the Notebook or reverse.
    Where does the I Tunes save the playlist on the hard drive ?
    I have prepared a playlist on my Notebook and want it to be seen on the Desktop but I dont want to fallow the steps File > Library > Export Playlist on the Notebook. Is there any other way to make this issue instead of the mentioned steps.
    How can I see the same Playlists and songs on two different computers ( notebook and desktop) including the updating processes.
    Operating systems of the computers:
    Desktop: XP Pro
    Notebook: Vista Bussiness

    I use SyncToy 2.0 to keep two instances of my library in sync. SyncToy's preview will show which files it is about to update giving you a chance to spot unexpected changes and during the run only the changed files will be copied saving lots of time.
    As long as I sync after making updates at one instance of the library before making any updates at the other then everything works just fine. I periodically run iTunes Folder Watch to check for any orphaned entries or new items that haven't been imported into the active library. If your machines are regularly networked together this process is fairly straightfoward. Mine are in disparate locations so I use one of the (physically) small WD My Passport host powered drives which I take between home & work, synchronising at either end. This gives me three complete copies of my library so I'm covering backup & synchronisation in the same operation.
    When connecting my iPod at either location iTunes recognises itself as the "home" library for the iPod so I'm able to use the sync with selected playlists option without getting warning messages about the iPod being synced with a different library.
    tt2

  • How can I use the same sleepimage over and over?

    Hi, this was asked a while ago for Tiger, but had no real answer. Now I hope things have changed in Leopard 10.5.4.
    I have a STATIC system on a car that should boot over and over in exactly the same way. The idea is to make a good sleepimage (/var/vm/sleepimage) and then force the computer to read it at every startup AS IF it was waking up from sleep mode all the times.
    This MUST be possible because OSX does it every time it wakes up from safesleep (sudo pmset hibernatemode 1). All I need it to find out WHERE OSX writes down that at the next wake it should use the sleepimage instead of a normal boot. Then, once I know where it write this, I simply force that flag to be active all the times.
    Please also be aware of the following notes and constraints:
    0. The boot should be as fast as possible
    1. I can't to use the regular sleep function: the system must drain zero power while shut down
    2. There are no dangers in using the same sleepimage multiple times: the disk contents do not change. The system should be absolutely identical at every boot (or "wake")
    3. The system is ALWAYS shut down by pulling the plug of the MacMini. Thereshould be no possibility for the system to "update" the sleepimage
    I hope some of you OSX experts will give me a hint concerning where this information is stored (and maybe how to override it)
    thanks a lot
    Lele
    Message was edited by: Leelx

    Hi, this was asked a while ago for Tiger, but had no real answer. Now I hope things have changed in Leopard 10.5.4.
    I have a STATIC system on a car that should boot over and over in exactly the same way. The idea is to make a good sleepimage (/var/vm/sleepimage) and then force the computer to read it at every startup AS IF it was waking up from sleep mode all the times.
    This MUST be possible because OSX does it every time it wakes up from safesleep (sudo pmset hibernatemode 1). All I need it to find out WHERE OSX writes down that at the next wake it should use the sleepimage instead of a normal boot. Then, once I know where it write this, I simply force that flag to be active all the times.
    Please also be aware of the following notes and constraints:
    0. The boot should be as fast as possible
    1. I can't to use the regular sleep function: the system must drain zero power while shut down
    2. There are no dangers in using the same sleepimage multiple times: the disk contents do not change. The system should be absolutely identical at every boot (or "wake")
    3. The system is ALWAYS shut down by pulling the plug of the MacMini. Thereshould be no possibility for the system to "update" the sleepimage
    I hope some of you OSX experts will give me a hint concerning where this information is stored (and maybe how to override it)
    thanks a lot
    Lele
    Message was edited by: Leelx

  • How can I use the same parameter to use elsewhere by Manage Variables ?

    Hello,
    I have a little problem that I need to know. I want to use the same parameter to use elsewhere.
    Example,
    I have a parameter on page 1 and I wish to use this parameter in the other page by Manage Variables.
    How can I do this ?
    Thank you.

    ..just open ManageVariables (right click on the a page and select Manage Variables)...
    then you select the parameter on the page where you want to insert your previous value (your variable)...use the dropdown list to select the variable that contains your value...and it should work
    /m

  • How can I use the same contacts for two users

    MY wife and I are using the same account. I want to give her a seperate log in account (user). All is working fine excempt for "contacts". These are at the moment empty. How can I get our contacts also in her new contact list.
    Are there any other things I should also look for, in executing this exercise

    Hi Iemke Kuijper!
    I have two articles for you that will help you achieve this goal. First, here is an article on exporting your contacts files and importing them:
    Contacts: Export and import your contacts
    http://support.apple.com/kb/PH11586
    This next article will help you get the contacts file from your user account into your wife’s user account:
    OS X Mountain Lion: Share files with others who use your computer
    http://support.apple.com/kb/PH10636
    Thanks for using the Apple Support Communities!
    Cheers,
    Braden

  • How can I use the same session for different components acroos application ?

    I am trying to include the components(chat, filesharing, whitboard) in different parts of my application. User should be able to access any of the component. We would like to have a single "ConnectSessionContainer" so that we don't see same user creating a seperate session for each component.
    Is there a better way of dealing with this other than declaring the "ConnectSessionContainer" in the main application ? Is there a way to check if we have a "ConnectSessionContainer" session already established ? Please help . Thanks.

    Thanks for the response. Let me explain what I am trying to do..
    I am trying to create components at different places(screens) of the flex application (not in the same .mxml file).
    Each time I create a component, I am using a "AdobeHSAuthenticator" and "ConnectSessionContainer" which is resulting a new participant in the room.
    For example
    screen1.mxml -
    <mx:Panel>
    <rtc:AdobeHSAuthenticator id="auth" authenticationSuccess="onAuthSuccess(event);" authenticationFailure="onAuthFailure(event);" />
    <rtc:ConnectSessionContainer id="mySession" >
            <rtc:Roster id="myRoster" width="100%" height="100%" />
            <rtc:Chat id="mychat" width="100%" height="100%" />
    </rtc:ConnectSessionContainer>
    </mx:Panel>
    screen2.mxml (in the same application) -
    <mx:Panel>
    <rtc:AdobeHSAuthenticator id="auth" authenticationSuccess="onAuthSuccess(event);" authenticationFailure="onAuthFailure(event);" />
    <rtc:ConnectSessionContainer id="mySession" >
            <rtc:SharedWhiteBoard id="wb" width="100%" height="100%" />
    </rtc:ConnectSessionContainer>
    </mx:Panel>
    Here, I open a screen1 and authenticate as UserA and when I try to open screen2 flex is considering me as another user though I am in the same application.
    1) How can I use different components which are in different flex files as a same User ?
    2) Should I place my <rtc:AdobeHSAuthenticator> and <rtc:ConnectSessionContainer> in the main application which calls the screen.mxml?
    3) What is the best way to do it ?
    Thanks for your time !

  • How can I use the same master catalog in Lightroom 5 on my PC and Mac?

    I have been using a PC with a Sinology NAS for picture storage. The master catalog has been generated from this PC. I would like to use the same catalog on my Macbook Pro. Is there a way to sync the two computers using one common catalog?

    Some users have a shared catalog on an external hard drive, which if portable can be carried around. I’ve never use network storage; but in theory it could work if all the file paths were identical on both machines.
    The alternative is to use a travel catalog. I dpo this on my Macbook Pro using a 128gb SD card. It means I can then process, edit photos and add metadata etc. When I get home, I import the travel catalog to Lightroom on the Windows PC to combine it with the master catalog.
    Here is a video tutorial which demonstrates the use of a catalog on location.
    http://tv.adobe.com/watch/the-complete-picture-with-julieanne-kost/how-to-use-lightroom-5- on-location/

  • How can I use the same domain.sites2 on two macs?

    I know iWeb is no longer supported but I still find it ok to manage my web site.
    I would like to work on the site from two macs. I thought I could just use the same Domain.sites2 on both macs but: if I move Domain.sites2 to dropbox folder, when I launch iWeb it does not know about it and creates a new empty Domain.sites2 in the Library/iWeb folder
    I do not want to have to manually make a copy of Domain.sites2 to Dropbox and then to the other mac's Library every time I switch computer.

    You may want to use :
    http://wyodor.byethost8.com/iwebsites/iWebSites.html
    Select "Choose new folder" from the File menu to select the folder on Dropbox where your domain file is.
    If that does not work, use:
    http://wyodor.byethost8.com/iwebsites/iWebDrop.zip
    (Unzip the file and drop the domain file on top of it)
    After that, you can open iWeb with your currently used domain file.

  • How can I use the same apple id on 2 iphones yet have the owner contact different?

    My husband and I both share apps, contacts, calendars, etc and use same apple id...We both own iPhone 5's. When we each set up our iphones, on setting in siri setting and mail, contacts, calendars setting we each put contact for our info... Well the problem is that if I change mine to my info it changes it to his, and same if he changes it to his name on his iphone it changes 'my info' on my iPhone's setting.... so when using siri or mail... we cant identify each phone.... So can we still use same apple id and have separate "my info" settings.....

    Short term solution, do this on both devices
    Settings > iCloud > Shut off anything you don't want shared
    Long term solution (actual solution)
    You need seperate Apple IDs for iCloud. iTunes and iCloud are not the same.
    Create a new Apple ID > https://appleid.apple.com/cgi-bin/WebObjects/MyAppleId.woa/
    On one of the devices go Settings > iCloud > Delete Account > Sign in with the new Apple ID
    This will seperate your Contacts, Calendars, Messages etc.
    You both can continue to use the same Apple ID for iTunes and share apps and music

  • How can i use the same id on two different laptops?

    When trying to use the same login on two different laptops so that i can connect my nook to either depending on which one is free, i get the error that the id is already in use on another computer?

    The issue is embedded in the way the software works.  To comply with the
    Digital Millenium Copyright Act of 2000, all software companies in this
    business keep track of where their software is installed, making
    information about the computer and ereaders part of an ID file.  So, your
    user ID is embedded in the ID file of each computer, but each computer has
    a different ID of its own that is also embedded in that file.  Adobe's
    master server (yes, there is one that you connect to even if you didn't
    know it) also has that information, and when you try to use an ID on one
    that's embedded in the file of another, Adobe's server blows the whistle,
    and as you can see, you can't do that....
    ==========

  • How can I use the same thread to display time in both JPanel & status bar

    Hi everyone!
    I'd like to ask for some assistance regarding the use of threads. I currently have an application that displays the current time, date & day on three separate JLabels on a JPanel by means of a thread class that I created and it's working fine.
    I wonder how would I be able to use the same thread in displaying the current time, date & day in the status bar of my JFrame. I'd like to be able to display the date & time in the JPanel and JFrame synchronously. I am developing my application in Netbeans 4.1 so I was able to add a status bar in just a few clicks and codes.
    I hope somebody would be able to help me on this one. A simple sample code would be greatly appreciated.
    Thanks in advance!

    As you're using Swing, using threads directly just for this kind of purpose would be silly. You might as well use javax.swing.Timer, which has done a lot of the work for you already.
    You would do it something like this...
        ActionListener timerUpdater = new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                // DateFormat would be better, but this is an example.
                String timeString = new Date().toString();
                statusBar.setText(timeString);
                someOtherLabel.setText(timeString);
        new Timer(1000, timerUpdater).start();That code will update the time once a second. If you aren't going to display seconds, you might as well increase the delay.
    The advantage of using a timer over using an explicit thread, is that multiple Swing timers will share a single thread. This way you don't blow out your thread count. :-)

  • How can i use the same communication channel to place the file in 2 differe

    Hello Guys,
    We have a requirement where I need to archive the file that i am sending to the legacy FTP server in a Idoc to file scenario.
    How can i place the file in 2 different locations. In this case place the file in the FTP server and a copy of it in the local NFS folder.

    >
    Rajeev kumar wrote:
    > Hello,
    > As per the standards we are supposed to use only one channel.
    > that is one idoc, one message in the sxmb_moni.
    Rajeev,
    You can use an ftp job and save it on XI's folder.
    Process the file into tmp directory on local file system and run operating system command to run ftp job to send the file to your file server and then copy the file to your archive folder and then delete the file from tmp.
    This should solve your problem.
    Regards,
    AV.

Maybe you are looking for

  • How do I use my iPhone 4s to set GPS co-ordinates to use at a later date?

    I'm wanting to go to an aread in the bush - enter the GPS co-ordinates in my iPhone 4s and then be able to go back to the same place at a later date. How do I go about it.  I have no idea if I even have a GPS on my iPhone 4s.

  • Using the mini DVI - DVI cable with HDMI LCD screen?

    Hi, I bought the apple mini DVI - DVI connector to connect my imac to the back of my plasma. I have a 3 meter DVI cable to extend the mini DVI - DVI connector. It worked fine but the plasma is not so good for my purposes as i am using the set up to d

  • Claim Payment

    Dear All,               I've created internal Claim by CL01 and assign this claim to WBS Element.And Cost Collector is also greated.I've approved this clim and internal order is also created .                                                          

  • Tutorial for simple login form

    Can anyone post a link to a tutorial for a simple login form in Oracle form devloper 10g? Thanks, Va Message was edited by: user450092

  • ON MY IPAD2 MY I ITUNES RENTALS STOP HALFWAY THROUGH

    I have downloaded several rental videos from itunes. The videos downloaded fine but when I play them they freeze half way through the movie. Has anyone got a solution for this?