Question of VARRAY

Hi, we have a table with varray column, and I write a query for the sum of all values in Varray over a period of a month to 1,000 records. A function simple plsql takes 30 sec for 1000 records... Can someone indicate the problem... need for 10,00,0000 time loop... so need more better results...

FUNCTION GETTOTAL

(icustid varchar2, istartdate, istarttime, ienddate, iendtime number number number) return the number of

startidx number (3);

endidx number (3);

Start

startidx: = 1;

endidx: = 24;

to vals in (select readdate, custarray from customers where customerid = icustid and readdate between istartdate and ienddate) loop

Start

-loop on the table-

because me startidx... loop endidx

Total: = total + vals.custarray (i);

end loop;

end;

end loop;

return to the total;

end;

A function simple plsql takes 30 sec for 1000 records... Can someone indicate the problem... need for 10,00,0000 time loop... so need more better results...

I would say that the problem is in the design.

See if a simple approach to SQL performs better in this situation:

Select sum (t.column_value) in the total

customers c

table (c.custarray) t

where c.customerid =: icustid

and c.readdate between: istartdate and: ienddate;

Tags: Database

Similar Questions

  • PLSQL - varray in doubt/question varray

    Hello

    My version of Oracle:
    Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    "CORE 11.2.0.1.0 Production."
    AMT for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production

    Please find the code below:
    --------------------------------------------------------------------------------------------------------------------------------
    create or replace
    procedure p_varray_test
    AS
    t_va_emp_group_sal type is varray (10) number (9);

    t_2d_VA type is varray (2) of t_va_emp_group_sal;
    L2DVAv_test t_2d_VA: = t_2d_VA (t_va_emp_group_sal (11,12,13,14,15,16,17,18,19));

    Start
    L2DVAv_test.extend;
    L2DVAv_test (2) (1): = 21;
    dbms_output.put_line (L2DVAv_test (2) (1));
    end;
    --------------------------------------------------------------------------------------------------------------------------------

    its getting compiled but when I try to run it, I get the following error:
    ORA-06532: index outside the boundary

    Please help me with this problem.

    Now, if I change the code something like this:
    --------------------------------------------------------------------------------------------------------------------------------
    create or replace
    procedure p_varray_test
    AS
    t_va_emp_group_sal type is varray (10) number (9);

    t_2d_VA type is varray (2) of t_va_emp_group_sal;
    L2DVAv_test t_2d_VA: = t_2d_VA (t_va_emp_group_sal (11,12,13,14,15,16,17,18,19), t_va_emp_group_sal (11,12,13,14,15,16,17,18,19));

    Start
    L2DVAv_test.extend;
    L2DVAv_test (2) (1): = 21;
    dbms_output.put_line (L2DVAv_test (2) (1));
    end;
    --------------------------------------------------------------------------------------------------------------------------------
    This code works perfectly fine for me, but I'd like to understand why I get the above error.

    Concerning
    Rahul

    First of all let's start your second example (work):

    L2DVAv_test t_2d_VA := t_2d_VA(t_va_emp_group_sal(11,12,13,14,15,16,17,18,19),t_va_emp_group_sal(11,12,13,14,15,16,17,18,19));
    

    Now you have an "outside" varray initialized with two elements. Each of these two elements are initialized with an 'inner' varray each with 9 elements.

    L2DVAv_test.extend;
    

    The varray "outside" has now been extended with a third element. This third element is not yet initialized.

    L2DVAv_test(2)(1) := 21;
    

    The value of the first element of the varray 'internal' in the second element of the 'outside' varray is changed to 21.
    So "11" in your second term t_va_emp_group_sal is changed to 21.

    ----------------------

    Now your first example:

    L2DVAv_test t_2d_VA := t_2d_VA(t_va_emp_group_sal(11,12,13,14,15,16,17,18,19));
    

    Now you have an "outside" varray initialized with a single element. This single element is initialized with an 'internal' varray each with 9 elements.

    L2DVAv_test.extend;
    

    The varray "outside" has now been extended with a second element. This second component is not yet initialized.

    L2DVAv_test(2)(1) := 21;
    

    L2DVAv_test (2) you will get the second element of the varray 'outside '.
    But this element is not yet initialized, then you cannot reference "the first element of the inner varray" here.
    But it should work after your extension:

    L2DVAv_test(2) := t_va_emp_group_sal(21);
    

    Now, you initialize an 'internal' varray with a single element and affecting who recently initialized varray to become the second element of the varray 'outside '.

  • Retrieve by using the TYPE attribute of the element type VArray

    I want to recover the varray stores through the type attribute type or no matter WHAT work-around.

    for example, our type is defined as SUCH CREATE "READS" AS VARRAY (200) OF NUMBER (21: 6); (reading is with elements of number type varray (21.6))

    READING is a column in a table of INTERVALS. INTERVALS is a central table and we batch on the INTERVALS that are running sql store procedures. In the stored procedure we have hardcoded the declarations of variables mapping to the element type of type VArray of READING which is NUMBER (21: 6); for example, the stored procedure has declarations of variables such as

    NUMBER OF CONSUMPTION (21: 6);

    each Varray definition is changed or varray is deleted and recreated with precision and of different size, ex on number (21.6) past to number (25.9), we need declarations of variables to change in our store to batch process procedures. I am looking for is CONSUMPTION variable declaration, refer to item VArray type. I want something like that

    INTERVALS OF CONSUMPTION. READINGS. COLUMN_TYPE % TYPE; (I want something like this, identify the type of the items stored by varray)

    No problem. Discussions forum flags viewers have read so you don't need to keep posting.

    In response to your question I don't know of a direct method, but it doesn't seem to be syntactically possible to anchor via a SLIDER instead diverted the road % TYPE and % ROWTYPE.

    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    
    SQL> CREATE OR REPLACE TYPE type_name
      2  AS
      3     VARRAY (200) OF VARCHAR2 (3);
      4  /
    
    Type created.
    
    SQL>
    SQL> DECLARE
      2     CURSOR cursor_name
      3     IS
      4        SELECT COLUMN_VALUE column_name
      5        FROM   TABLE (type_name ());
      6
      7     record_name cursor_name%ROWTYPE;
      8
      9     variable_name record_name.column_name%TYPE := 'AAAA';
     10  BEGIN
     11     NULL;
     12  END;
     13  /
    DECLARE
    *
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at line 9
    
    SQL>
    

    However, if you try this with a digital item type precision and scale are not kept and you will end up with a NUMBER.

    I said just a subtype corresponding to the same place, declaring variables, on this basis and do with it.

  • can we use rowtype in varray?

    I try to use a rowtype as content of the varray, I go for collecting information of employees collect table using the majority and trying to assign to a variable created by the data varray type, but I get this error?

    error:
    ORA-06532: index outside the boundary

    Code:

    declare
    abc type is varray (400) employees % rowtype;
    v_emp abc;
    number x: = 1;
    Start
    v_emp:=ABC();
    Select * bulk collect into v_emp of employees;
    loop
    v_emp.extend ();
    dbms_output.put_line (v_emp (x) .employee_id);
    x: = v_emp. Next (x);
    output when x is null;
    end loop;
    end;
    /

    help me with this solution to the question above?

    also tell me
    1. the question of whether we can able to store several values of the column to a variable using varray

    declare
    abc type is varray (400) employees % rowtype;
    v_emp abc;
    number x: = 1;
    Start
    v_emp:=ABC();
    Select * bulk collect into v_emp of employees where rownum<>
    for x in 1.v_emp.count
    loop
    dbms_output.put_line (v_emp (x). (Name)
    end loop;
    end;
    /

  • VARRAY

    HII all

    I created a varray like this

    SQL > desc v_array
    v_array VARRAY (5) OF VARCHAR2 (20)


    n, then I created a table
    SQL > desc vir
    Name Null? Type
    ----------------------------------------- -------- ---------------------

    NO NUMBER OF
    NAME V_ARRAY


    given that v_array column

    My question is that I thought that I could insert only 5 a particular name field name values have number = 1 (say) but I keep on inserting n he crossed the limit of 5 I don't know ny hpnd y 1 explain

    saying that I was
    Insert in the vir values (1, V_ARRAY ('a '));
    Insert in the vir values (1, V_ARRAY ('a '));
    Insert in the vir values (1, V_ARRAY ('a '));
    Insert in the vir values (1, V_ARRAY ('a '));
    Insert in the vir values (1, V_ARRAY ('a '));
    Insert in the vir values (1, V_ARRAY ('a '));
    Insert in the vir values (1, V_ARRAY ('a '));
    Insert in the vir values (1, V_ARRAY ('a '));
    Insert in the vir values (1, V_ARRAY ('a '));
    Insert in the vir values (1, V_ARRAY ('a '));


    as I thought that I could insert only 5 values but I can easily insert these values in this

    NY bdy can it be this hpnd
    SQL> INSERT INTO test_varray VALUES(2,v_array('P','Q','R','S','T'));
    
    1 row created.
    
    SQL> SELECT * FROM test_varray;
    
         EMPNO
    ----------
    ENAME
    --------------------------------------------------------------------------------
             2
    V_ARRAY('P', 'Q', 'R', 'S', 'T')
    
    SQL> /* So it is empno 2 with 5 names in the array. One row in the table*/
    
    SQL> INSERT INTO test_varray VALUES(1,v_array('A'));
    
    1 row created.
    
    SQL> INSERT INTO test_varray VALUES(1,v_array('A'));
    
    1 row created.
    
    SQL> INSERT INTO test_varray VALUES(1,v_array('A'));
    
    1 row created.
    
    SQL> INSERT INTO test_varray VALUES(1,v_array('A'));
    
    1 row created.
    
    SQL> INSERT INTO test_varray VALUES(1,v_array('A'));
    
    1 row created.
    
    SQL> INSERT INTO test_varray VALUES(1,v_array('A'));
    
    1 row created.
    
    SQL> SELECT * FROM test_varray;
    
         EMPNO
    ----------
    ENAME
    --------------------------------------------------------------------------------
             2
    V_ARRAY('P', 'Q', 'R', 'S', 'T')
    
             1
    V_ARRAY('A')
    
             1
    V_ARRAY('A')
    
         EMPNO
    ----------
    ENAME
    --------------------------------------------------------------------------------
             1
    V_ARRAY('A')
    
             1
    V_ARRAY('A')
    
             1
    V_ARRAY('A')
    
         EMPNO
    ----------
    ENAME
    --------------------------------------------------------------------------------
             1
    V_ARRAY('A')
    
    7 rows selected.
    
    SQL> /* So it is 6 rows with empno as 1 and only one item 'A' in the array in each row*/
    SQL> 
    
  • iOS 10 people record problem/question

    Hello

    I have a couple of "faces" in the issue of people who are coming in white, but acknowledged same 'face' of many times.  Is anyway to update it for photo comes actually?  At a few faces, I don't know that facial recognition found since it is coming from white.

    Hi JohnP007,

    Congratulations on your iPhone 7 more running iOS 10! I understand that some of your faces in the album of people pull up as a draft and you want to refresh. You can try to use the steps below to fix the faces on the thumbnails in albums.

    Difficulty faces and names mixed-up

    If you notice that there is a photo of someone in a collection that is poorly identified, you can remove it.

    1. Tap the person you want to remove in the album of people > select.
    2. Type Show done face to emphasize his face in every photo.
    3. Press on each photo that is not the person.
    4. Type > not this person.

    Hide people

    You can hide the people or groups that you don't want in your album of people.

    1. Open the album people and press Select.
    2. Touch the people you don't want to see.
    3. Click Hide.

    If you want to see the people that you have hidden, press on show hidden people.

    People in the Photos on your iPhone, iPad or iPod touch

    This should be corrected without delay faces. Please use the Apple Support communities to post your question. Good day.

  • Questions - and answers forgotten

    How to get my 'secret' answers to the questions that I have noted the way back when?

    If you forgot the answers to your questions of security of Apple ID - Apple Support

  • I can't reset the security questions. We received notice as below:

    Hello world

    I can't reset the security questions. We received notice as below:

    "Cannot reset Security Questions."

    We have insufficient information to reset your security questions. "

    Please help me as soon as possible! Thank you very much.

    Hello

    You will need to contact the Apple Support.

    The information is available here:

    Contact Apple for assistance with the security of the Apple ID - Apple Support accounts

    (I'm afraid that no one here can solve the problem for you - this is a user-based community).

  • Question of cloning for SSD upgrade on 12 Macbook Pro

    Previously, I did an upgrade to SSD on my Macbook Air to 2012 according to the instructions of JetDrive transcend. Basically connection via USB 3 and using Mac OS X to clear (and format) disc utilities new SSD, then restore again SSD and then remove the original 128 GB SSD and insert the new 480 GB SSD.  For about a month and so far without problem.

    Now I'm trying to 2012 Macbook upgrade my Pro partner (on 10.11.6).  I got a Crucial SSD MX300 to replace his HARD drive.  Crucial comes with (or recommend) Acronis software.  And a lot of the messages of the forum recommend Carbon Copy Clone.

    My question is if I can use the same method for the cloning of the HD as my Macbook Air (just restore disk of Mac OS X utilities)?  This time, I'm upgrading HARD drive and I don't know if something is different.  At the same time, if I got lucky the first time, I don't not ruin Macbook Pro my spouse this time.

    Thank you.

    Yes, you can use disk utility to clone your MBP wives, but unlike CCC, it will not clone the recovery and Partition.

  • Question about resolution movie downloads

    If I buy a movie at a certain resolution (780p for example), but I want more later re - download at a higher or lower resolution (SD or 1080 p), can I do so and how?

    Same question perhaps for music. Some of my songs have been bought before the latest Apple codecs.

    Any help is appreciated!

    THX!

    Once you have made a purchase on the iTunes store, you will see your purchased items in the menu under accounts bar > bought. You can simply select the item purchased and re-upload.

    With regard to the resolution of the film for films that are offered, and you select the resolution, you can download it again and select a different resolution. For movies that are available as separate download to SD, 780, or 1080 points, you would be limited to the original resolution you selected.

  • Why I can't ask questions.

    I just have a question.  I said that I can't ask questions.

    Do exactly what you did to make this post, but your question in there instead.

  • Cannot reset the Security Questions

    Hello my dear

    -J' forgot my account security questions, but I remember password

    And I'm changing my Security Questions, but show me this sentence

    "Cannot reset Security Questions."

    We have insufficient information to reset your security questions. "

    -I want to solve this problem as soon as possible if permitted

    You should contact the account of Apple security team. To join, click here and choose a method; If this page does not list one for your country or if you are unable to call, complete and submit this form.

    (145081)

  • Bootcamp Windows 10 question

    Hi all

    Stumbled upon a problem, try to install Windows 10 an end 2014 27' iMac w/retina education runs Yosemite 10.10.5. Bootcamp is V 5.1.4. 32 GB, 3.5 ghz Intel I5. Disk of 1 TB of Fusion. Before you try this, I read the guide of Bootcamp to install windows, but also a number of other tutorials and forum messages about potential problems. This research, I learned that for EDU edition you must change the name of the file from Win10_1607_Education_English_x64.iso to Win10_1607_English_x64.iso. Apparently to have the former name of the file may cause OS X to not recognize the ISO. That fact I started Bootcamp, waited while the software downloaded and created a bootable USB key and partitioned my drive giving Windows 70 GB of space. After that, I got the message that my computer is restarts. Upon restarting, I got the black screen with the blue Windows logo and a spinning loading animation. After a few minutes, a blue screen with a message "Windows has encountered and error with computer and must restart," or something similar. He was pretty quick, so maybe it's not word for Word, but it was not a helpful post in terms of saying something specific. When the computer reboots, I am sent directly to OS X, though a bit slower than normal. I tried to restart with the flash drive to see if the installer would start up, no dice. Try now the Option key at startup, the flash player is not available. Went into my settings to see if I could change my startup on Win disk install USB, no luck it no more.

    Now for the question: How can I get the Windows installation again? What I have to start the process, and if so, what should I use Bootcamp to delete the partition that was created? I have re-run Bootcamp and the only option that is checked is the partition and start and install/uninstall windows and delete the partition.

    Thanks for the help.

    Perform the following two procedures

    Reset the management system (SCM) controller on your Mac - Apple Support

    How to reset the NVRAM on your Mac - Apple Support

    If you use a USB drive, not a USB flash drive, you will have problems. It is recommended to use a 8-16 GB USB2 flash drive.

    If the installation program is located on a USB Flash drive, stop your Mac, connect the USB key, restart and hold down the alt/option key and select the Windows icon in the USB port. This installs Windows in BIOS mode. If you click the start EFI icon, it will install using the EFI mode (faster). You may need to change the partition from MBR to GPT using GPT Fdisk.

  • Yahoo account question

    Yes, I understand these are the Apple support forums, but I don't know where else to ask this question and I thought some of you would have the answer to this question.

    I deleted my Yahoo account last week, but I've heard that the 500 million Yahoo accounts were hacked in 2014. I made my account in 2015. Im sure it is hacked since I made my account a year after the supposed hack, but if my account has been hacked and I deleted which would be safe?

    If your account did not exist in 2014, then it is has not been hacked. Removal of the guarantees it will not be new since there was more pirate. Normally, at least the hackers got access to more information in the narrative, as credit card numbers, change your Yahoo password would have sufficed.

  • Text backup question / deleted

    I accidentally deleted one of my iPhone SMS 6 Plus.  They always show on my iMac and iPad but I fear when an AutoSave occurs, it will back up the iPhone and remove them to two other devices. What will happen?  I use iCloud if that makes a difference.

    Hi melissahh625,

    I understand that you have questions about your messages deleted on different devices. I know that it is important to have a handle on your data, so I'm happy to help you.

    When you receive messages, they are stored on different devices. This means that when you delete a device they will not be deleted on the other. This is the case, even if one of your backup devices to iCloud that these backups are specific to devices, as well.

    Thank you for using communities Support from Apple. See you soon!

Maybe you are looking for