In general, how do I put code into a loop?

I have access to a procedure that takes a parameter and spits out a single result. I need to figure out how to use that procedure and spit out many results. This example should clear things up.
VARIABLE enum NUMBER;
EXEC :enum := 7566;
-- my procedure. Cannot change code here.
-- Prints out a formatted name and job, given an empno stored in :enum
SELECT ename || ' (' || job || ')' AS "myrow"
FROM scott.emp
WHERE empno = :enum;
-- end of my procedureHere, I can't change anything from the SELECT to the semi-colon. Now I would like to put this into a PL/SQL LOOP, but I can't figure it out. Let's say I want to print out all of the employees with a job of manager. Somehow I will need enum to take the value of the current iteration from within the loop.
something like this:
BEGIN
-- first get the list of employees
CURSOR e_cur IS
SELECT empno
FROM scott.emp
WHERE job="MANAGER';
END;
BEGIN
FOR r_cur IN e_cur LOOP
:enum = r_cur.empno
-- my procedure. Cannot change code here.
-- Prints out a formatted name and job, given an empno stored in :enum
SELECT ename || ' (' || job || ')' AS "myrow"
FROM scott.emp
WHERE empno = :enum;
-- end of my procedure
END LOOP;
END;
{code}
of course, this code does not work, and I don't know what else to try.
Thanks in advance for any help!
Skip                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Oh boy, do I owe you guys an apology. Absolutely no excuse, but I screwed up big time yesterday. I am working on a couple of projects and got some wires crossed. I would like to start over. Forget everything I asked yesterday. I wouldn't be surprised if no one answered, but I could still use some help. I am embarrassed because I am usually pretty good at these things, and again, I humbly apologize.
Still with me? Here we go:
I have a SQL script that is quite long. It has 25 select statements, 4 unions, 7 minus'es, lots of joins, sub-queries, etc. The script expects two bind variables to be set before running. The code was written to execute once (like a report). But the code does exactly what I need, but I need to run it on a much larger set. So I would like to wrap it in a loop. Now, I am pretty good at other programming languages (I know, hard to believe given yesterday's exchange). If I have some java code that I want to wrap in a FOR-NEXT loop, often all I need to do is put one line at the top of the code and one line at the bottom. Then I make sure the variables that need t be updated through each iteration are properly updated. Bada-bing, bada-boom, it's done.
It doesn't seem as easy here. I know that I will have to convert my SQL script to PL/SQL. But I am wrestling with the DECLAREs, BEGINs and LOOPs, and changes to the existing code to ensure the bind variables are updated each iteration. I have tried all of what I thought would be the simple solutions as I described with my java example above, but it has not worked. So, as my subject line indicates, I was wondering if there was a general methodology to LOOP-ifying existing code. I know this is a pretty nebulous question, and I probably blew it yesterday, but I really do need some help. Even if it is "read this and that website/book/etc". That's really it. sigh All that stuff yesterday about "unmodifiable code"--forget about that. I should never have said that. Anything goes.
Maybe there isn't a simple solution here. SQL isn't Java. And that's OK. At least then I will know I will need to look for a different solution or I will have to get a LOT smarter with SQL and PL/SQL. I thought my super-simple example yesterday was a good enough substitute for what I am faced with, but maybe that isn't a good assumption.

Similar Messages

  • How do I put text into an Edge File that clients can edit easily afterwards

    Hi
    Can anyone explain how I can put text into an edge file (styled with google fonts) and make it so that clients can access the text and update the text as they require?
    Previous suggestion was dynamically loading a .txt file - any instructions would be most appreciated.
    Thanks.

    Hi Resdesign!
    Your code is very useful to learn how to use Json in Adobe Edge Animate!
    But I have a question: why you use ( i ) as argument of the function UpdateInfo and when you recall it you use ( index )?
    $.getJSON('slides.json', function(data){
              //for(var i=0; i<data.length; i++){
    function updateInfo(i){
                        sym.$("photo").css({"background-image": "url('"+data[i].image+"')"});
                        sym.$("pillar").html(data[i].pillar);
                        sym.$("what").html(data[i].what);
                        // position
              index = -1;
              sym.$("btn").click(function(){
              index++;
                        if (index>=5){
                                  index = 0;
              updateInfo(index);
    Many thanks for your attention!
    Davide

  • HT1535 How do I put music into iTunes that is on my iPod touch? I have music on my iPod touch that is not in my iTunes library.  I do NOT want to loose these songs when I sync to iTunes.

    Recently I had to replace my computer with a new one. The old hard drive died and there was no way of retrieving any of my data from the dead computer. When I downloaded iTunes onto my new computer there were several songs missing in my iTunes library. I was able to retrieve most through purchased music, however there was some music that I had downloaded from other sources and that music is still on my iPod touch. How do I put music into my iTunes library that is on my iPod touch but not in the iTunes library? I do not want to loose the music on my iPod when I sync to iTunes library.

    Syncing media to iOS devices
    iPhone User's Guide
    As for the content purchased from BN.com that shows up in the nook app... check with Barnes and Noble to see if it's possible for that content to show up on your computer.

  • How do i put music into my ipod ? im veryyyyyyyyyy confused!!!!!!!!!!!!!!!!

    how do i put music into my ipod im very confused

    1. Install the CD that came with your iPod, or download the newest software off the internet. (click iPod+itunes at the top of this screen, then scroll all the way down and lcikc the link on the left-hand side).
    2. Plug in your iPod, follow the on-screen instructions.
    3. Set the preferences for your iPod, by going to Edit>Preferences>iPod tab.
    If you haven't installed iTunes yet, click the ipod+iTunes at the top of this page, then click the link.
    If you have iTunes, but no music, put a CD into the CD drive on your computer, then in iTunes(which may or may not open automatically), click Import, at the top-right, when the CD is selected in the Sources menu (on the left).
    Download Now
    I hope this wasn't too confusing and I hope that I helped!

  • How do I put ios6 into my iPad one?

    How do I put ios6 into my iPad 1? I,m not very good at this. Thanks, don

    You don't. iOS 5.1.1 is the highest possible for the iPad 1.

  • How do I put contacts into my iPad2?

    How do I put contacts into my iPad2?

    Enter them
    e-mail them from your existing computer to yourself, open the mail on the iPad and save it
    sync them via itunes to your ipad
    use icloud to sync them to your your device.

  • How do i put 8mm into my imac and edit

    How do i put 8mm into my iMac, and edit it?

    For 8MM Analog, see QuickTime Kirk's advice. You can use the EyeTV Hybrid with USB, or you can use and ov the Analog to Digital converters from Grass Valley (formerly Canopus) which use Firewire.
    For 8MM DV, just connect your camcorder to your mac with a Firewire Cable. Camcorder must be plugged in.
    For 8MM film, let me know. I can recommend a site that can capture 8MM film in 1080P for reasable prices.

  • In the toolbar I click on color face and see the RGB color space view. How do I put them into CMYK?

    In the toolbar left I click on color face and see the RGB color space view. How do I put them into CMYK?
    German:
    In der Werkzeugleiste klicke ich auf Farbfläche und sehe den RGB-Farbraumansicht. Wie stelle ich diese in CMYK um?

    I design print material. I hope Adobe will change it.
    The ID Color Picker works the same as Photoshop's classic color picker except that it doesn't have an H,S,B presentation (which is the more intuitive interface). So both programs let you choose an R, G, B and L, a, b presentation of color via the 6 radio buttons, and you can pick RGB, Lab or CMYK versions of the chosen color—the mode you get depends on where your cursor is. If you pick an out-of-gamut CMYK color it is brought into gamut in the Swatches or Color panels after you click OK.
    So here I'm picking RGB, Lab and CMYK Swatches or Colors of the color selection because my cursor is in a respective RGB, Lab or CMYK field, note that the Add Swatch button changes accordingly:
    When I click inside the color field, the CMYK values are a color managed conversion of the chosen color, but I also have the option of entering any value. So it would be unlikely I would get a blue gray color like 50|0|0|50 with a color managed conversion, but I have the option to enter those specific numbers.
    The 3 versions of the color added as swatches
    An InDesign document can have a mix of RGB, Lab, and CMYK colors. Colors and swatches can be converted to any CMYK destination space when you export or print.

  • How to restructure this code into separate classes?

    I have C# code that initializes a force feedback joystick and plays an effect file(vibrates the joystick). I have turn the console application into library
    code to make a dll so that I can use it in LabVIEW. 
    Right now all the code is written under one class, so went I put the dll in LabVIEW I can only select that one class. labVIEW guy told me that I need to
    restructure my C# code into separate classes. Each class that I want to access from LabVIEW needs to marked as public. Then I can instantiate that class in LabVIEW using a constructor, and call methods and set properties of that class using invoke nodes and
    property nodes.
    How can I do this correctly? I tried changing some of them into classes but doesn't work. Can you guys take a look at the code to see if it is even possible
    to break the code into separate classes? Also, if it is possible can you guide me, suggest some reading/video, etc.
    Thank you
    using System;
    using System.Drawing;
    using System.Collections;
    using System.Windows.Forms;
    using Microsoft.DirectX.DirectInput;
    namespace JoystickProject
    /// <summary>
    /// Summary description for Form1.
    /// </summary>
    public class Form1 : System.Windows.Forms.Form
    private System.Windows.Forms.Label label1;
    /// <summary>
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.Container components = null;
    private Device device = null;
    private bool running = true;
    private ArrayList effectList = new ArrayList();
    private string joyState = "";
    public bool InitializeInput()
    // Create our joystick device
    foreach(DeviceInstance di in Manager.GetDevices(DeviceClass.GameControl,
    EnumDevicesFlags.AttachedOnly | EnumDevicesFlags.ForceFeeback))
    // Pick the first attached joystick we see
    device = new Device(di.InstanceGuid);
    break;
    if (device == null) // We couldn't find a joystick
    return false;
    device.SetDataFormat(DeviceDataFormat.Joystick);
    device.SetCooperativeLevel(this, CooperativeLevelFlags.Exclusive | CooperativeLevelFlags.Background);
    device.Properties.AxisModeAbsolute = true;
    device.Properties.AutoCenter = false;
    device.Acquire();
    // Enumerate any axes
    foreach(DeviceObjectInstance doi in device.Objects)
    if ((doi.ObjectId & (int)DeviceObjectTypeFlags.Axis) != 0)
    // We found an axis, set the range to a max of 10,000
    device.Properties.SetRange(ParameterHow.ById,
    doi.ObjectId, new InputRange(-5000, 5000));
    // Load our feedback file
    EffectList effects = null;
    effects = device.GetEffects(@"C:\MyEffectFile.ffe",
    FileEffectsFlags.ModifyIfNeeded);
    foreach(FileEffect fe in effects)
    EffectObject myEffect = new EffectObject(fe.EffectGuid, fe.EffectStruct,
    device);
    myEffect.Download();
    effectList.Add(myEffect);
    while(running)
    UpdateInputState();
    Application.DoEvents();
    return true;
    public void PlayEffects()
    // See if our effects are playing.
    foreach(EffectObject myEffect in effectList)
    //if (button0pressed == true)
    //MessageBox.Show("Button Pressed.");
    // myEffect.Start(1, EffectStartFlags.NoDownload);
    if (!myEffect.EffectStatus.Playing)
    // If not, play them
    myEffect.Start(1, EffectStartFlags.NoDownload);
    //button0pressed = true;
    protected override void OnClosed(EventArgs e)
    running = false;
    private void UpdateInputState()
    PlayEffects();
    // Check the joystick state
    JoystickState state = device.CurrentJoystickState;
    device.Poll();
    joyState = "Using JoystickState: \r\n";
    joyState += device.Properties.ProductName;
    joyState += "\n";
    joyState += device.ForceFeedbackState;
    joyState += "\n";
    joyState += state.ToString();
    byte[] buttons = state.GetButtons();
    for(int i = 0; i < buttons.Length; i++)
    joyState += string.Format("Button {0} {1}\r\n", i, buttons[i] != 0 ? "Pressed" : "Not Pressed");
    label1.Text = joyState;
    //if(buttons[0] != 0)
    //button0pressed = true;
    public Form1()
    // Required for Windows Form Designer support
    InitializeComponent();
    // TODO: Add any constructor code after InitializeComponent call
    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    protected override void Dispose( bool disposing )
    if( disposing )
    if (components != null)
    components.Dispose();
    base.Dispose( disposing );
    #region Windows Form Designer generated code
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    public void InitializeComponent()
    this.label1 = new System.Windows.Forms.Label();
    this.SuspendLayout();
    // label1
    this.label1.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
    this.label1.Location = new System.Drawing.Point(8, 8);
    this.label1.Name = "label1";
    this.label1.Size = new System.Drawing.Size(272, 488);
    this.label1.TabIndex = 0;
    // Form1
    this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    this.BackColor = System.Drawing.SystemColors.ControlText;
    this.ClientSize = new System.Drawing.Size(288, 502);
    this.Controls.AddRange(new System.Windows.Forms.Control[] {
    this.label1});
    this.Name = "Form1";
    this.Text = "Joystick Stuff";
    this.ResumeLayout(false);
    #endregion
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main()
    using (Form1 frm = new Form1())
    frm.Show();
    if (!frm.InitializeInput())
    MessageBox.Show("Couldn't find a joystick.");

    Imho he means the following.
    Your class has performs two tasks:
    Controlling the joystick.
    Managing the joystick with a form.
    So I would recommend, that you separate the WinForm from the joystick code. E.g.
    namespace JoystickCtlLib
    public class JoystickControl
    private Device device = null;
    private bool running = true;
    private ArrayList effectList = new ArrayList();
    private string joyState = "";
    public string State { get { return this.joyState; } }
    public bool InitializeInput() { return true; }
    public void PlayEffects() { }
    private void UpdateInputState() { }
    So that your joystick class does not reference or uses any winform or button.
    btw, there is a thing which is more important than that: Your polling the device in the main thread of your application. This will block your main application. Imho this should be a job for a thread like background worker.

  • How do I put data into a template using the Labview report generation toolkit for Microsoft Office?

    I am running Lookout 5.0 and have recently purchased the Labview Report Generation Toolkit for Microsoft Office to create reports from my Lookout logged data. Since I have never used Labview I am having my problems. I tried following the tutorials but they do not seem to be examples of what I want to do.
    I log rainfall totals (1 spreadsheet)in Lookout from 40 different sites in 5 minute increments. I copy these totals and paste them into another spreadsheet which sums them up to give me hourly totals and then paste those totals into a spreadsheet for distribution.
    In Labview I create a new report and use the distribution sheet as my template, but how do I complete
    the steps of loading the raw 5 minute data into labview and then paste it into the hourly total spreadsheet and then transfer those totals into the distribution template?
    I have been trying to figure this out for over a week, and I am getting nowhere.
    Any response would be appreciated.
    Thanks
    Jason P
    Jason Phillips

    Lookout saves the files in .csv form which can be opened in Excel. I did make some progress by using the "append table to report" vi which allowed me to put values into an array and then those values were entered into my template on my report vi.
    Where I am stuck now is I want to be able to put values into my template from a .csv file, not from an array I have to manually put numbers in.
    Once those values are in my template I want to pull summed values from the template and place them into a final excel file for printing.
    I have attached examples of the files I am working with to help you better understand what I am trying to do.
    I hope that makes sense.
    Jason Phillips
    Attachments:
    HourlyTotalsTemplate.xls ‏120 KB
    eb_rain_gauge_ss.csv ‏23 KB
    EastBankHourlyRainReport.xls ‏28 KB

  • HT2729 How can I put songs into the album they came from but were split because of multiple artists on a tune?

    I need help in finding out home to combine songs from the same CD into one Album. When putting CD into the iMac, it auto loads into iTunes. If the artist is singing duet and the songs show more than one artist, it gets separated in iTunes. I want to combine all tracks together like they are on the CD.

    One way around this is to edit the album info for each song on that album and make the album artist 'various artists', or you can remove that duet artist and make all the artists the same.
    Seems to be a glitch or change with how iTunes sees albums now. THey alphabetize them by artist and, as you've noticed, if the artists are different, it sees them as different albums.
    I had many albums like this and spent a whole weekend editing the info to 'various' to clean it up.

  • How can  we put  Documents into SDN

    Hi friends,
      I have one document  about Reporting... i prepared   that with screen shots.. now i want to put into SDN .. it will be helpfull to many people..
       can any one suggest me.. how can we put  into SDN...( i mean i dont have any idea abt WIKI  and Blogs.... so,    can any one plz guide me..)
    Thanks
    AK
    null

    Hello Ajay,
    here is an <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d3522851-0e01-0010-e795-fbb9fc59c905">article about SDN documents</a>. It decribes how to <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/68f93647-0a01-0010-8891-92cea7f0313f">complete this form</a>, which has to be send to SDN. Good luck with that...
    Reward points if helpful,
    regards, Martin

  • How to convert Vb code into java?

    Hi,
    I want to know how to make conversion a visual basic source code into java. The conversion could be (1:1) scale.
    Is there any compilers making the live easier (solving this problem) ?
    Thank you all.
    Abu_ramla

    Use the JNI. VB doesent actually do anything on its own. Its just a series of calls on COM objects to performs all its work. You can call these same COM objects using the Java Native Interface or JNI. You wont have access to things designed in VB though like forms, you will have to redesign those.
    This will take extensive knowledge of COM, VB, Java, and JNI. It will take you about 1 year to get up to speed. I would say to not do this.

  • How can I put movie into my new ipod video ??

    I would like to know how I can put a movie (dvd) into my ipod video ??

    Commercial or home made?
    If you mean commercial-we aren't allowed to tell you, it violates terms of service.
    Home made-you will need to convert the mpeg2 files into mpeg4 files that comply with the iPod accepted format.

  • How can I put Planning into Read Only Mode ?

    We need to backup our Essbase cubes to tape every night. How can I update Oracle HSP* tables so that I put Planning into Read Only Mode ? I want to prevent Asia and Europe users from updating Planning while Essbase is in READ-ONLY mode (BEGINARCHIVE).

    Hi,
    You should put the planning application in Maintenance mode if you are doing any backups, this can be done from planning web.
    Select Administration > Application Settings.
    For Show, select Advanced Settings.
    Click Go.
    Select System Settings.
    For Application Maintenance Mode, select an option for Enable Use of the Application For:
    All users —All users can log on to the application or continue working with the application if they are currently logged on.
    Administrators —Only other administrators can log on. Other users are forced off and prevented from logging on until the option is reset to All Users.
    Owner —Only the application owner can log on. All other users are prevented from logging on. If they are currently logged on, they are forced off the system until the option is reset to All Users or Administrators. Only the application owner can restrict other administrators from using the application.
    Hope this helps
    John
    http://john-goodwin.blogspot.com/

Maybe you are looking for

  • Looking for a manual for gpib232ct converter

    I am trying to test a gpib232ct converter but I don't have a manual. At least I want to know which one of the 2 switches in the board control the baud rate and if I need a null modem adapter for this converter. Thanks, David

  • Query: unterdru00FCcken von "KEINE BERECHTIUNG!" / suppress "KEINE BERECHTIUNG!

    Hello, I have created a query with two structures (rows for plant, columns for key-figures). Plant is a InfoObject which is marked as "authorization relevant". Due to this, the user gets in the queryresult only in the rows, in which the user has auth

  • Routings List

    Has anyone written query to show routing lists. In a column format. Similiar to the information shown in CA51. Thank you

  • Invisible td in Safari and Chrome but not other browsers

    Hi, I am currently building a homepage with php, mysql, javascript and ofc html. At the top of my page I have a table with some graphics and a login/menu system. I have several pages in my project and the issue I have only presents itself on 2 of the

  • Tax deprecitaion

    Hi Does any one: 1. Post any entries for Capital Allowance (Tax depreciation)? I noticed there is functionality OADX) 2. Execute financtial reports for tax purposes (I.e using tax  depreciation instead of book depreciation etc). I noticed that we can