I use this for loop correctly

Dear friends!

Now I'm generating a report with some details for all dealers.

I am required to separate the report for each reseller respectively in two separate reports. I tried this method and it is not useful.

Please advice.
procedure convert_excel

IS

  dealer_name varchar2(100);

begin
  -- Test statements here
    
  for dealer_name in (select dealer_long_name from tbl_dealers) loop 

  print_report(
    'select dealer_region as "Dealer Region", 
    dealer_long_name as "Dealer Name",
    "# of Received" as "#of Customer Received", 
    "#of  Converted",
    "%of  Conversion" ,
       from dealer_performance t
    where dealer_name = t.dealer_long_name',
    'dealer_performance||dealer_name||.xml','Y');
    
  end loop;   
I got no error in compilation. Compilation is successful.

I received an error when I do.
ORA-00904: "DEALER_NAME": invalid identifier
Please advice, I make the mistake.

Thank you.

Benard

Hi, benard,

The error occurs in the code you have posted, or is it in the procedure print_report (or something that print_report call)?

Is the second argument of print_report supposed to be this string 37

' dealer_performance | dealer_name | XML'

or is it supposed to be the concatenation of three strings:
(1) the string 18 "dealer_performance'
(2) the value of dealer_name of education "for dealer_name in (select dealer_long_name from tbl_dealers) loop.
(3) the 4-character literal '.xml '.
?

I guess it must be the latter, because you do not use the value of the request anywhere else. (In particular, you use it not in the first argument of print_report. "You're supposed to?)

Tags: Database

Similar Questions

  • How to create parallel tasks using parallel for loops

    Hello

    I'm going to put in place a program that communicates with the six logical controllers and must read the status of the system every 100 Ms. we use OPC datasockets for this, and they appear a bit slow.

    I created a uniform method of comm. for all controllers, and now I find myself this method of programming six times to communicate with each system. I was wondering if it could be done more elegant using the parallel for loop, in which case I program an Exchange once and then six workers running simultaneously. Since a picture is clearer than a thousand words, what I'm asking is:

    Is it possible to replace something like

    by

    and that for performing these tasks in parallel loop (on different cores / in different threads)?

    I have configured the loop to create instances of the 8 to the compilation, so I would 2 surplus available when running instances if I find that I need an additional system.

    The benefits of the Show method in the second photo for me are:

    * takes less space

    * changes need be made only once

    * less blocks, son and other things makes it clearer what is happening.

    * flexibility of the actual number of tasks running (8 available runtime instances)

    * If multiple tasks are necessary, I need only update the maximum number of instances and recompile, i.e. no cutting and pasting necessary.

    Unfortunately, I don't have these available system yet, so there is no way to test this. Yet, I would like to know if the above works as I hope - unfortunately the help of labview is not quite clear to me on that.

    Best regards

    Frans

    Frans, the parallel for loop will work as expected in this situation. The six tasks will run simultaneously in different threads. What part of the aid could be made clearer?

  • How can I replace a damaged Adobe Photoshop Elements 9 Editor?  I've used this for years and all of a sudden his damaged.  I do not have the CD - can't find it - just moved.

    How can I replace an editor Adobe Photoshop Elements 9 "damaged"?

    I have been using this program for years and all of a sudden - its damaged!

    I have not the CD more if that's how I got it in my Mac.

    I tried to retrieve the serial number through Adobe, but... the account I "had" with Adobe for years has been under a name of ID that I don't remember years ago.  None worked.

    I therefore restored a new account to be able to communicate with Adobe with this name for what to do.

    So, what should I do?

    I need this program.

    You can download the installation program:

    Download Photoshop Elements products | 9, 8, 7

    Your serial number issues will have to be developed with support, so call them.

    Mylenium

  • Extraction of 2 x 2 table from 10 x 10 array using only for loops

    Hi all

    I have this assignment for "pattern matching" - user enters the Boolean model 2 x 2, and I have to compare and find in the bigger picture of Boolean random 10 x 10.
    I managed to do it with the table palette, but my instructor alert me that for this mission we prohibit this Palace and don't use the "basic" functions
    So I'm trying to track my solution and accurate table 2 x 2 from the big picture, but I fall into the "well-known" problem with loops like I can see while searching in google - I want the loop will depart from different 'i', this allows to extract all tables to another place of the largest array iteration 2 x 2.

    any help is appreciated,


  • How to use a FOR LOOP to create multiple forms?

    I use Adobe animate CC (formerly Flash Professional CC) and I am trying to adjust the following snippet so that it creates several rectangles:

    var form = createjs new. Form (new createjs. Graphics ().beginFill("#FF0000").drawRect (5,5,100,100));

    this.addChild (shape);

    I then set it and put it in a loop I thought work in the reproduction of the form. The following code creates only a rectangle well?

    for (i = 0; i < 10; i ++) {}

    var i is new createjs. Form (new createjs. Graphics ().beginFill("#FF0000").drawRect (5,5,30,30));

    this.addChild (i);

    Move so that they do not lie on the other

    This.x += 50;

    }

    I think that the problem is how you use your iterator variable. In your loop, at the first start, i is equal to 0, then you immediately replace 0 with an instance of the Shape class, which means when he tries to loop again, I is not less than 10. They can't, because it is now a shape, not a whole number.

    Try this inside the loop:

    newshape var = new createjs. Form (new createjs. Graphics ().beginFill("#FF0000").drawRect (5,5,30,30));

    newshape.x += 50;

    this.addChild (newshape);

  • Firefox won't save passwords, will not be asked to save them. I have used this for 2 years +. I know where are the settings. New comp, Windows 7, Ffx 4. You are prompted to save the password 5 times and stopped so I ask everyone here if they have any sugg

    Why must you do this such a pain. 40 minutes, I tried to post this question.

    • Make sure that you do not run Firefox in private - browsing using Firefox without saving the story mode (permanent).
    • You enter private browsing mode, if you select: Tools > Options > privacy > History: Firefox will be: "don't forget the story ever.
    • To view the history settings and cookies, choose: Tools > Options > privacy, choose the setting Firefox will: use the custom settings for the story of
    • Uncheck the box: [] "automatically start Firefox in a private browsing session.
  • Conversion of data in a table by using a For loop

    I'm trying to transpose data in a table using a loop from the size of the array, and then decrease until 0. Can someone help please if you have an example?

    This looks like a school exercise.

    Determine how to calculate the index in the input array and how to calculate the index in the output array. Use the Index and tunnel exit autoindxing table or Index table, and then replace the subset of the table.

    Lynn

  • parallel for loops does not

    Hello.

    I'm learning the multi - thread programming. To start, I use "parallel for loops" and I was surprised that it does not work. One - thread loop work a few times faster (depending on settings) that multi - thread. I don't know why, and it is my request to correct my Vi to work properly.

    Lenovo, G580, Windows 7, 64-bit computer

    Intel Core i7 3632QM
    Ivy Bridge
    Specification Intel (r) Core i7-3632QM CPU @ 2.20 GHz
    Package (platform ID) Socket 988 B rPGA (0x4)
    Number of hearts 4
    Number of threads 8

    LabView 2011.

    Altenbach says:

    Gibbon wrote:

    What was 'strange' behavior?  In "linia dluga" when inside the loop is on '1' of the "spreed up' between one and multi-fil is about 3 times, when I put it in '20' this grow to 6.2. It was strange form me, becourse I expect a similar value.

    A parallel FOR loop has an overhead for parallelization (split the problem, then go back the results, etc.). If the code is very fast, the overhead is proportionally larger. If the Subvi takes a long time to complete, the overhead of parallelization is insignificant. It is often not worthwhile to parallelize the loops with a very simple and fast code.

    Gibbon wrote:

    Altenbach - I have another question if you can help me - how did you "seconds relative high resolution." VI "? -I want to say how did you know that there is this 'vi '. And thanks a lot for your modyfications.

    You can find it in vi.lib\utilities. It is well known.

    Maybe not well known enough!  the 'Hidden gems' package adds to your palattes.  It has also been considered by a nugget of the community

  • Nested for loops error

    Hi all members of the community, I am experiencing problem with pulling the attributes of an xml I created. I use nested for loop. Please kindly help me to solve this problem...

    Thanks in advance...

    Here's the code & xml...


    import flash.events.Event;
    import flash.events.EventDispatcher;
    import flash.events. *;
    flash.net import. *;

    var myXML:XML;

    var voiceOver: String;
    var startOffset:Number;
    var slideData:Array;
    var id_cont_array:Array = new Array();
    var id_textfield_array:Array = new Array();
    var id_image_array:Array = new Array();

    var myXML_Container_Length:Number;
    var myXML_textField_Length:Number;
    var myXML_images_Length:Number;

    var loader: URLLoader = new URLLoader();
    Loader.Load (new URLRequest ("dynamic.xml"));

    loader.addEventListener (Event.COMPLETE, processXML);

    function processXML(e:Event):void
    {
    slideData = new Array();
    myXML = new XML (loader.data);

    loader.removeEventListener (Event.COMPLETE, processXML);
    loader.removeEventListener (IOErrorEvent.IO_ERROR, loadError);

    myXML = new XML (e.target.data);
    voice-over = myXML. @ voice_over;
    startOffset = myXML. @ start_offset;

    for (var i: uint = 0; i < myXML.*.length (); i ++)
    {
    trace (myXML + 'slide');
    }


    myXML_List = myXML.children ();
    myXML_Container_Length = myXML.children () .length ();
    trace (myXML_Container_Length + "is myXML_Container_Length")
    myXML_textField_Length = myXML.containerss [0] .children () .length ();
    myXML_images_Length = myXML.children () .length ();
    trace (myXML.Child ("containerss") [3]. @ id.toXMLString () + "== myXML.containerss [0].") @ id; ») ;
    trace (.textfield myXML.containerss [0] [0]. @ id + "== myXML.slide.containerss [0].") ("@ id");
    trace (myXML.containerss [0] .textfield [1]. @ id + "== myXML.slide.containerss [1].") ("@ id");
    trace (myXML.containerss [3] [0] image. @ id + "is image [0]");
    trace(myXML.containerss[0].) Children() + "== myXML.containerss [0] .children ()"); "."

    for (var j: Number = 0; j < = myXML_Container_Length; j ++)
    {
    id_cont_array.push (myXML.containerss [j]. @ id);
    trace (myXML.containerss [j]. Children () .length () + 'is j');
    myXML_textField_Length = myXML.containerss [j] .children () .length ();
    trace (myXML_textField_Length + "is myXML_textField_Length");
    for (var k: Number = 0; k < = myXML_textField_Length-1; k ++)
    {

    id_textfield_array.push (.textfield myXML.containerss [j] [k]. @ id);
    id_image_array.push (image of [k] myXML.containerss [j]. @ id);
    trace (id_textfield_array [k] + "== id_textfield_array [k] ==" + k + "--j ==" + j);
    trace ("== id_image_array" + id_image_array [k]);
    }
    trace(id_textfield_array[j]+"==id_cont_array[j]");
    }

    trace (myXML_List.length () + "= myXML_List");

    }

    function loadError(e:IOErrorEvent):void
    {

    trace ("loadError");
    }

    XML is as below...

    < drag direction = "VERTICAL" voice_over = "Slide1.mp3" start_offset = "0" margin ="" > "

    < set id = "0" direction = "HORIZONTAL" padding = "10" margin = "10" x = "10" y = "160" width = "200" height = "150" >
    < textfield id = "Text1" text = "textfieldText1" padding = "10" margin = "10" x = "10" y = "160" / >
    < image id = "img1" text = "" padding = "10" margin = "10" x = "10" y = "160" / > "
    < textfield id = "Text2" text = "textfieldText2" padding = "10" margin = "10" x = "10" y = "160" / >
    < / define >
    < set id = "1" orientation = "HORIZONTAL" padding = "10" margin = "10" width = "200" height = "200" x = "10" y = "160" >
    < textfield id = "Text3" text = "textfieldText3" padding = "10" margin = "10" x = "10" y = "160" / >
    < image id = "img2" text = "" padding = "10" margin = "10" x = "10" y = "160" / > "

    < / define >
    < set id = "2" orientation = "VERTICAL" padding = "10" margin = "10" width = "200" height = "150" x = "10" y = "160" >
    < textfield id = "Rem5" text = "textfieldText5" padding = "10" margin = "10" width = "200" height = "150" x = "10" y = "160" / >
    < image id = "img3" text = "" padding = "10" margin = "10" x = "10" y = "160" / > "
    < textfield id = 'Text6"text ="textfieldText6"padding ="10"margin ="10"x ="10"y ="160"/ >
    < / define >
    < set id = "4" orientation = "VERTICAL" padding = "10" margin = "10" width = "200" height = "150" x = "10" y = "160" >
    < textfield id = 'Text7"text ="textfieldText7"padding ="10"margin ="10"width ="200"height ="150"x ="10"y ="160"/ >
    < image id = "img4" text = "" padding = "10" margin = "10" x = "10" y = "160" / > "
    < textfield id = "Texte8" text = "textfieldText8" padding = "10" margin = "10" width = "200" height = "150" x = "10" y = "160" / >
    < / define >
    < / slide >

    The analysis is totally false. You operate processXML() should be like this:

    function processXML(e:Event):void
    {
              slideData = new Array();
              loader.removeEventListener(Event.COMPLETE, processXML);
              loader.removeEventListener(IOErrorEvent.IO_ERROR, loadError);
              myXML = new XML(e.target.data);
              voiceOver = myXML.@voice_over;
              startOffset = myXML.@start_offset;
              myXML_Container_Length = myXML.children().length();
              var node:XMLList;
              for (var j:Number = 0; j <= myXML_Container_Length - 1; j++)
              {
                        id_cont_array.push(myXML.containerss[j].@id);
                        node = myXML.containerss[j].children();
                        myXML_textField_Length = node.length();
                        for (var k:Number = 0; k <= myXML_textField_Length - 1; k++)
                        {
                                  switch (node[k].name().toString())
                                  {
                                            case "textfield":
                                                      trace(node[k].@id);
                                                      id_textfield_array.push(node[k].@id);
                                                      break;
    
                                            case "image":
                                                      id_image_array.push(node.@id);
                                                      break;
                                  }
                        }
              }
    }
    
  • slider with a for loop

    Hi all

    I have a simple slider in my pl/sql procedure. I use the method for the slider of the loop and retrieve the values below.


    DECLARE

    VAR_A VARCHAR2 (100);

    CURSOR C1 IS
    SELECT DEPT_NAME, DEPT_NO OF THE DEPARTMENT;
    BEGIN

    FOR I IN C1
    LOOP
    VAR_A: = I.DEPT_NAME;
    END LOOP;

    -etc etc.
    -etc etc.

    EXCEPTION
    WHILE OTHERS THEN
    DBMS_OUTPUT. Put_line ('hello');

    END

    This workfine but if the DEPT table does not all records in it, it goes directly to the management of exceptions, and if there are all the other instructions after the FOR LOOP, they will not be executed. I know there is a method to use the cursor (instruction FETCH) more, but I want to know what is wrong by using the FOR LOOP.

    The strange thing about this example is, even if I catch the exception, the program stops and if the DEPT table has no recording errors.

    Any suggestions or tips are greatly appreciated.

    the program stops and if the DEPT table has no recording errors.

    This seems a little suspicious. Probably another error product which is now hidden simply because of your manager WHEN of OTHER of exceptions, that didn't come out the real error message.

    I recommend getting rid of the exception handler together and after the release of the thrown exception.

  • Cursor object and cursor for loop back

    I am beginner in Oracle and the serious database of programming in general. Right now I'm studying the sliders. I more or less understand how works when the cursor returns a record, but I can't understand why this does not work when the cursor return object and I use "cursor for loop.

    Here's the test code:

    CREATE or REPLACE TYPE typ_Test () AS OBJECT
    text VARCHAR2 (50)
    );

    CREATE TABLE t_Test to typ_Test;

    INSERT INTO t_Test VALUES (typ_Test('111'));
    INSERT INTO t_Test VALUES (typ_Test('222'));

    -work, simple loop
    DECLARE
    CURSOR cur IS SELECT VALUE (o) FROM t_Test o;
    typ_Test obj;
    BEGIN
    Heart OPEN;
    LOOP
    Fetch cur INTO obj;
    OUTPUT WHEN heart % NOTFOUND;
    dbms_output.put_line (obj. (Text);
    END LOOP;
    CLOSE cur;
    END;



    -doesn't work, cursor for loop
    DECLARE
    CURSOR cur IS SELECT VALUE (o) FROM t_Test o;
    BEGIN
    FOR news of obj IN LOOP
    dbms_output.put_line (obj. (Text);
    END LOOP;
    END;



    Error report:
    ORA-06550: line 5, column 30:
    PLS-00302: 'TEXT' element must be declared.
    ORA-06550: line 5, column 5:
    PL/SQL: Statement ignored
    06550 00000 - "line %s, column % s:\n%s".
    * Cause: Usually a PL/SQL compilation error.


    EDIT:
    In fact I found no examples on the net of its use "cursor for loop" with cursor that returns the object. Only when the record is returned...

    Published by: user10393567 on February 10, 2009 07:38

    user10393567 wrote:
    Now, in the 'loop' example for what looks "obj" is a folder, not an object, and 'x' is attribute of this recording... But the cursor must return an object, not a record... What Miss me?

    In the FOR loop "obj" is a pointer to the cursor/query, not a subject in its own right. It gives you just a reference in the query.

    So with that you are referring to the query, but then you need to refer to the column in the query that you are interested, so why there need a name (in my case I called it 'x'). 'x' is the object, and then you refer to the attribute of this object "text".

    In the first request that you simply select the value directly object in a variable, so no matter what it's called in the query values are returned by the position that is the first column in the query goes into the first variable in the INTO clause. Once you have that then the variable itself contains the object, and you can just refer to the attribute within that.

    Hope that makes sense.

  • Oracle Business Rule - Table of decision for loop

    Hi Experts,

    I have the scenario where I get the list of values, and I don't have to iterate over the values in the decision table. I can't use the normal return If so , in reason of the restriction of customer "only use table decision." Can someone guide me how to use the for loop in the decision table?

    Thank you

    We can check multiple values of the same element in the decision table. so no need to make a loop.

  • Diff between open-close-Fetch loop and For loop

    Cursor can be used in many ways. Need to know the difference between these 2 types.

    (1) open - close - cursor to retrieve data
    (2) because the loop open, close and then retrieves the data internally.

    No need to open manually, close, exit in case of loop statements For.

    Is there an any example where loop For cannot be used and open-close-Fetch must be used? Or any what performance advantage using Open-Close-Fetch instead of the loop For.

    If you use a Refcursor then you can't open it with the help OF the loop. You must manually open it and process. In terms of performance, I see no advantage of using a FOR LOOP on a slider of treatment manually. But using the loop looks neat and human tend to make mistake by closing the cursor when the fact at hand, but when you allow oracle to take care of her, she does it to perfection.

  • CURSOR for loops or an associative array

    I just want to know the advantages and disadvantages of the CURSOR for loops. As a general rule, what guys do you prefer: associative array with CURSOR for loops?


    If you use the CURSOR for loop, is it not difficult to debug?

    PL/SQL Developer, I do not see what values are stored in the CURSOR for loop (in SP master_proc below) as
    There are no variables to watch. Not sure if the TOAD can show these values

    If I had used an associative array (master_proc2 below), I can see the values stored in the table by clicking on "show Collection"variable in PL/SQL developer.




    create table emp2 as select * from emp;
    
    
    create or replace procedure my_proc(p_empno in number)
    as
    begin
    update emp2 set sal=sal+100 where empno=p_empno;
    end;
    /
    
    --Using CURSOR FOR loop
    
    create or replace procedure master_proc
    as
    begin
         for rec in (select empno from emp2 where empno>7700)
         loop
              my_proc (rec.empno);
         end loop;
    end;
    /
    
    -- Using Associative arrays
    create or replace procedure master_proc2
    as
    type v_empno_type is table of number index by pls_integer;
    v_empno v_empno_type;
    
    begin
    select empno bulk collect into v_empno from emp2 where empno>7700;
    
    for i in 1..v_empno.count
     loop
        my_proc (v_empno(i));
     end loop;
    end;
    /

    VitaminD wrote:
    Thank you Tubby. If you are faced with a situation where you MUST use a loop. Then you would go to associative arrays rather than CURSOR FOR loops. Right?

    Doesn't happen too often, but if/when then I would do as I said in my first post. Use the transformation, the collection table in BULK and FORALLs.

    If we use your example posted, I would NOT spend a single table (in a loop mode) value I would be transmitted in the OVERALL picture and treat it with FORALL.

    So, I would still use neither of the approaches that you mentioned.

  • Would it not correct to say that the PCI-6110 can be set to 'redeclenchables' but the PXI-6115 module cannot use this property?

    Would it not correct to say that the PCI-6110 can be set to 'redeclenchables' but the PXI-6115 module cannot use this property?  If Yes, where is it documented the series cards can do trigger?  For example, is it possible to configure the trigger on the PXI-6124?

    Hi Joel_Neptune,

    The PCI-6110 and other materials as the PXI-6115 S series and SMU-6124 do not natively support NOR-DAQmx analog input alarm. However, you can use one of the generalist counters/timers of the Council to generate a reenclenchees pulse train, then use this as the sample clock pulse train. This transportation example shows how:

    LabVIEW\examples\DAQmx\Synchronization\Multi-Function.llb\Multi-Function-Ctr Retrigg Pulse Train generation for the Clock.vi sample

    In addition, the new material of the simultaneous sampling X series are supported trigger analog input without using a separate task of counters/timers.

    Brad

Maybe you are looking for

  • How to upgrade my firmware to the printer?

    Hello I'll do a tutorial on how to upgrade your firmware. This ensures that the printer is wise software up-to-date, and it gives you the features more to update that is available for the device you own. This video will show you step by step on how t

  • BIOS, again rejecting GPU

    So I bought recently an asus A7 250 x 2 GB for my hp Pavilion HPE h8 - 1012c and I updated to a 580 Watt power supply. Just after the installation of my new GPU, I start my pc and my screen remains black and the hard drive is not reading anything. I

  • scanning with HP Officejet Pro 8600

    with the HP Officejet Pro 8600 how can I change from portrait to landscape for SCANNING?

  • Enlarged icons, taskbar, toolbars of Internet explore and the Web page itself

    I woke up this morning and all my desktop icons have been twice the size.  My icons in my taskbar are also maximized.  I don't understand how to resize their return to their original size.  Also when I'm on the internet explore all toolbars, bar Favo

  • Cannot configure RAID 10

    UCS C220 M3S with 2008 M - 8i SAS raid PCI mezzanine card We just got a new server wiith this controller when trying to configure it with four (04) disks to a Raid 10 SAS... OOHH no RAID 10 could choose. I found a paper that says that controllers RAI