variable in loops

I learn LabVIEW through RoboLAB. I made the paint using RCX devices. I also analyze images for aesthetics. My vi, attached, has a hang up when I try the total number of pixels that are part of a certain parameter. I think that you cannot use variables in loops.

http://tomlohre.com/LEGO.htm has my work so far.

I was able to use the image vi charris shift register in the tread "loading data from sensors in a table and then retrieve" to solve my problem. Thank you for including image of the vi block diagram. I use 7.0 and often impossible to run attached vi. It's now at illustrating the data in the form of expansion of circles and find the command 'put the pixel data.

Tags: NI Products

Similar Questions

  • How to create unique variables in loops? (AS2)

    Hello

    I wonder if it is possible to create variables in a loop for which uses an incremental number in the name of the variable.

    This is the code I tried (like a long shot) but does not work:

    var i: Number;
    for (i = 1; i < 10; i ++) {}
    var ['number' + String (i)]: number = i;
    }

    trace (number5);

    What I'm trying to create here is a series of variables called "Number 1", "Number2" and 'Number3', etc. Is there another way to do it? I need them to be public (I think that's the word?), so they can be used elsewhere in the script.

    I would appreciate any advice.

    Try this:

    for(var i : Number = 1; i < 10; i++)
    {
        this["number" + i.toString()] = i;
    }
    trace(number1); // will output 1
    

  • How to use a static const variable while loop collection ArrayCollection?

    Hello

    I have an arraycollection collection which I get to main system, that has two columns named, 'Id' and 'Desc '.

    I created a static const variable:

    public static FIELD_DESC_NAME:String const = 'Desc ';

    I have been using this variable const everywhere in my code, for example:

    super.dataProvider = model.acVariants;
    super.labelField = FIELD_DESC_NAME;  instead of using super.labelField = "Desc";

    But unfortunately, there is one place where I'm not able to use it. And it's all in the loop as shown below:

    for (var i: uint = 0; i < model.acVariants.length; i ++) {}

    If (value.label is model.acVariants [i]. DESC) {/ / I want to use the FIELD_DESC_NAME variable, instead of using 'Desc' model.acVariants [i]. / / DESC}
    super.selectedItem = model.acVariants [i];
    break;
    }

    }

    Can you please let me know how can achieve us?

    Appreciate your help...

    <! - Deepak - >

    Can you put a debug statement and draw the value returned by model.acVariants [i] [FIELD_DESC_NAME] and value.label

    Hope that there must be a difference.

    If this does not solve then please let me know

    -Vikash

  • How to combine the string and variable in loop

    I need to get the following lines in a loop for, but miss me the possibility in actionscript3 to use this ['string' + i + 'word2'

    wing_mc.prop1_mc.rotation = - wing_mc.rotation;
    wing_mc.prop2_mc.rotation = - wing_mc.rotation;
    wing_mc.prop3_mc.rotation = - wing_mc.rotation;
    wing_mc.prop4_mc.rotation = - wing_mc.rotation;
    wing_mc.prop5_mc.rotation = - wing_mc.rotation;
    wing_mc.prop6_mc.rotation = - wing_mc.rotation;
    wing_mc.prop7_mc.rotation = - wing_mc.rotation;
    wing_mc.prop8_mc.rotation = - wing_mc.rotation;
    wing_mc.prop9_mc.rotation = - wing_mc.rotation;

    I tried things like

    for (i = 1; i < 10; i ++) {}
    This ["wing_mc.prop" + i + "_mc"] .rotation = - wing_mc.rotation;
    }

    or

    for (i = 1; i < 10; i ++) {}
    "wing_mc.prop"+ i +"_mc".rotation = - wing_mc.rotation;
    }

    It seems very simple
    I must be overlooking something

    Thanks in advance

    Kees

    "Although it works there is a little thing, I do not understand:
    This.wing_mc ["prop" + i + "_mc"] .rotation
    I think a point to separate the this.wing_mc ["prop" + i + "_mc"] AND .rotation '.

    Well, that's how. In fact, the syntax is similar to the table. There are no points when you read the value of a member of the group. In a way that object is an array of methods and parameters - we simply refer to them not whole but by name.

    I know it's all confused sometimes. :-)

  • Try to make a variable with loop for

    Try to retrieve an instance of movieClip in my library and set it on stage and clickable menu do, (list drop-down/dropup)).
    Can someone help me with what I'm doing wrong?

    var MenuItem1:Array = new Array ("text1", "text2", "Text3", "text4");
    CreateM (MenuItem1.length);
    function CreateM(Menu1:Number):void
    {

    for (var i: Number = 0; i < MenuItem1.length; i ++)
    {

    var cela ["M1" + i]: TextField = new TextField();
    var cela ["M2" + i]: takki = new takki();
    This ["M2" + i] there = this ["M2" + i] there-(i*50) + (stage.stageHeight - this ["M2" + i] .height);
    This ["M1" + i] .text = MenuItem1 [i];
    This ["M1" + i] there = this ["M1" + i] there-(i*20) + (stage.stageHeight - this ["M1" + i] .height);

    addChild (this ["M2" + i]);
    addChild (this ["M1" + i]);

    This ["m2" + i] .addEventListener (MouseEvent.MOUSE_OVER, clicking);
    }
    }

    function clicking(event:MouseEvent):void

    {

    trace ("I am clicking on the button" & & this ["M2"]);

    }

    Try something like this:

    var MenuItem1:Array = new Array ("text1", "text2", "Text3", "text4");
    CreateM (MenuItem1.length);

    function CreateM(Menu1:Number):void
    {
    for (var i: Number = 0; i
    This ["M1" + i] = new TextField();
    This ["M2" + i] = new takki();
    This ["M2" + i] there = this ["M2" + i] there-(i*50) + (stage.stageHeight - this ["M2" + i] .height);
    This ["M1" + i] .text = MenuItem1 [i];
       
    This ["M1" + i] there = this ["M1" + i] there-(i*20) + (stage.stageHeight - this ["M1" + i] .height);
       
    addChild (this ["M2" + i]);
    addChild (this ["M1" + i]);

    This ["m2" + i] .addEventListener (MouseEvent.Click, clicking);
    }
    }

    function clicking(event:MouseEvent):void {}
    trace ("I am clicking on the button" & event.target.name);
    }

    Remember that you have to work with the positioning and the TextFields overlap takkis, that the click is possible only in a minor fraction of the takkis.

  • How do I know the cursor for loop host variable contains data or not

    Hi all


    can someone tell me how to know cursor variable host loop for contains data or not.


    example:
    Start
    for curr_rec in (select * from double)
    loop

    dbms_output.put_line(curr_rec%ROWCOUNT);

    end loop;


    end;

    The following oracle error message is coming:

    ORA-06550: line 5, column 27:
    PLS-00324: cursor attribute can only be applied to non slider "CURR_REC."

    Please help me.

    Thank you and best regards,
    Prakash P

    Published by: 833560 on April 19, 2011 21:57

    833560 wrote:
    Hi all

    can someone tell me how to know cursor variable host loop for contains data or not.

    example:
    Start
    for curr_rec in (select * from double)
    loop

    dbms_output.put_line(curr_rec%ROWCOUNT);

    end loop;

    end;

    The following oracle error message is coming:

    ORA-06550: line 5, column 27:
    PLS-00324: cursor attribute can only be applied to non slider "CURR_REC."

    Please help me.

    Thank you best regards &,.
    Prakash P

    Published by: 833560 on April 19, 2011 21:57

    You know, in your code curr_rec is not slider.
    You cannot use curr_rec % rowcount
    If you want to get the number of lines of your loop, then use an additional variable

    Try this please

    declare
     countLoop NUMBER :=0;
    begin
      for curr_rec in( select * from dual)
      loop
        countloop := countloop + 1;
    
      end loop;
      dbms_output.put_line(countloop);
    end;
    

    or

    DECLARE
            CURSOR csr_org IS
                  SELECT empno, ename FROM   emp;
                  num_total_rows NUMBER;
          BEGIN
                  FOR idx IN csr_org LOOP
                      dbms_output.put_line(idx.empno||' '||idx.ename);
                      num_total_rows := csr_org%ROWCOUNT;
                  END LOOP;
                  IF num_total_rows > 0 THEN
                    dbms_output.new_line;
                    dbms_output.put_line('Total Organizations = '||to_char(num_total_rows));
                  END IF;
       END;
     /
    

    Published by: Mahir M. Quluzade, April 20, 2011 10:19

  • Notofication, local variable which is the efficient education Department

    Hi, I want to pass a variable to loop A loop b, I wonder which is more effective, the Notification or local variabe?

    Well, both are equally effective. If it's just a one-way road loop A loop B, you can just use a local variable, but you can run any questions if you need all the data. If the loop of the local written writer then there is no way of knowing whether the other loop has already read, so it will crush him. Also, the receive loop has no way of knowing if the data has been updated. If the receive loop needs that value the latest then you can go out with a local. But you must read continuous him when a notifier allows you to just 'wake up' the receiver loop when the value is written.

  • Variant in the variant of a shared variable

    Hello

    I'm re-reading some tags in a PLC Siemens S7 - 1200 OPC server of NOR. I can read them NOR-DSM (Distributed System Manager). However, I can't read or write in Labview. I generated a shared variable event loop that runs when the variable changes. I always get variant variant as a value that is not correct I want to convert to a data type. (See attached image)

    How can I fix it?

    It's okay, it works:

  • Need help cleaning a recursive loop, please.

    Hello again,

    I'm on another quest to write a function completely fool proof to a very specific task in Illustrator. The task is to create a new work plan in the target document (determined by a guest of small script user interface) which is a certain distance from the existing chart with the highest index Board (so I'm still putting the new plan of work at the end). After I created the work plan, I want to activate the source document and duplicate all the layers (a few layers are empty but will be used later) and work in the doc of the target and place them on the newly created artboard.

    With the help and advice of Silly-V , I wrote a recursive loop to handle the situation of nested layer. This brings me to the first part of my question. Please take a look at recursion and let me know if there is anything I can do to clean it up and simplify as much as possible. (I know it looks really messy. I've learned how do on the fly and I changed a lot of variables and loops after the fact, just trying to make it work). I hope also that somehow slightly more efficient to work this will improve stability as well. As it is, I can only run this script 3 or 4 times (if I'm lucky), before I get persistent errors of MRAP on trivial things such as: layers.getByName("Information").visible = false; At this point, the only recourse is to stop illustrator and reopen files. So I'm usually good for a few runs more...

    Part 2 of my question is the following. Is there a way to reproduce the work from one document to the other, and place it on the new artboard rather than the artboard [0]? Currently, art is duplication of artboard [0] the doc from the source to the artboard [0] the doc of the target and then I manually manipulate the implementation by defining: this.left this.left = + (artboards.length * 2100). First, it is just steps adding too much to the script and slow things down I'm sure. The second problem that is after 4 work plans, I need down another line (to keep from spilling onto the pasteboard). That adds another layer of complexity and a lot more if statements to determine how far from move it and in what direction.

    Here's the script in its entirety. Please do not hesitate to rip it and ask me WTH I thought. According to carloscanto, script.elegant is definitely fake.

    var copyToMaster = function(){
      var docRef = app.activeDocument;
      var layers = docRef.layers;
      var masterFile = getTargetDoc();
      if(masterFile == null){
      return;
      }
      var master = app.documents.getByName(masterFile);
      var sourceDoc = app.activeDocument;
      var move;
      var myLayer;
      var targetLayer;
      var innerTargetLayer;
      var outerTargetLayer;
    
    
      //Logic Container//
    
      function outerRecursive(layer){
      var name = layer.name;
      try{
      outerTargetLayer = targetLayer.layers.getByName(layer.name);
      }
      catch(e){
      outerTargetLayer = targetLayer.layers.add(ElementPlacement.PLACEATBEGINNING);
      outerTargetLayer.name = name;
      }
      if(layer.pageItems.length>0){
      for(var b=layer.pageItems.length-1;b>-1;b--){
      var curItem = layer.pageItems[b];
      var copyCurItem = curItem.duplicate(outerTargetLayer,ElementPlacement.PLACEATBEGINNING);
      copyCurItem.left = curItem.left+move;
      }
      }
      if(layer.layers.length>0){
      for(var e=layer.layers.length-1;e>-1;e--){
      var subSubLayer = layer.layers[e];
      innerRecursive(subSubLayer);
      }
      }
      }
    
      function innerRecursive(subLayer){
      try{
      innerTargetLayer = outerTargetLayer.layers.getByName(subLayer.name);
      }
      catch(e){
      innerTargetLayer = outerTargetLayer.layers.add();
      innerTargetLayer.name = subLayer.name;
      }
      if(subLayer.pageItems.length>0){
      for(var g=subLayer.pageItems.length-1;g>-1;g--){
      var curItem = subLayer.pageItems[g];
      var copyCurItem = curItem.duplicate(innerTargetLayer,ElementPlacement.PLACEATBEGINNING);
      copyCurItem.left = copyCurItem.left + move;
      }
      }
      if(subLayer.layers.length>0){
      for(var h=subLayer.layers.length-1;h>-1;h--){
      innerRecursive(subLayer.layers[h]);
      }
      if(name == "Information"){
      layer.locked = true;
      layer.visible = true;
      }
      else if(name == "Prepress"){
      layer.locked = false;
      layer.visible = false;
      }
      }
      if(subLayer.name == "Information"){
      subLayer.locked = true;
      subLayer.visible = true;
      }
      else if(subLayer.name == "Prepress"){
      subLayer.locked = false;
      subLayer.visible = false;
      }
      }
    
      function getTargetDoc(){
    
      var docs = [];
    
    
      for(var a=0;a<app.documents.length;a++){
      docs.push(app.documents[a].name);
      }
    
    
      var targetIndex = new Window("dialog", "Which is Master");
      var newTextGroup = targetIndex.add("group");
      newTextGroup.text = targetIndex.add("statictext",undefined,"Which file do you want to merge to?");
      newTextGroup.align = "center";
      var radioGroup = targetIndex.add("group");
      radioGroup.alignChildren = "left";
      radioGroup.orientation = "column";
      for(var a=0;a<docs.length;a++){
      radioGroup.add("radiobutton",undefined,docs[a]);
      }
      radioGroup.children[0].value = true;
    
      var buttonGroup = targetIndex.add("group");
      var ok = buttonGroup.add("button", undefined, "OK");
      var can = buttonGroup.add("button", undefined, "Cancel");
    
    
      function selected(which){
      for(var c=0;c<which.children.length;c++){
      if(which.children[c].value == true){
      return which.children[c].text;
      }
      }
      }
    
    
      if(targetIndex.show() == 1){
      return (selected(radioGroup));
      }
      else{
      return;
      }
    
    
      targetIndex.show();
      }
    
      function createNewArtboard(){
      master.activate();
      move = ((master.artboards.length) * 2100)
      var aBcount = master.artboards.length;
      var lastAB = master.artboards[master.artboards.length-1];
      var aB = lastAB.artboardRect;
      var left = aB[0];
      var top = aB[1];
      var right = aB[2];
      var bot = aB[3];
      var moveRight = 2100;
      var moveDown = 2100;
      if(aBcount != 5 && aBcount != 10){
      var newLeft = left + moveRight;
      var newRight = right + moveRight;
      var rect = [newLeft,top,newRight,bot];
      var newAb = master.artboards.add(rect);
      }
      else{
      var originAb = master.artboards[0].artboardRect;
      var oLeft = originAb[0];
      var oTop = originAb[1];
      var oRight = originAb[2];
      var oBot = originAb[3];
      oTop = oTop - moveDown;
      oBot = oBot - moveDown;
      var rect = [oLeft,oTop,oRight,oBot];
      var newAb = master.artboards.add(rect);
      }
      sourceDoc.activate();
      }
    
      //Function Calls
    
      createNewArtboard();
    
      for(var a=0;a<layers.length;a++){
      layers[a].locked = false;
      layers[a].visible = true;
      }
      for(var a=0;a<master.layers.length;a++){
      master.layers[a].locked = false;
      master.layers[a].visible = true;
      }
    
      for(var a=layers.length-1;a>-1;a--){
      var curLayer = layers[a];
      try{
      targetLayer = master.layers.getByName(curLayer.name);
      }
      catch(e){
      targetLayer = master.layers.add();
      targetLayer.name = curLayer.name;
      }
      if(curLayer.pageItems.length>0){
      for(var k=curLayer.pageItems.length-1;k>-1;k--){
      var curItem = curLayer.pageItems[k];
      var copyCurItem = curItem.duplicate(targetLayer,ElementPlacement.PLACEATBEGINNING);
      copyCurItem.left = copyCurItem.left + move;
      }
    
    
      }
      if(curLayer.layers.length>0){
      for(var f=curLayer.layers.length-1;f>-1;f--){
      var curSubLayer = curLayer.layers[f];
      outerRecursive(curSubLayer);
      }
      }
      }
    
      //re-lock/hide layers;
    
      for(var a=0;a<master.layers.length;a++){
      if(master.layers[a].name == "Guides" || master.layers[a].name == "BKGRD, do not unlock"){
      master.layers[a].locked = true;
      }
      else{
      for(var b=0;b<master.layers[a].layers.length;b++){
      var level2 = master.layers[a].layers[b];
      if(level2.name == "Prepress"){
      level2.locked = false;
      level2.visible = false;
      }
      else if(level2.name == "Information"){
      level2.locked = true;
      level2.visible = true;
      }
      }
      }
      }
    
    
    
    
    
    
    
    
    }
    copyToMaster();
    copyToMaster = null;
    

    How is that?

    function duplicateToMaster(){
        function pasteInMaster(){
            if(app.pasteRemembersLayers === false){
                app.pasteRemembersLayers = true;
                app.executeMenuCommand('pasteInPlace');
                app.pasteRemembersLayers = false;
            }else{
                app.executeMenuCommand('pasteInPlace');
            }
        }
    
    var aDoc = app.activeDocument;
    app.executeMenuCommand('selectall');
    app.executeMenuCommand('copy');
    var bDoc = app.documents[1];
    bDoc.activate();
    pasteInMaster();
    }
    duplicateToMaster();
    
  • Need help: loop of pl/sql with UTL_FILE reading and analysis of file text 2

    Hello, I am working on a new project using the UTL_FILE utility in oracle 11 g. and I was wondering if someone could help me with a pl/sql code, I can't understand.
    My goal is to open and then read a Type_de_fichier file1.txt
    copy a specific paragraph of the file1.txt where
    the first word in a specific line in the file1.txt starts with "foo" then when the last word in fichier1.txt ends in 'ZEN'
    write to file2.txt only the analysis section in my where statement.
    I don't know if it's possible, but any guidance will greatly appreciate!

    My code example:

    CREATE OR REPLACE PROCEDURE my_app2 IS
    Utl_file.file_type inFile;
    OutFile utl_file.file_type;
    buffer VARCHAR2 (30000);
    BEGIN
    -Open a file to read
    InFile: = utl_file.fopen ('TEST_DIR', 'mytst.txt', 'r');
    -Opens a file for writing
    OutFile: = utl_file.fopen ('TEST_DIR', "Out.txt", "w");

    -Check the file is open
    IF utl_file.is_open (InFile) THEN
    -lines in the file in loop
    LOOP
    BEGIN
    UTL_FILE.get_line (InFile, buffer);
    -Write to out.txt
    UTL_FILE.put_line (OutFile, buffer, FALSE);
    UTL_FILE.fflush (outfile);

    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    EXIT;
    END;
    END LOOP;
    END IF;
    UTL_FILE.fclose (INFILE);
    UTL_FILE.fclose (outfile);
    EXCEPTION
    WHILE OTHERS THEN
    RAISE_APPLICATION_ERROR (-20099, "UTL_FILE Unknown Error");
    END my_app2l;
    /

    Hello

    According to the code should work-

    CREATE OR REPLACE PROCEDURE my_app2 IS
       infile              utl_file.file_type;
       outfile             utl_file.file_type;
       buffer              VARCHAR2(30000);
       b_paragraph_started BOOLEAN := FALSE; -- flag to indicate that required paragraph is started
    BEGIN
       -- open a file to read
       infile := utl_file.fopen('TEST_DIR', 'mytst.txt', 'r');
       -- open a file to write
       outfile := utl_file.fopen('TEST_DIR', 'out.txt', 'w');
    
       -- check file is opened
       IF utl_file.is_open(infile)
       THEN
          -- loop lines in the file
          LOOP
             BEGIN
                utl_file.get_line(infile, buffer);
    
                IF buffer LIKE 'foo%' OR b_paragraph_started
                THEN
                   --write to out.txt
                   utl_file.put_line(outfile, buffer, FALSE);
                   b_paragraph_started := TRUE;
                END IF;
    
                IF buffer LIKE '%ZEN'
                THEN
                   b_paragraph_started := FALSE;
                END IF;
                utl_file.fflush(outfile);
    
             EXCEPTION
                WHEN no_data_found THEN
                   EXIT;
             END;
          END LOOP;
       END IF;
       utl_file.fclose(infile);
       utl_file.fclose(outfile);
    EXCEPTION
       WHEN OTHERS THEN
          raise_application_error(-20099, 'Unknown UTL_FILE Error');
    END my_app2l;
    /
    

    What I've done here is added a new Boolean variable. Loop in each iteration after reading one line, we check if the line starts with "foo". If yes then set the Boolean variable and writing out the startup file until we get a line that ends with "ZEN." That way even if there are several paragraphs in an input file starting with foo and ending with ZEN, then those should get copied to the output file.

    Hope this helps,

    -Gregory

  • Small loop Board problem

    Hey guys I'm reteriving a value using the getitemAt and insertion in a loop

    Now, I want to get this answer and store it in a table. I use additemAt but it doesn't seem to work. (im probably something missing :/) The data area of the table where I want to save is the following

    < mx:DataGridColumn dataField = "Num_Mach" headerText = "Machines" / >

    Here is the code

    for (var x: int = 0; x = 4; x ++) {}

    Servicetimes = int (ProcessAdder.getItemAt (x). Service_Rate)

    for (var NoMachines:int = 1; ValueRow > 100; NoMachines++)

    {

    PartProduced = Servicetimes * NoMachines

    ValueRow = 100 *(ArrivalParts/PartProduced)

    }

    NoMachines = NoMachines-1;

    ProcessAdder.addItemAt({Num_Mach:NoMachines});)

    }

    Thank you for the charges

    Gug88,

    Your code is a lot of bad things.

    First of all the variables and functions are NEVER appointed by a capital letter at the beginning - you should always use a lowercase letter at the beginning when naming variables and functions. Things that begin with a capital letter are Classes or constants.

    You should not rely on the value of a variable to loop the loop is completed.

    If you're going to have to add an element to a specific location, you must say where this place is.

    It is not clear if it is an array or ArrayCollection collection.

    You can set a value of just table by processAdder [someIndex] = {Num_Mach:NoMachines};

    For a collection of ArrayCollection is processAdder... addItemAt ({Num_Mach:NoMachines}, someIndex);

    The documentation from Adobe is excellent - spend time looking for how things work.

    Paul

  • Need help with the procedure variable

    Hi guys,.

    I try to get the list of the TableName of a specific table and store it in a variable and use this variable to LOOP and remove specific data in the table. Here is my code, maybe that will be clearer...

    This procedure within a package

    PROCEDURE DeleteData (parCONTR_NBR IN VARCHAR2)
    AS
    v_TableName CMSR_MAPPING. TABLE_NAME % TYPE;

    BEGIN
    Extract the names of the tables
    SELECT TABLE_NAME
    IN v_TableName
    OF CMSR_MAPPING
    WHERE TABLE_TYPE <>'W '.
    AND ORDER_SEQ <>' 0'
    ORDER BY ORDER_SEQ DESC
    ;

    -Loop on the name of the table
    FOR v_Index in 1... v_TableName.Count LOOP
    -Check that the table name and remove from the respectable table -.
    CASE v_TableName (v_Index)
    WHEN "CMSW_CONTR" THEN
    REMOVE FROM CMSW_CONTR
    WHERE CONTR_NBR = parCONTR_NBR;
    WHEN "CMSW_AMNDS" THEN
    REMOVE FROM CMSW_AMNDS
    WHERE CONTR_NBR = parCONTR_NBR;

    END CASE;

    END LOOP;

    END;

    When I run it, I get the following compile on this line error of TO v_Index IN 1.. v_TableName.COUNT LOOP:
    PLS-00487: Invalid reference to the variable 'V_TABLENAME '.

    Can someone help with this? What I'm doing wrong here?

    Like this?

    /* Formatted on 5/20/2011 12:37:05 PM (QP5 v5.149.1003.31008) */
    CREATE OR REPLACE PROCEDURE DeleteData (parCONTR_NBR IN VARCHAR2)
    IS
    BEGIN
       FOR c IN (  SELECT TABLE_NAME v_TableName
                     FROM CMSR_MAPPING
                    WHERE TABLE_TYPE != 'W' AND ORDER_SEQ != '0'
                 ORDER BY ORDER_SEQ DESC)
       LOOP
          -- Verify the table name and delete in respectable table --
          --( I always hate when my tables aren't respectable !)
          CASE c.v_TableName
             WHEN 'CMSW_CONTR'
             THEN
                DELETE FROM CMSW_CONTR
                      WHERE CONTR_NBR = parCONTR_NBR;
             WHEN 'CMSW_AMNDS'
             THEN
                DELETE FROM CMSW_AMNDS
                      WHERE CONTR_NBR = parCONTR_NBR;
          END CASE;
       END LOOP;
    END;
    

    Obviously I don't have your data and do not know exactly what is the whole procedure
    but you could not do?

    /* Formatted on 5/20/2011 12:49:07 PM (QP5 v5.149.1003.31008) */
    CREATE OR REPLACE PROCEDURE DeleteData (parCONTR_NBR IN VARCHAR2)
    IS
    BEGIN
       DELETE FROM CMSW_CONTR
             WHERE CONTR_NBR = parCONTR_NBR
                   AND EXISTS
                          (SELECT 1
                             FROM CMSR_MAPPING
                            WHERE     TABLE_TYPE != 'W'
                                  AND ORDER_SEQ != '0'
                                  AND table_name = 'CMSW_CONTR');
    
       DELETE FROM CMSW_AMNDS
             WHERE CONTR_NBR = parCONTR_NBR
                   AND EXISTS
                          (SELECT 1
                             FROM CMSR_MAPPING
                            WHERE     TABLE_TYPE != 'W'
                                  AND ORDER_SEQ != '0'
                                  AND table_name = 'CMSW_AMNDS');
    END;
    

    Published by: pollywog may 20, 2011 12:49

  • Using the loop will decrease performance

    Hello
    Using the loop with a query will decrease performance.

    for r_row in (select * from table) Loop
    end of loop.

    This is done within another loop for, more cases, it returns a single value.
    It will decrease the performance of the procedure.
    kindly advice...

    Kind regards
    Balu

    user575682 wrote:
    Using the loop with a query will decrease performance.

    for r_row in (select * from table) Loop
    end of loop.

    This is done within another loop for, more cases, it returns a single value.
    It will decrease the performance of the procedure.

    Perhaps better understand everything that makes this PL/SQL loop construction.

    PL/SQL is two languages. It's PL (logic programming code) like Pascal, C or Java. You can use a 2nd language in it called SQL. The PL engine will be able to recognize when the 2nd language is used. And it compiles all the things that are necessary for motor PL call the SQL engine, pass the data to the SQL engine and get back data, etc. (compare this with the complexity of the use of SQL in Pascal, C or Java language).

    So what's this loop? The PL engine recognizes the SQL SELECT statement. It creates an implicit cursor by calling the SQL engine to analyze (I hope a soft Parser), then run it.

    As part of the loop of the PL, the PL engine now calls the SQL engine to extract data (lines) of the cursor. With 10g and later, the engine of the PL is smart enough to use the implicit treatment in bulk.

    Before 10 g that he used to extract a line from the SQL engine, make the loop, the next line extraction, the loop, etc. In other words, if there is a 1000 lines to pick up, he'll call the SQL engine after 1000.

    With 10g and later he get a 100 lines, which store in a buffer internal and then make the loop once 100. With a 1000 lines to fetch, it requires 10 extractions in bulk instead of one 1000 rank of extractions.

    These extractions require a change of context - as the engine PL must not out back, and in the SQL engine to extract a line. It is an overhead projector and can become so slow the context switch nothing more.

    And it's the construction of bases for this loop (and most other cursor loops) in PL/SQL.

    The ideal is to reduce the number of context switches. It is an overload that can have an impact on performance.

    What about using a loop in a loop. As 'bad '. This example uses the outer loop to retrieve the data. These data are then used to excite the extraction in internal or nested loop. The outside loop draws data from the SQL engine in PL variables Inside loop drives that same data back to the SQL engine.

    Why? It would have been much faster not to pull and push data between the loops using PL.

    It will be much faster do so only through SQL. Write the two loops as a single SQL statement and have the SQL engine directly driving these loops itself. This is called a JOIN in SQL. And the SQL engine can do not only more quickly, but it has a few algorithms of multiplied can be used which are even faster than a nested loop process (called merge joins, hash joins, etc.).

    Bottom line. Optimize SQL. Reduce to a minimum the PL. *

    Do as much of your data, crunch in SQL as possible. SQL is the fastest 'place' and process the data. No PL (or C/Pascal/Java).

  • How can I change a table 1 d to something?

    I am creating a state machine using a 2 X 13 matrix and loop for to transfer a line of binary data to the output lines of the wizard DAQ (see attachments)

    Tutorials, context-sensitive help, Labview help is for me.

    The variable N loop For is a table 1 d.  How can I convert the entire element of 32 bits for the entrance to the function "subset of the table.  How can I change the function of the subset of the Array' expected as input by the DAQ Assistant output to 1 D array?  Why is the variable N of the loop For a 1 d array?

    Nothing you have is correct. First of all, you have not a matrix. A matrix is a special type in LabVIEW. You do not have 2 x 13 is array. You have a table 14 d. I really have no idea how you have created that. What you want is a table of 5 x 13-5 columns for each of your digital lines and 13 for the number of models that you want to run. The loop you have is to display the values of the terminal - i not the n Terminal. When you exit a loop for example, the default is to autoindex the output and create a table.

    To put it simply, create a correct Boolean array and simply connect in a loop with the DAQ Assistant, inside.

  • Apex 4.0 - field in DB containing CLOB with HTML code

    Hi thare

    I'm on Apex Oracle 11.2 4.0.0

    I want to display the content of a CLOB in Apex... This is HTML and I want to have the display of the page HTML (as in Explorer) - could be a blank page or within the apex
    the CLOB contains more data then 32K

    The file is not mine - so no possibility to change the layout :-)

    Any ideas how to make this happen?

    concerning
    Mette

    Edited by: Mettemusens2 2011-10-29 09:18

    Have a region of pl/sql and have a loop to process each line, the html code with a call to htp.p () with the contents of package?

    Select the contents of the clob in a local variable
    to loop through the CLOB line-by-line
    wrap the content in a call to htp.p)

    Thank you

    Tony Miller
    Raleigh, NC

Maybe you are looking for

  • How Downgrade Satellite A100-411 for Windows XP Home edition?

    Hello I just bought this laptop soft which has Windows Vista installed.Unfortunately, I have to install Windows XP, but in the download section there is no drivers yet for this specific model series called PSAARE. Are there other drivers series there

  • Re: Satellite L855 - max with newer SSD speed

    I am looking to buy this mobile+ The message was edited: broken link has been removed. (Croatian language, but will help) I wonder if it is SATA 6 Gbit/s so I can buy newer SSD to use max speed? Thank youMario

  • P6-2335ea: failure of DST short hard drive

    Hello I did a fast hard drive test and the DST short hard drive failed, Failure ID: 98EKU4-0007TB-X87T0K-60W803 A fast response is appreciated with kindness Thank you Model number P6-2335ea Product ID c3T84EA #ABU

  • Cannot step 3 of 3 for Vista updates

    I have a number of Vista updates that will not be installed.  A site to help/support windows was a suggestion that you could install manually by going to the Microsoft Vista download site.  So, I chose the 2 most old and manually, and to install seve

  • To recover items deleted

    original title: deleted items is it possible to recover items that were deleted from the Recycle Bin?