Select all the elements in VARRAY

I am being selected in a table where all IDS are in a VARRAY I populated. I searched online and on the forums and cannot find an answer. Help is greatly appreciated.

E.G.

SELECT ID in BULK COLLECT INTO p_ID_1 FROM tbl_name WHERE contained_by = p_ID;
v_id_1: = v_id_1();

I'm IN p_id_1.first... p_id_1.Last LOOP
v_id_1.extend ();
v_id_1 (v_id_1.Last): = p_id_1 (i);
END LOOP;

-so far, my VARRAY is filled very well here's where I have a problem:

SELECT the BULK COLLECT INTO p_id_2 FROM table_name_2 WHERE contained_by IN v_naid_1 ID (1);

Everything works fine when I run the query. The problem is I want the query to select where the contained_by (all ELEMENTS in varray). Not only the first. How can I do this? I do "FIRST" thought "FINALLY" somehow? I can't list all the elements because there may be thousands.

Thank you!

jihuyao wrote:

(not tested)

And will not pass the test. First number uses the COUNT method in SQL:

SQL> declare
  2      v_deptno sys.OdciNumberList := sys.OdciNumberList(10,20);
  3      v_empno sys.OdciNumberList;
  4  begin
  5      select empno
  6        bulk collect
  7        into v_empno
  8        from emp
  9        where deptno in (select v_deptno(level) from dual connect by level < v_deptno.count);
 10      for i in 1..v_empno.count loop
 11        dbms_output.put_line(v_empno(i));
 12      end loop;
 13  end;
 14  /
      where deptno in (select v_deptno(level) from dual connect by level < v_deptno.count);
                                                                           *
ERROR at line 9:
ORA-06550: line 9, column 76:
PL/SQL: ORA-00904: "V_DEPTNO"."COUNT": invalid identifier
ORA-06550: line 5, column 5:
PL/SQL: SQL Statement ignored

This one is easy to fix. But while you'll get:

SQL> declare
  2      v_deptno sys.OdciNumberList := sys.OdciNumberList(10,20);
  3      v_empno sys.OdciNumberList;
  4      v_cnt number;
  5  begin
  6      v_cnt := v_deptno.count;
  7      select empno
  8        bulk collect
  9        into v_empno
 10        from emp
 11        where deptno in (select v_deptno(level) from dual connect by level < v_cnt);
 12      for i in 1..v_empno.count loop
 13        dbms_output.put_line(v_empno(i));
 14      end loop;
 15  end;
 16  /
declare
*
ERROR at line 1:
ORA-06532: Subscript outside of limit
ORA-06512: at line 7

Why? The binding occurs before execution. Mandatory if v_deptno (level) will try to assess the level BEFORE the time of execution and therefore level is not set. Currently (this may change in the next version) before executing Oracle treats level 0, then you could try level + 1. This will not throw an error, but you will get incorrect results:

SQL> declare
  2      v_deptno sys.OdciNumberList := sys.OdciNumberList(10,20);
  3      v_empno sys.OdciNumberList;
  4      v_cnt number;
  5  begin
  6      v_cnt := v_deptno.count;
  7      select empno
  8        bulk collect
  9        into v_empno
 10        from emp
 11        where deptno in (select v_deptno(level + 1) from dual connect by level < v_cnt);
 12      for i in 1..v_empno.count loop
 13        dbms_output.put_line(v_empno(i));
 14      end loop;
 15  end;
 16  /
7782
7839
7934

PL/SQL procedure successfully completed.

SQL> 

As you can see everything we returned is deptno = 10 employees. Why? Because it does not an affair occurs just before the execution, but is also a TIME. That is why the subquery:

Select v_deptno from dual connect by level (level + 1)<>

produces two rows with the same value of v_deptno (0 + 1).

Hope you got the image.

SY.

Tags: Database

Similar Questions

  • Select all the elements with the same name of XMLTYPE

    Hello

    I have the following xml code stored in the XMLTYPE column:

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0  -->
    <!-- 2016-01-02T23:09:52 -->
    <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Blank_A4" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="8f749217-51eb-4c79-9b11-5a3e11b5b1b4">
        <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
        <property name="com.jaspersoft.studio.data.defaultdataadapter" value="MyXE_ssh"/>
        <queryString>
            <![CDATA[select * from dept where deptno=10]]>
        </queryString>
        <field name="DEPTNO" class="java.math.BigDecimal"/>
        <field name="DNAME" class="java.lang.String"/>
        <background>
            <band splitType="Stretch"/>
        </background>
        <title>
            <band height="221" splitType="Stretch">
                <staticText>
                    <reportElement x="7" y="2" width="100" height="30" uuid="2bc03b83-e484-46e5-8681-48a9b01ac437"/>
                    <text><![CDATA[DEPTNO]]></text>
                </staticText>
                <staticText>
                    <reportElement x="160" y="2" width="100" height="30" uuid="3dfc25f3-6ff1-4186-8ee6-c71759a749a7"/>
                    <text><![CDATA[DNAME]]></text>
                </staticText>
                <subreport>
                    <reportElement x="10" y="60" width="544" height="20" uuid="e947974e-27bc-4b90-b0ee-f709b969c91b"/>
                    <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                    <subreportExpression><![CDATA["subreport.jasper"]]></subreportExpression>
                </subreport>
            </band>
        </title>
        <pageHeader>
            <band height="73" splitType="Stretch"/>
        </pageHeader>
        <columnHeader>
            <band height="36" splitType="Stretch"/>
        </columnHeader>
        <detail>
            <band height="35" splitType="Stretch"/>
        </detail>
        <columnFooter>
            <band height="45" splitType="Stretch"/>
        </columnFooter>
        <pageFooter>
            <band height="54" splitType="Stretch"/>
        </pageFooter>
        <summary>
            <band height="44" splitType="Stretch">
                <subreport>
                    <reportElement x="130" y="10" width="200" height="34" uuid="892a1adf-f7e7-4804-8f7f-a5227516afb5"/>
                    <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                    <subreportExpression><![CDATA["rep1/subrep2.jasper"]]></subreportExpression>
                </subreport>
            </band>
        </summary>
    </jasperReport>
    

    Please, is it possible to select all < subreport > items, so the result of a query would be something like:

    <subreport>
                    <reportElement x="10" y="60" width="544" height="20" uuid="e947974e-27bc-4b90-b0ee-f709b969c91b"/>
                    <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                    <subreportExpression><![CDATA["subreport.jasper"]]></subreportExpression>
     </subreport>
     <subreport>
                    <reportElement x="130" y="10" width="200" height="34" uuid="892a1adf-f7e7-4804-8f7f-a5227516afb5"/>
                    <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                    <subreportExpression><![CDATA["rep1/subrep2.jasper"]]></subreportExpression>
    </subreport>
    

    The problem is this subreport sections can be nested more or less anywhere, so I do not know the path. Any suggestions would be much appreciated.

    Thank you

    Pavel

    The XPath ' / /' means selects nodes in the document from the current node that match the selection, regardless of where they are.  If the XPath ' / / the subreport ' will extract all nodes called subreport wherever they are in the document or not.  So something like...

    data (donnees_xml))

    Select xmltype)

    '

    "http://JasperReports.sourceforge.net/JasperReports" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" "xsi: schemaLocation ="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"name ="Blank_A4"pageWidth ="595"pageHeight = columnWidth"842"="555"leftMargin ="20"rightMargin ="20"topMargin ="20"bottomMargin ="20"uuid ="8f749217-51eb-4c79-9b11-5a3e11b5b1b4">

    <p class="reply"> <p class="reply"><band height="221" splittype="Stretch"><p class="reply"> <p class="reply"><staticText><p class="reply"> <p class="reply"><reportElement x="7" y="2" width="100" height="30" uuid="2bc03b83-e484-46e5-8681-48a9b01ac437"></reportElement></p> <p class="reply"><text><![CDATA[DEPTNO]]></text></p> <p class="reply"></staticText></p> <p class="reply"><staticText><p class="reply"> <p class="reply"><reportElement x="160" y="2" width="100" height="30" uuid="3dfc25f3-6ff1-4186-8ee6-c71759a749a7"></reportElement></p> <p class="reply"><text><![CDATA[DNAME]]></text></p> <p class="reply"></staticText></p> <p class="reply"><subreport><p class="reply"> <p class="reply"><reportElement x="10" y="60" width="544" height="20" uuid="e947974e-27bc-4b90-b0ee-f709b969c91b"></reportElement></p> <p class="reply"><connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression></p> <p class="reply"><subreportExpression><![CDATA["subreport.jasper"]]></subreportExpression></p> <p class="reply"></subreport></p> <p class="reply"></band></p> <p class="reply">

    the double)

    Select *.

    from xmltable (XMLNamespaces (DEFAULT 'http://jasperreports.sourceforge.net/jasperreports'),

    ' / / the subreport '

    passage (select donnees_xml data)

    columns

    xmltype subreport path '.')

    SUBREPORT

    http://JasperReports.sourceforge.NET/JasperReports">

    http://JasperReports.sourceforge.NET/JasperReports">

    2 selected lines.

  • How it is possible to create the chekbox in interactive report column header and select all the features.

    Hello

    My requirement is

    Interactive report the first element of box check columns and the topic also point check box.

    If I click on the element of box section columns and then automatically select all the lines in the box.

    Select all / deselect all interactive report header check box.

    Kind regards

    Arianne.

    Check this box

    https://Apex.Oracle.com/pls/Apex/f?p=76604:2:111027941779152:

    username:-test

    password:-test

    SELECT

    APEX_ITEM. HIDDEN (2, null, null, 'f02_': rownum) |

    APEX_ITEM. CHECKBOX2 (P_IDX-ONLINE 01,

    P_VALUE-online null,

    P_ATTRIBUTES-online null,

    P_CHECKED_VALUES => NULL,

    P_CHECKED_VALUES_DELIMITER => ':',

    P_ITEM_ID-online 'f01_ ' | ROWNUM,

    P_ITEM_LABEL => ' label for f01_ #ROWNUM # ')

    as Delete1,.

    of the double

    Choose the column type: report

    in the heading of column delete1

    Simply put

  • How to select all the text, all layers including locked or not visible, using VBScript?

    I'm looking for the more elegant syntax through a document and select all the text frames.

    You cannot select objects in... locked or hidden layers, so you will need to unlock/show layer and do what you need to do with the text, while the layer is visible/unlocked.

    to get all the loop text through the text in the object of the document, you will get all the text elements. If you loop through text in a layer object, you won't get the text located within groups.

  • (PS CS3) Select all the text to change the fill color?

    I have a graphic with text: the text was not inserted by Photoshop, and it is not available as text; It's just a part of the graph.  I would like to change the color of the text.

    I can select each letter and each block of punctuation, etc. by using the magic wand and shift + click on each element.  Is it possible, however, simply select all the text - or at least a line full - with one or two moves or orders, vice boredom with a click on each letter, comma, I dot and so on?

    Ed

    If all letters are the same color, magic wand selects all with a click on a such contiguous is disabled in the panels of options at the top of the screen under the main menu.

  • Is there an easy way to view all the elements of the façade which are hidden in a pragmatic way?

    Hello

    There were some cases where the new indicator that I created was actually overlaps the other indicator which was hidden at the time of development.

    I knew only when the program is operating normally and the hidden indicator will appear on the front panel.

    It would be great if I can see all the elements of hidden façade while in development mode.

    Is there an easy way to do this or am I missing something?

    Thank you.

    Steve

    See here: http://forums.ni.com/t5/LabVIEW/Darren-s-Weekly-Nugget-08-14-2006/m-p/403788

    You can also choose to vote in favour of this idea: http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Show-all-hidden-controls-and-indicators/idi-p/1113431

  • Adding timestamp with all the elements of a 2D array

    Hello

    I want to add a stamp in real time with all the elements of a 2d array before writing on a worksheet. My 2d array consists of amplitude and frequency.

    kindly guide me how to do this.

    Best regards

    RASHID

    That it should be now.

    Kind regards

    Kevin

  • Why all the elements of the array does not appear?

    Hello

    I'm learning about the handling of tables.  The example finder includes this one, 'build array_forum.vi', which shows the two modes, concatenate and adding, I understand, HOWEVER, I can't understand how they built this vi.  For example, I can find the Array function to build, but I do not understand how they created the "digital data table 1" "data table 2" digital... etc, and I can't find the functions on the pallets that cause display "build the CONCATENATE entries table". ".  Where are these blue functions?

    Where these functions are found in the palette, and how we build them like that?

    The other vi indicated here, 'for loop array_forum.vi' is my attempt to reproduce, but it doesn't show all the elements of the array; However, it only displays a SINGLE element, the last element of the array.  How can I view all the items in the table I am creating using the FOR LOOP?  I am doing something wrong with the LOOP FOR?

    Thank you

    Dave

    Right-click your scoreboard, uncheck the "Display as icon" and see what happens.  There are two ways of viewing terminals, most of us like the simple point of view, the default value is the display of the icon.

  • Adding timestamp with all the elements of a table 1 d

    Hello

    I want to add a stamp in real time with all the elements of a 1 d array before writing on a worksheet.

    kindly guide me how to do this.

    Best regards

    RASHID

    Hi rachid,.

    Whence this table? Is a device for the acquisition of data AND measurement data?

    If yes you can just change the type of waveform data, where a timestamp is included.

    However, you can also create a waveform on your table 1 d using construction wavefrom, as here:

    Christian

  • How can I view all the elements of an array?

    Hello

    I'm learning about the handling of tables.  The example finder includes this one, 'build array_forum.vi', which shows the two modes, concatenate and adding, I understand, HOWEVER, I can't understand how they built this vi.  For example, I can find the Array function to build, but I do not understand how they created the "digital data table 1" "data table 2" digital... etc, and I can't find the functions on the pallets that cause display "build the CONCATENATE entries table". ".  Where are these blue functions?

    Where these functions are found in the palette, and how we build them like that?

    The other vi indicated here, 'for loop array_forum.vi' is my attempt to reproduce, but it doesn't show all the elements of the array; However, it only displays a SINGLE element, the last element of the array.  How can I view all the items in the table I am creating using the FOR LOOP?

    Thank you

    Dave

    I think I posted this in the wrong place.  I reposted it on the forum of Labview.

    Dave

  • How to select all the text with QNX TextInput

    With QNX TextInput, is there a way to select all the text? Spark TextInput a selectAll() method to select all text, but I do not see a similar method in QNX TextInput. No idea how you can choose all the texts with QNX TextInput. Thank you.

    Hey French,.

    Thanks for the clarification! I think I can help you. Here is a code example to show my explanation. In the code below when a user clicks the LabelButton object it will assign the focus to your TextInput object and then select all the text in this object. The only downside is that it will not bring the keyboard. so far, we are not successfully by invoking the keyboard without the user clicking on the TextInput. in any case in the code below, we use TextInput property the textField object as a reference to the TextField object internal. from there, we use the setSelection() method to select the text inside the object from the start to the end position pos. Here's the same code:

    package
    {
        import flash.display.Sprite;
        import flash.display.StageAlign;
        import flash.display.StageScaleMode;
        import flash.events.FocusEvent;
        import flash.events.MouseEvent;
    
        import qnx.ui.buttons.LabelButton;
        import qnx.ui.text.TextInput;
    
        [SWF(width="1024",height="600",backgroundColor="#CCCCCC",frameRate="30")]
        public class TextInputTest extends Sprite
        {
    
            private var myInput:TextInput;
    
            public function TextInputTest()
            {
                super();
    
                // support autoOrients
                stage.align = StageAlign.TOP_LEFT;
                stage.scaleMode = StageScaleMode.NO_SCALE;
    
                myInput = new TextInput();
                myInput.setSize(300,50);
    
                addChild(myInput);          
    
                var newBtn:LabelButton = new LabelButton();
                newBtn.label = "Click Me";
                newBtn.setPosition(325, 0);
    
                newBtn.addEventListener(MouseEvent.CLICK, selectMyText);
    
                addChild(newBtn);
    
            }
            private function selectMyText(e:MouseEvent):void
            {
                stage.focus = myInput;
                myInput.textField.setSelection(0, myInput.textField.length);
            }
        }
    }
    

    hope it's what you want. Good luck!

  • Properties tab shows 3609 files, when you select all the files it only shows the files in 1974?

    When I right click and select Properties tab it shows 3609 files, when selecting all the files to copy shows only the files of 1974?

    Hello Tony,.

    If it is certainly a big difference, I think that for most all of this is taken up by folders and subfolders which are mainly empty place holders. Have you looked at the folder with Windows Explorer? A freeware application that can help is WizTree, it provides both a performance graphics and text of what's on your hard drive (or part of it). Can be very educational. Download here: http://antibody-software.com/web/software/software/wiztree-finds-the-files-and-folders-using-the-most-disk-space-on-your-hard-drive/ .

    Let me know if this helps you.

    Kind regards

    BearPup

  • you really need to set up a place to enter bugs.   When you select a page in the Panel of the browser, then select all, the program crashes.   Acrobat CC on el capitan mac.

    you really need to set up a place to enter bugs.   When you select a page in the Panel of the browser, then select all, the program crashes.   Acrobat CC on el capitan mac.

    Hi, Hello, Hello, Hello, bongiorno.

    ==> Feature request/Bug Report Form

    .

  • Select all the script maps

    Hi all

    Hoping someone out there can help, I need my script to end with one of the following 3 options:

    Select all: as in "cmd one"

    Select all the objects on the layer "Tabs".

    Select all the objects with the Script title boxes"tabs".

    Reason being, when the script ends I need a bunch of boxes to be pre-selected loan for a manual deselect by 1 point (chosen by the user) and then they Deletes selected objects manually to finish. (I didn't understand my original script here as has no impact on the autonomous part I need for the final selection)

    Hoping that this is a simple script but as it is rare to have a script of object selection and not do something with them, I think it's impossible to create.

    Thank you, Bren

    Read the object model and you will find that the equivalent script Cmnd + A is as follows:

    app.selection = null;
    pItems = app.windows[0].activeSpread.pageItems;
    app.select (pItems, SelectionOptions.ADD_TO);
    

    To select all items in the layer tab page, filter the items in the page:

    app.selection = null;
    pItems = app.windows[0].activeSpread.pageItems;
    
    for (i = pItems.length-1; i >= 0; i--) {
      if (pItems[i].itemLayer.name === 'Tab') {
        app.select (pItems[i], SelectionOptions.ADD_TO);
      }
    }
    

    To select objects with a certain script label is a variant of the (or an addition to) the second script.

    Peter

  • Error when selecting all the columns in the table

    Hi all

    When I write a query by selecting all the columns of the table fromo using * function as well as another new column, I get the error,

    Select *, to_char (hiredate, 'fmday') day

    WCP

    where to_char (hiredate, 'fmday') ('Monday');

    ERROR on line 1:

    ORA-00923: THE KEYWORD not found where expected

    I need all the columns in the table with the column user-defined 'day '. Is there a way I can get the result like this?

    Hello

    padders wrote:

    Alias table to use...

    Or the name of the table, for example

    Select emp.*, to_char (hiredate, "fmday") as day

    WCP

    where to_char (hiredate, 'fmday') ('Monday');

    The bottom line is that * must be qualified (with a table name or alias) when the SELECT clause includes anything else besides *.

Maybe you are looking for