Creating tables in a nested for loop

Hi all.

I was stuck in this problem for quite a while now and I still don't know how to continue. Some outside the entrance would be greatly appreciated!

I'm doing the following:

-Take an array of numbers, to check if they are within a certain range (e.g. between 2 and 4)

-Build two new arrays: one with all the numbers that are inside the beach and the other with the rest.

An additional condition is that the amount and value of the range conditions will change (for example, it could be between 2 and 4 only / 2, 4 AND 6 and 7 according to the entry)

To treat this, I created two nested for loops - one that goes on a table that contains conditions of the beach and inside that actually go and check if the values are in the range. I think I did that part successfully, but the next part is confusing to me - how to actually create the tables separated within two loops for?

My apologies if I did not explain it well. Another method to support this problem is I want to translate following LabVIEW:

Ranges of table / / [1 5 7 10] exodus-> This means we want to divide numbers based on those who are in (1,2) and (4.5) against those who are not

Table of values / / [2 3 6 11 3]

EndOperationDelegate table / / array of values within the range
Table outValues / / Array of values out of range

for m = 1:size (ranges)

for n = 1:size (values)
If (THE NUMBER IS on the INSIDE of EACH RANGE)
EndOperationDelegate = [EndOperationDelegate NEWNUMBER]
on the other
outValues = [outValues NEWNUMBER]
end

end
end

Sounds easy enough, but it gets so chaotic with Labview that I don't know what to do. I have attached a reference image - insertion in the array function is not in fact add to the table, it creates a new table. How can I save that for when the nested for the ends of the loop?

I have seen a few examples with shift registers which lie in a loop and I couldn't successfully that transfers in my block diagram.

Any help/direction would be greatly appreciated.

Hello!

See the following example to understand how you can create a table in the loop For

In your case, you also can uce conditional terminal to create a table only when then located nearby. It makes the code much cleaner that the structures of the case

Hope this helps, if not, let me know if I can help you!

Marcin

Tags: NI Software

Similar Questions

  • 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;
                                  }
                        }
              }
    }
    
  • Capture of sequences of images - issues with nested for loops

    Hi all

    I've written a vi. to capture a number of images ("Image") and save these images, sent to a folder of my choice.  Each image is identified sequentially.  However, I would like to make a number of iterations ("run") of this capture sequence, such that each image file name would be "Filename (Run) _(Image_No).png", for example run 5, image 10 'Filename 5_10.png.  I tried a nested for loop for this but I have an error message 'Current asynchronous i/o Operation' (I have attached a printscreen).

    Can someone help me solve this problem?  Please find attached my vi.

    Sincere greetings and thanks,

    Miika

    Hi toto26,.

    Thank you for your response.  I solved the problem by using a sequence structure flat - file in the first image and all the treatment in the second.

    Kind regards

    Miika

  • Nested for loops EACH in the XML editor

    I have a xml like this.

    <?xml version="1.0" encoding="UTF-8"?>
    <DATA_DS>
         <Line_Approver>
              <getLineNumberAssigneesResponse>
              <result>
                    <LineNumber>1</LineNumber>
                    <Assignees>One</Assignees>
               </result>
              <results>
    
                   <LineNumber>2</LineNumber>
                   <Assignees>Two</Assignees>
              </result>
    
              </getLineNumberAssigneesResponse>
         </Line_Approver>
    <DATA_DS>
         <HEADER>
         <INVOICE_ID>300100071480733</INVOICE_ID>
         <AMOUNT>1111</AMOUNT>
         <INVOICE_CURRENCY_CODE>USD</INVOICE_CURRENCY_CODE>
         <INVOICE_NUM>100</INVOICE_NUM>
         <INVOICE_DATE>2015-11-13T00:00:00.000+05:30</INVOICE_DATE>
         <PAYMENT_CURRENCY_CODE>USD</PAYMENT_CURRENCY_CODE>
         <ORG_ID>204</ORG_ID>
         
         <INVOICELINES>
                  <LINE_NUMBER>1</LINE_NUMBER><LINE_TYPE>Item</LINE_TYPE><AMOUNT>1000</AMOUNT><INVOICE_ID>zzz</INVOICE_ID><EXPENDITURE_ITEM_DATE></EXPENDITURE_ITEM_DATE>
         </INVOICELINES>
         <INVOICELINES>
              <LINE_NUMBER>2</LINE_NUMBER><LINE_TYPE>Item</LINE_TYPE><AMOUNT>111</AMOUNT><INVOICE_ID>300100071480733</INVOICE_ID><EXPENDITURE_ITEM_DATE></EXPENDITURE_ITEM_DATE>
         </INVOICELINES>
         </HEADER>
    
    <some more xml/>
    </DATA_DS>
    
    </DATA_DS>
    

    As you can see there are two results and and two invoice lines.

    I want to create a table of invoice lines for which the line number is present in the result.

    So my psudo code is as follows

    for each in result:
         assign result.linenumber to variable
         for each in InvoiceLines:
              compare the InvoiceLines.Line_number to variable:
                   if match print row.
    

    I know I won't have access to the LineNumber result with in second forloop because of the determination of the lexical scope.

    Far from assignment, I am unable to get the value of the number of the line itself.

    I tried two methods of application for with in what work force. The underside of work that uses the absolute path.

    What xpath Miss. Can I do better?

    FOR1: <?for-each:/DATA_DS/Line_Approver/getLineNumberAssigneesResponse/result?>
    
    FOR2: <?for-each:/DATA_DS/DATA_DS/HEADER/INVOICELINES?>
    

    LINE_NUMBER

    LINE_TYPE

    AMOUNT

    For 1 <? LineNumber? > 2 LINE_NUMBER

    LINE_TYPE

    AMOUNT ENDFOR1 ENDFOR2

    I think I gave enough information. Answer just in case I did not say anything clearly.

    You can do this via a simple foreach loop and the code would be

    Please see the data XML and RTF attached for your reference.

    I changed the data in XML format (I added 10 instead of 1) just to make sure that its works or not, and it works very well.

  • nested for loop in the collection

    Hi Experts,

    Collection1

    ============

    SELECT o.object_id

    LOOSE COLLECTION l_obj_info

    FROM (SELECT n.node_id, n.object_id

    N nodes

    START WITH n.node_id = 100

    N.node_id CONNECT BY PRIOR = n.parent_node_id) n

    JOIN IN-HOUSE

    objects o ON o.object_id = n.object_id

    WHERE o.object_type_id = 285;

    s Collection2

    ============

    SELECT *.

    LOOSE COLLECTION l_tab

    OF ((SELECT REGEXP_SUBSTR (i_l_text, "[^,] +', 1, NIVEAU)))

    OF THE DOUBLE

    CONNECT BY REGEXP_SUBSTR (i_l_text, "[^,] +', 1, LEVEL") IS NOT NULL));

    END;

    collection3

    ============

    SELECT o.object_id

    LOOSE COLLECTION l_fin_tab

    Of objects o JOIN ATTRIBUTES att

    ON o.object_id = att.object_id

    WHERE o.object_id = collection1.object_id

    - AND att. VALUE = collection2.val;

    Please tell me how to implement for loop in the collection3 to get the values of collection1 and s collection2.

    I tried in the way below

    CREATE or REPLACE TYPE LIST_OF_ATTRIBUTES_TYPE AS TABLE OF THE varchar2 (4000);

    /

    CREATE or REPLACE TYPE LIST_OF_OBJECT_IDS_TYPE AS TABLE OF THE number (9);

    /

    (F_get_objects_by_type_id) CREATE or REPLACE FUNCTION

    i_object_type_id in NUMBERS

    i_l_text IN VARCHAR2,

    i_scope_node_id NUMBER

    )

    RETURN list_of_object_ids_type

    AS

    CURSOR objs_info

    IS

    SELECT o.object_id

    FROM (SELECT n.node_id, n.object_id

    N nodes

    START WITH n.node_id = i_scope_node_id

    N.node_id CONNECT BY PRIOR = n.parent_node_id) n

    JOIN IN-HOUSE

    objects o ON o.object_id = n.object_id

    WHERE o.object_type_id = i_object_type_id;

    l_tab list_of_attributes_type: = list_of_attributes_type ();

    -l_obj_info list_of_object_ids_type: = list_of_object_ids_type ();

    l_fin_tab list_of_object_ids_type: = list_of_object_ids_type ();

    BEGIN

    BEGIN

    SELECT *.

    LOOSE COLLECTION l_tab

    OF ((SELECT trREGEXP_SUBSTR (i_l_text, "[^,] +', 1, NIVEAU)))

    OF THE DOUBLE

    CONNECT BY REGEXP_SUBSTR (i_l_text, "[^,] +', 1, LEVEL") IS NOT NULL));

    END;

    IF l_tab. COUNT > 0

    THEN

    BECAUSE me IN objs_info

    LOOP

    FOR j IN l_tab. FIRST... l_tab. LAST

    LOOP

    SELECT o.object_id

    LOOSE COLLECTION l_fin_tab

    O JOIN ATTRIBUTES att OBJECTS ON o.object_id =

    att.object_id

    WHERE

    att. VALUE = l_tab (j) and o.object_id = objs_info (i);

    END LOOP;

    END LOOP;

    END IF;

    RETURN l_fin_tab;

    END f_get_objects_by_type_id;

    /

    What this different problem from that of pls 00382 expression is incorrect, as they were returning a record type ?

    Please do not raise the same question several times. The answer is always the same. Your data model is seriously wrong - and that's the reason why you can't get data from it.

  • 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?

  • As sysdba, how to grant create table to a user for a particular tablespace?

    I did the PRACTICE tablespace and user SEAN. How can I give SEAN the privilege to create a table in the practical tablespace?

    CREATE TABLESPACE PRACTICE
    DATA FILE
    ' F:\DBM\FALLB\DB2046\ORACLE\ADMIN\ORAC...
    SIZE 20 M
    DEFAULT STORAGE OF DICTIONARY OF MANAGEMENT MEASURE (1 M INITIAL FOLLOWING 1 M MAXEXTENTS 20 PCTINCREASE 0);

    CREATE USER SEAN
    IDENTIFIED BY SEAN
    PRACTICE OF TABLESPACE DEFAULT;
    GRANT CREATE SESSION TO SEAN;

    -----------------------------------------------
    -----------------------------------------------
    SEAN GRANT SYSDBA;
    +
    Sean/[email protected] CONNECT as sysdba

    Works, but what happens if I don't want SEAN have sysdba privileges?

    -----------------------------------------------
    -----------------------------------------------
    Another question would be if I don't give SEAN sysdba privileges and then I connect like sean and then perform a
    SELECT * FROM TAB;
    to display the available tables, how can I do so that I can only see the paintings I do myself instead of all tables in the database?

    Hello

    Connect as sys and grant after privs to SEAN, I added a few privileges as well.

    Do not give any user other than SYS sysdba priv, unless you intend to use user SEAN as a user administrative addition to SYS.

    GRANT RESOURCE TO SEAN;
    GRANT CONNECT TO SEAN;
    GRANT CREATE SESION TO SEAN;
      -- GRANT UNLIMITED TABLESPACE TO SEAN;
    GRANT CREATE VIEW TO  SEAN;
    GRANT CREATE PROCEDURE TO SEAN ;
    GRANT CREATE TABLE TO SEAN
      -- 1 Tablespace Quota for SEAN
    ALTER USER  SEAN QUOTA UNLIMITED ON PRACTICE;
     
    

    Concerning

  • 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

  • Problems with nested for loops - save images from a camera


    Dear Norbert_B,

    Thank you for your response.  I solved the problem by using a sequence structure flat - file in the first image and all the treatment in the second! Easy as pi!

    Kind regards

    Miika

  • nested for loop

    I have positioning XY with two different controllers.

    the time of execution of these two controllers are different.

    I have attached block digram to understand. In highlight mode, code works very well... but in execution mode, step there gets delayed a little and moves with X stage.

    How can I make sure movement of steps one after the other.

    Thank you

    A simple data dependency is expected to create the design.

    Lynn

  • Create a directory tree: how to call a global function from inside a for loop

    Hello

    I am trying to create a workflow that will create a directory tree in vCenter.

    Concept:

    Basically, I am trying to execute nested for loops for each level of the tree to the caller a global tree.

    Problem:

    The 1st loop for works and creates the file 'Dev '.  The second loop for does not work with error message:

    [19:16:16.219 2013-06-27] [I] building Dev folder
    [19:16:16.474 2013-06-27] [I] directory Built: Dev
    [19:16:16.476 2013-06-27] [I] the records building servers
    [19:16:16.480 2013-06-27] [I] TypeError: cannot find the createFolder function in dev object. (Workflow: TEST_TNG_New_Site_Folder_Structure / Scriptable task (item2) #36)

    I think it has to do with JavaScript not being not able to call a global function in a nested object (I'm not a programmer and don't know JavaScript, so don't shoot me on that :)

    Code: (will clean this up once I do work)

    var folderBase is ['Dev', 'DMZ', 'Prod', 'UAT'];.

    var folderT1 = ["servers", "Jobs"];

    var folderT2 = ['Window', 'Linux'];

    var folderT3 is ["Repo2', 'Repo3', 'Repo1', 'Repo4'];.

    var folderT4 is ["T1", "T2", "T3"];.

    Create the files folderBase level

    for (var i = 0, l = folderBase.length; i < l; i ++) {}

    var rootFolder = parentFolder;

    buildFolderTree (folderBase [i]);

    Create the files folderT1 level

    for (var j = 0, l = folderT1.length; j < l; j ++) {}

    var rootFolder = folderBase [i];

    buildFolderTree (folderT1 [j]);

    Create the files folderT2 level

    for (var k = 0, l = folderT2.length; k < l; k ++) {}

    var rootFolder = folderT1 [j];

    buildFolderTree (folderT2 [k]);

    Create the files folderT3 level

    for (var x = 0, l = folderT3.length; x < l; x ++) {}

    var rootFolder = folderT2 [k];

    buildFolderTree (folderT3 [x]);

    Create the files folderT4 level

    for (var y = 0, l = folderT4.length; y < l; y ++) {}

    var rootFolder = folderT3 [x];

    buildFolderTree(folderT4[y]);

    }

    }

    }

    }

    }

    function buildFolderTree (folderName) {}

    System.log ("Building folder" + folderName);

    rootFolder.createFolder (folderName);

    System.log ("directory of frame:" + folderName);

    }

    Any help will be appreciated.

    Thank you

    B

    Hello

    The createFolder() method returns the object VcFolder to the folder just created, for the new file to be used immediately.  Here is how I modified the code:

    Create the files folderBase level
    for (var i = 0; i)
    var newBaseFolder = buildFolderTree (parentFolder, folderBase [i]);
    Create the files folderT1 level
    for (var j = 0; j)
    var newT1Folder = buildFolderTree (newBaseFolder, folderT1 [j]);
    Create the files folderT2 level
    for (var k = 0; k)
    var newT2Folder = buildFolderTree (newT1Folder, folderT2 [k]);
    Create the files folderT3 level
    for (var x = 0; x)
    var newT3Folder = buildFolderTree (newT2Folder, folderT3 [x]);
    Create the files folderT4 level
    for (var y = 0; y)
    var newT4Folder = buildFolderTree (newT3Folder, folderT4 [y]);
    }
    }
    }
    }
    }

    function buildFolderTree (parentFolderObj, folder_name) {}
    System.log ("Building folder" + folderName);
    var newFolder = parentFolderObj.createFolder (folderName);
    System.log ("directory of frame:" + folderName);
    return NewFolder;
    }

  • create table as a table with nested column type

    On my Oracle DB (11.1), I have a table with a nested as a column type (and it is a partitioned table).
    Now I need to copy partitions in a second table, and I use swap partition for it (with a table that is not partitioned as a table in step).

    But there is a problem, because as the ordinary as sql ddl:
    create table table1_stage as select * from table1 where 1=2;
    does not work when there is a table nested within a column type.
    Is it possible easy to copy its structure (and to create the table that is not partitioned, so I suppose that no dbms_metadata package would help)?


    Kind regards...

    >
    does not work when there is a table nested within a column type.
    >

    Will work indeed.

    Read this

    SQL> CREATE TYPE typtst IS TABLE OF VARCHAR2 (100);
      2
      3  /
    
    Type created.
    
    SQL> CREATE TABLE test1
      2  (
      3     col1   VARCHAR2 (100),
      4     col2   typtst
      5  )
      6  NESTED TABLE col2
      7     STORE AS list1;
    
    Table created.
    
    SQL> CREATE TABLE test2
      2  NESTED TABLE col2
      3     STORE AS list2
      4  AS
      5     SELECT * FROM test1;
    
    Table created.
    
    SQL> 
    

    G.

  • what need parameter should be ignored for creating table in LMT

    Hi all

    I have locally managed tablespace (LMT) with the type of ventilation SYSTEM and segment_space_management is AUTOMATIC. My database is Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi.

    I have for example:

    create table (ID)
    PCTFREE 5
    INITTRANS 2
    STORAGE (Initial...).


    Oracle documnetation, I found that it is recommended to omit the storage clause when you use LMT.

    I want to know, I do also omit PCTFREE 5, INITTRANS 2 of the create table statement?

    Thanks for any advice.

    Dear spur230,

    Yes, you can omit these parameters either.

    Here's the answer to your question;

    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14231/tspaces.htm#sthref1153

    +"+
    * + Creating a locally managed Tablespace + *.

    + Create a locally managed tablespace by specifying IN clause of the CREATE TABLESPACE statement SCOPE MANAGEMENT. This is the default value for new permanent storage space, but you must specify the EXTENT MANAGEMENT LOCAL clause if you want to specify the AUTOALLOCATE or the UNIFORM clause. You can have the database to manage extensions for you automatically with the clause AUTOALLOCATE (default), or you can specify that the tablespace is managed with uniform extents of a specific size (UNIFORM). +

    + If you plan the tablespace contains objects of various sizes, requiring many scopes with different sizes, then AUTOALLOCATE is the best choice. AUTOALLOCATE is also a good choice if it is not important for you to have a lot of control over the allocation of space and the deallocation, because it simplifies the management of the table space. A space may be wasted with this parameter, but the advantage of having the Oracle database manage your space probably outweigh this disadvantage. +

    + If you want exact control on unused space, and you can predict exactly the space to allocate for an object or objects and the number and size of extensions, and then UNIFORM is a good choice. This setting ensures that you will never have the unusable space in your tablespace. +

    * + When you do not explicitly specify the type of management, database Oracle determines management extended as follows: + *.

    + * _If the CREATE TABLESPACE statement omits the DEFAULT storage clause, then the database creates a locally managed tablespace autoallocated. _ +
    + * _If the CREATE TABLESPACE statement includes a default storage clause, then the database considers the following: _ +.
    + O _If you specified AS MINIMUM clause, the database evaluates if MEASURE MINIMUM values, INITIAL, FOLLOWING are equal, and the value for PCTINCREASE is 0. If so, the database creates a locally managed tablespace uniform with size = INITIAL measurement. If the parameters to MEASURE MINIMUM INITIAL and NEXT are not equal, otherwise PCTINCREASE is not 0, the database ignores storage extent parameters you specify and creates a locally managed tablespace autoallocated. _ +
    + o _If you have not specified a MEASURE MINIMUM clause, the database evaluates only if the values of storage are the same INITIAL and NEXT and PCTINCREASE is 0. If so, the tablespace is locally managed and uniform. Otherwise, the tablespace is locally managed and autoallocated. _ +

    + The following statement creates a managed tablespace locally named lmtbsb and specifies AUTOALLOCATE: +.

    + CREATE TABLESPACE lmtbsb DATAFILE ' / u02/oracle/data/lmtbsb01.dbf' SIZE 50 +.
    + EXTENT MANAGEMENT LOCAL AUTOALLOCATE; +

    + AUTOALLOCATE causes tablespace system managed with a volume of minimum extent of 64K. +

    + The alternative to AUTOALLOCATE is UNIFORM. who says that the tablespace is managed with uniform size extents. You can specify the size of the uniform SIZE clause. If you omit the SIZE, the default size is 1 M. +

    + The following example creates a tablespace with uniform extents of 128 K. (In a database with 2 K blocks, each would amount to 64 blocks of data). Each measure 128K is represented by a bit in the bitmap extent for this file. +

    + CREATE TABLESPACE lmtbsb DATAFILE ' / u02/oracle/data/lmtbsb01.dbf' SIZE 50 +.
    + EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128K; +

    + You can not specify the storage, TEMPORARY or MEASURE MINIMUM clause by DEFAULT when you explicitly specify EXTENT MANAGEMENT LOCAL. If you want to create a locally managed temporary tablespace, use the statement to CREATE a TEMPORARY TABLESPACE. +
    +"+

    Hope that helps.

    Ogan

  • Cursor for loop

    Hey Experts,.

    Can we consider cursor for loop as an example of cursor name

    as

    CREATE or REPLACE function TotalIncome (name_in IN varchar2) RETURN varchar2 IS total_val number (6);   cursor c1 is SELECT monthly_income FROM Employees WHERE name = name_in; BEGIN total_val: = 0;   FOR employee_rec in c1 LOOP total_val: = total_val + employee_rec.monthly_income;   END LOOP;   RETURN total_val; END; In this example, we have created

    SShubhangi wrote:

    Can we consider cursor for loop as an example of cursor name

    Laughing out loud

    Your code example explicitly sets a CURSOR variable in the PL/SQL block. Implied things happening opens, fetch and closing the cursor. But that the cursor is declared (in the DECLARE section), it's an explicit cursor - like the whole code block now has a way explicit to reference this slider.

    An approach of implicit cursor would be as follows:

    begin
      for c in(select col1, col2 from table1) loop
        .. do something..
      end loop;
    end;
    

    As you can see - there is no declaration of a cursor variable. A reference implementation is created instead and are accessible only within the construction that creates this reference - that is FOR loop in this case. The rest of the BEGIN... END block cannot refer to this cursor.

    Do not forget the advice of other posters however. In PL/SQL cursor loops is often the WRONG approach to the treatment of data - as it deals with processing (using the PL/SQL) line and not much treatment faster and scalable set of data using SQL only.

  • For loops with the cursor line and indexing

    Hi all

    I have a question about the loops with the cursor, line and indexing.

    How can I scan via a cursor with an iterator?

    I would use an iterator as

    Whole LoopIndex;
    Whole LoopIndex2;

    for LoopIndex at the beginning of the cursor at the end of the cursor
    loop
    line =: cursor [LoopIndex];
    for LoopIndex2 of LoopIndex at the end of the cursor
    etc...
    end loop;

    I need to use an iterator because I need to use a nested for loop.



    OR


    How can I solve the following problem?

    Class name % ofClass average test Score
    1 Niobe 7 8 8.4
    1 alena 4 7 7.5
    1 9 7 8.9 Estia
    1 Lilly 10 8 9.8
    1 Sandra 6 8 8.3
    1 Melanie 8 8 8.1
    Nadia 2 8 3 4.4
    Sayuki 2 9 8 8.4
    Diasy 2 7 8 8.0
    Flower 2 7 8 6.5
    Diana 2 6 8 7.3
    3 Flora 7 8 5.8
    Sukiya 3 4 8 8.4
    Samantha 3 10 8 7.7
    Roxanne 3 7 8 6.9
    Eline 3 8 8 7.4

    I need to
    -By class, I need to recalculate each average people
    -By class, I need to calculate the % of class score (sum averages / people in the class)

    So it can be done in a nested for loop?
    Or do I just step by step?

    Well, based on this information it would be something like...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select 1 as Class, 'Niobe' as Nm, 7 as Score, 8 as Tests, 8.4 as Average from dual union all
      2             select 1, 'Alena', 4, 7, 7.5 from dual union all
      3             select 1, 'Estia', 9, 7, 8.9 from dual union all
      4             select 1, 'Lilly', 10, 8, 9.8 from dual union all
      5             select 1, 'Sandra', 6, 8, 8.3 from dual union all
      6             select 1, 'Melanie', 8, 8, 8.1 from dual union all
      7             select 2, 'Nadia', 3, 8, 4.4 from dual union all
      8             select 2, 'Sayuki', 9, 8, 8.4 from dual union all
      9             select 2, 'Diasy', 7, 8, 8.0 from dual union all
     10             select 2, 'Blossom', 7, 8, 6.5 from dual union all
     11             select 2, 'Diana', 6, 8, 7.3 from dual union all
     12             select 3, 'Flora', 7, 8, 5.8 from dual union all
     13             select 3, 'Sukiya', 4, 8, 8.4 from dual union all
     14             select 3, 'Samantha', 10, 8, 7.7 from dual union all
     15             select 3, 'Roxanne', 7, 8, 6.9 from dual union all
     16             select 3, 'Eline', 8, 8, 7.4 from dual)
     17  --
     18  -- END OF TEST DATA
     19  --
     20  select class, nm as "NAME", score, tests, average
     21        ,round(((average*tests)+score)/(tests+1),1) as avg_person
     22        ,round((average / sum(average) over (partition by class))*100,1) as class_average
     23  from t
     24* order by class, nm
    SQL> /
    
         CLASS NAME          SCORE      TESTS    AVERAGE AVG_PERSON CLASS_AVERAGE
    ---------- -------- ---------- ---------- ---------- ---------- -------------
             1 Alena             4          7        7.5        7.1          14.7
             1 Estia             9          7        8.9        8.9          17.5
             1 Lilly            10          8        9.8        9.8          19.2
             1 Melanie           8          8        8.1        8.1          15.9
             1 Niobe             7          8        8.4        8.2          16.5
             1 Sandra            6          8        8.3          8          16.3
             2 Blossom           7          8        6.5        6.6          18.8
             2 Diana             6          8        7.3        7.2          21.1
             2 Diasy             7          8          8        7.9          23.1
             2 Nadia             3          8        4.4        4.2          12.7
             2 Sayuki            9          8        8.4        8.5          24.3
             3 Eline             8          8        7.4        7.5          20.4
             3 Flora             7          8        5.8        5.9            16
             3 Roxanne           7          8        6.9        6.9          19.1
             3 Samantha         10          8        7.7          8          21.3
             3 Sukiya            4          8        8.4        7.9          23.2
    
    16 rows selected.
    

Maybe you are looking for