remove the last record from the plsql table

TYPE r_LOOPElement IS RECORD (TermID   NUMBER 
                                      );

TYPE t_LOOPType IS TABLE OF r_LOOPElement INDEX BY BINARY_INTEGER;
i_CustomerLoop      t_LOOPType ;

i_CustomerLoop(1).TermID=1;
i_CustomerLoop(2).TermID=2;
i_CustomerLoop(3).TermID=3;
Under certain conditions, I need to remove the last record from i_CustomerLoop

whichi s the best way to do it. because I sometimes get duplicates for TermID in this plsql table.

Hello

See [removing items from Collection (DELETE method) | http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/collections.htm#CJAFGFIG]

Kind regards

Tags: Database

Similar Questions

  • jump the last record loading using external table

    Hi gentlemen,

    I have a requirement to load data from text file of oracle database by using the external table. I need to remove the header records and complementary.

    I can use the skip option to remove the header, IE front-line.

    Is it possible to remove the additional record (IE last line) using the external table.


    Thanks in advance.

    Ferry

    Hello ferry.
    Do not hesitate on occasion as useful and Correct answers for those of us Newbie trying to get credibility :)

    Thank you
    Luke

  • Remove the 0 table

    How can I remove the 0 in this table? Its been a while and I always try to know how to do this. Thank you

    Hello

    An excerpt from do.  Copy on the desktop, and then drag on the VI.

  • Remove the large table

    Hello

    I have a very large non partitioned table about 50 GB. I need to remove old data from the table that would be around 25-30 GB.

    What I have is

    (1) table a Dump Export using expdp
    (2) drop table
    (3) create a partitioned table
    (4) import the Table data
    (5) scores drop

    Please let me know if there is a better way to do the same?

    Uhm... do a conditional export?

    It should be a bit faster because you do not have to import the original table.

    Bye,.
    Antonio

  • How can I remove the imported tables frame color?

    Hello. I imported my Word document that has a table. Everything looks great, but when I export to PDF format, the table box is gray. I want the table to show.

    I don't want to have to re - create the entire table with text boxes, so I wonder if I can just remove the color of the frame?

    Thank you!

    You are welcome.

    Please remove your personal information when you respond by e-mail. Thank you.

  • How to remove the fact Table

    Hi all

    If I have to restart my fact table on the same day, more than once a day, and he had already stored in it, I want to remove these lines and reload the fact with the current date. I want to create a procedure and include it in the package, the process must check the current_timestamp and if the lines with the date and if there is then it should delete it. Please let me know how I can do this. I am running SQL Server - 2008.

    Thanks for your time and your help.

    You should have to date in your primary key (ex: in a varchar as YYYYMMDD format).

    Then you have 2 ways to implement:

    create an ODI procedure that will remove all data where this date = today. Perform this procedure before your interface.
    * or change your IKM: Add a step that will erase the data in the target table if date = today.

  • How to remove the tag table of ecommerce

    How can I remove the tables within the ecommerce page, I have a responsive site html5 works a treat with the exception of ecommerce, it seems, place tags around my content table. Here is the HTML code, correct display, how to fix?

    < div class = "sixteen columns" >

    < div class = "eight columns alpha" >

    < p > < a href = "/ online purchase" > home < /a > / {tag_cataloguebreadcrumbs} | < a href = "/ my account" > my account < /a > < /p >

    < / div >

    < div class = "eight columns omega" >

    {module_shoppingcartsummary, horizontal}

    < / div >

    < / div >

    <! - Shop category - >

    < div class = "sixteen columns" >

    {tag_description} < /p > < p >

    < p > {tag_cataloguelist, 3, 50, true} < /p >

    {tag_productlist, 3, 100, true} < / div >

    < div class = "sixteen columns" >

    {tag_previouspage} {tag_pagination} {tag_nextpage}

    < / div >

    And here's what it did BC

    <! - Shop category - >

    "<div class="sixteen columns"> ".

    <p >< /p >

    "<p ><table class="catalogueTable"><tr ><td class="catalogueItem"><div class= 'one third of column" > .

    "<div class="Unit attention"> ".

    "" <p ><a href= "/ shop-online/gloves' ><img src="/images/products/yeti-gloves.jpg" alt="gloves" border="0"/ >< /a >< /p > "

    "<p ><a href="/ shop-online/gloves' >gloves < /a >< /p > .

    < /div >

    < /div >

    "< /td ><td class="catalogueItem"><div class= 'one third of column" > .

    "<div class="Unit attention"> ".

    "" <p ><a href= "/ shop-online/hats' ><img src="/images/products/yeti-hat.jpg" alt="hats" border="0"/ >< /a >< /p > "

    "<p ><a href="/ shop-online/hats' >hats < /a >< /p > .

    < /div >

    < /div >

    "< /td ><td class="catalogueItem"><div class= 'one third of column" > .

    "<div class="Unit attention"> ".

    "" <p ><a href= "/ shop-online/hoodies" ><img src= "/images/products/hoody.png" alt= "Hoodies" border= "0" / >< /a >< /p > "

    "<p ><a href="/ shop-online/hoodies">Hoodies < /a >< /p > '.

    < /div >

    < /div >

    "< /td >< /tr ><tr ><td class="catalogueItem"><div class= 'one third of column" > .

    "<div class="Unit attention"> ".

    "" <p ><a href= "/ shop-online/jerseys" ><img src= "/images/products/yeti-jerseys.jpg" alt= "jerseys" border= "0" / >< /a >< /p > "

    "<p ><a href="/ shop-online/jerseys">jerseys < /a >< /p > .

    < /div >

    < /div >

    "< /td ><td class="catalogueItem"><div class= 'one third of column" > .

    "<div class="Unit attention"> ".

    "" <p ><a href= "/ shop-online/share-and-accessories' ><img src="/images/products/yeti-saddle.jpg" alt="parts and accessories" border="0"/ >< /a >< /p > "

    "<p ><a href="/ shop-online/share-and-accessories' >parts and accessories < /a >< /p > .

    < /div >

    < /div >

    "< /td ><td class="catalogueItem"><div class= 'one third of column" > .

    "<div class="Unit attention"> ".

    "<p ><a href="/ shop online/ride-shorts"><img src="/images/products/ride-shorts. "PNG" alt= "Ride Shorts" border= "0" / >< /a >< /p > "

    "<p ><a href="/ shop online/ride-shorts">Ride Shorts < /a >< /p > .

    < /div >

    < /div >

    "< /td >< /tr ><tr ><td class="catalogueItem"><div class= 'one third of column" > .

    "<div class="Unit attention"> ".

    "" <p ><a href= "/ shop-online/socks" ><img src= "/images/products/yeti-socks.jpg" alt= "socks" border= "0" / >< /a >< /p > "

    "<p ><a href="/ shop-online/socks">socks < /a >< /p > '.

    < /div >

    < /div >

    "< /td ><td class="catalogueItem"><div class= 'one third of column" > .

    "<div class="Unit attention"> ".

    "" <p ><a href= "/ shop-online/tshirts" ><img src= "/images/products/tshirts/tshirt.png" alt= "T-shirts" border= "0" / >< /a >< /p > "

    "<p ><a href="/ shop-online/tshirts">T-shirts < /a >< /p > .

    < /div >

    < /div >

    "< /td ><td class="catalogueItem">< /td >< /tr >< /table >< /p> '.

    "<table class="productTable productSmall"><tr ><td class="productItemNotFound"> < /td >< /tr >< /table >< /div > .

    "<div class="sixteen columns"> ".

    " <span class="paging" id="paging">< /span > " "

    < /div >

    Changing {tag_productlist, 3, 100, true} to {tag_productlist, 3, 100, true, true} you can return products like a UL.

    See http://kb.worldsecuresystems.com/134/bc_1342.html

    The list of products in the catalogue (use {tag_productlist, u, v, w, x, y, z}, where u is the number of products per row v is the target frame, for example, _blank or leave empty; w is the number of products per page (limit of 500 products per page); x is the type of sort, for example, price) , or alphabetical order. allows you to hide the empty message for example "this catalog has no product" and z is the type of list). Change: {tag_productlist, 4} to {tag_productlist, 4, true} to display in the form of LI.

    m

  • Consider removing the disconnected table

    Hi people

    I'm a frustrating tuning suggestion which I did not MFIS because all the tables, I see links correctly.

    Im trying to make a match and the code when it is called dynamic runs very slowly, but if I put it in a spreadsheet run in seconds

    H2. The suggestion that I receive, code is below, thanks in advance...

    1-restructuring conclusion of SQL (see map 1 to explain the plans section)
    ----------------------------------------------------------------
    A Cartesian product costly operation were found in line 5 of the ID of the
    execution plan.

    Recommendation
    --------------
    -Plan to delete the offline table or a view of this statement or
    Add a join condition that refers to it.

    Raison d'etre
    ---------
    A Cartesian product should be avoided as much as possible because it is a
    expensive operation and can produce a large amount of data.


    H1. Code


    Select distinct b1.coname, b2.coname, b1.st_country, b2.st_country, b1. ST_COID, b2. ST_COID, 'fiic_500' of
    boss_universe_matching b1,
    boss_universe_matching b2,
    boss_company_matching bc1,
    boss_company_matching bc2
    where
    Lower (B1.source) = "fiic_500" and
    Lower (B2.source) = "panasonic" and
    B1.tr_coid = bc1.u_id and
    B2.tr_coid = bc2.u_id and
    BC1.root = bc2.root and
    BC1. Country = bc2.country and
    B1.st_coid not in (select source_coid from the company_matches where source = 'fiic_500') and ((bc1.activity = bc2.activity) or)
    (INSTR (bc1.activity, bc2.activity) > 0
    GOLD INSTR (bc2.activity, bc1.activity) > 0)) and (bc1.entity is not null and bc2.entity is null) and ((bc1.location = bc2.location) or)
    (INSTR (bc1.location, bc2.location) > 0
    INSTR or (bc2.location, bc1.location) > 0))

    user8788094 wrote:
    I'm sorry, it's better?

    Much better {noformat} :-) {noformat}.

    The optimizer seems to think that there will be only one line coming out of the operation of loop nested line 5, so not a Cartesian joinwith (single) line coming out of the kind of scan and full buffer in lines 9 and 8. A Cartesian join of two single row result sets is quite reasonable. The only question is, is the correct optimizer?

    In fact, the query returns a single line? Estimates of the number of lines coming out of each stage seem reasonable to you? For example, combining the predicate with the plan section, the optimizer seems to think that a complete analysis of the filling of the BOSS_UNIVERSE_MATCHING is only one line where LOWER (SOURCE) = "panasonic". Is this reasonable?

    John

  • Inserting data in the PLSQL table

    Hello

    I'm trying to create a table of records and try to insert some data into it. But it is throwing error when compiling. Can someone help me solve the problem. My procedure is:



    create or replace
    procedure 'IL_BAL_CAL_PROC' is

    type il_bal_cal_acc_tab_rec is record (GID_NO VARCHAR2 (4), REG_CODE VARCHAR2 (2), VAC VARCHAR2 (10), BRANCH_CODE VARCHAR2 (4), CTL VARCHAR2 (4), OPEN_DT DATE, RECORD_STAT VARCHAR2 (1), CLOSE_DT DATE);
    type il_bal_cal_acc_tab_type is table of the il_bal_cal_acc_tab_rec;
    il_bal_cal_acc_tab il_bal_cal_acc_tab_type:=il_bal_cal_acc_tab_type();

    BEGIN

    -first approach
    insert into il_bal_cal_acc_tab values('12');


    --deuxieme approach
    / * Insert in il_bal_cal_acc_tab
    Select p_gidno,
    p_region,
    a.ACC,
    a.brncd,
    a.CCY,
    a.accopendt,
    a.record_stat,
    NULL as closdt
    stvws_cust_account_if a.,
    b stvws_branch_dates,
    sttms_account_class c,
    sttms_dda_maininfo d
    where a.acc = d.customer_account
    and a.brncd = b.branch_code
    and b.branch_code = d.branch_code
    and a.account_class = c.account_class
    and a.accopendt < trunc (to_date(b.today,'dd-mon-yy'), 'mm')
    and a.record_stat = 'O'
    and I'm c.dda_account_type <>'
    and a.auth_stat = 'A'
    and d.region_code = p_region
    Union
    Select p_gidno,
    p_region,
    a.ACC,
    a.brncd,
    a.CCY,
    a.accopendt,
    a.record_stat,
    c.closdt
    stvws_cust_account_if a.,
    b stvws_branch_dates,
    stvws_cust_ac_closure_if c,
    sttms_dda_maininfo d
    where a.acc = c.ac_no
    and c.ac_no = d.customer_account
    and a.brncd = b.branch_code
    and b.branch_code = c.branch_code
    and c.branch_code = d.branch_code
    and a.record_stat =' it
    and c.closdt > = trunc (b.today, 'mm')
    and d.region_code = p_region;
    commit; * /

    END;


    Please tell me how to insert data into tables of this kind?

    I generally do like this

    CREATE OR REPLACE PROCEDURE "IL_BAL_CAL_PROC"
    IS
       CURSOR cur_il_bal_cal_acc_tab_type
       IS
          SELECT p_gidno,
                 p_region,
                 a.acc,
                 a.brncd,
                 a.ccy,
                 a.accopendt,
                 a.record_stat,
                 NULL AS closdt
            FROM stvws_cust_account_if a,
                 stvws_branch_dates b,
                 sttms_account_class c,
                 sttms_dda_maininfo d
           WHERE     a.acc = d.customer_account
                 AND a.brncd = b.branch_code
                 AND b.branch_code = d.branch_code
                 AND a.account_class = c.account_class
                 AND a.accopendt < TRUNC (TO_DATE (b.today, 'dd-mon-yy'), 'mm')
                 AND a.record_stat = 'O'
                 AND c.dda_account_type <> 'M'
                 AND a.auth_stat = 'A'
                 AND d.region_code = p_region
          UNION
          SELECT p_gidno,
                 p_region,
                 a.acc,
                 a.brncd,
                 a.ccy,
                 a.accopendt,
                 a.record_stat,
                 c.closdt
            FROM stvws_cust_account_if a,
                 stvws_branch_dates b,
                 stvws_cust_ac_closure_if c,
                 sttms_dda_maininfo d
           WHERE     a.acc = c.ac_no
                 AND c.ac_no = d.customer_account
                 AND a.brncd = b.branch_code
                 AND b.branch_code = c.branch_code
                 AND c.branch_code = d.branch_code
                 AND a.record_stat = 'C'
                 AND c.closdt >= TRUNC (b.today, 'mm')
                 AND d.region_code = p_region;
    
       TYPE il_bal_cal_acc_tab_type IS TABLE OF cur_il_bal_cal_acc_tab_type%ROWTYPE
                                          INDEX BY BINARY_INTEGER;
    
       il_bal_cal_acc_tab   il_bal_cal_acc_tab_type;
    BEGIN
       OPEN cur_il_bal_cal_acc_tab_type;
    
       FETCH cur_il_bal_cal_acc_tab_type
       BULK COLLECT INTO il_bal_cal_acc_tab;
    
       CLOSE cur_il_bal_cal_acc_tab_type;
    END;
    
  • Metadata import wizard does not remove the repository table columns

    Hello everyone!

    We are facing the following problem with an object imported in OWB:

    I have successfully imported an OWB table. I see in 'Data object editor' of the OWB the repository object is identical to the physical object.

    If I remove a column in the table physical db and re - import the table in OWB, OWB "Metadata import wizard" understands that a column is removed and in "import results" shows this column as "canned goods". "" However, in of OWB ' data object editor of "column is not deleted! Is there a step we miss them?

    Thanks in advance!

    PS: we use OWB 10 g 2

    Yes, you missed a step

    When you import on
    Step 3 of 3 synthesis and import
    Click on the Advance import OPtion
    Select the option preserve everything.

    (Mark it as useful or correct if it is)

    See you soon
    Katia

  • Impossible to truncate the plsql table

    I want to for the collection of statistics that my query is executed.
    I can't make plsql
    declare 
      -- Local variables here
      i integer;
    begin
      -- Test statements here
       SET AUTOTRACE ON;
     truncate  table plan_table;
    end;
    How can I do.

    Hello

    TRUNCATE TABLE is not a PL/SQL command; It is a SQL command.
    To run a command purely SQL in PL/SQL, use EXECUTE IMMEDIATE.
    SET AUTOTRACE is not a PL/SQL command either; Is a SQL * Plus command and I don't know anyway to run it with the exception of the SQL * Plus command prompt.

    I think that's what you do:

    SET AUTOTRACE ON;
    
    declare
      -- Local variables here
      i integer;
    begin
      -- Test statements here
        EXECUTE IMMEDIATE 'truncate  table plan_table';
    end;
    
  • Number of rows different when add/remove the same table

    Hello
    I have a problem in a select statement.
    My database is a 9.2.0.8.
    select *
    from  tab1 t1,
            tab2 t2,
            tab2 t3
    where t1.id_c1 = 1
       AND t1.id_c2 = t2.id_c2
       AND t1.id_c2 = t3.id_c2
       AND t2.id_init = 3693
       AND t3.id_init = 3892;
    
    936 rows selected.
    If I change the query to:
    select *
    from  tab1 t1,
            tab2 t2
    where t1.id_c1=1
       AND t1.id_c2 = t2.id_c2
       AND t2.id_init in ( 3693,3892);
    
    61132 rows selected.
    Any ideas? What's wrong??
    TNX

    Published by: 842366 on 3.10 there / 10/2011

    Published by: 842366 on 3.10 there / 10/2011

    T2.id_init in (3693,3892);

    T2.id_init of means is 3693 or 3892. It's the same as:

    t2.id_init = 3693 OR t2.id_init 3892;
    

    While the first request was:

    T2.id_init = 3693 AND t3.id_init = 3892;

    SY.

  • Select the last disk in the history table

    How to select the last record in a history table? the example data is
    < p >
    Product EffectiveDate

    prod1 01/01/1980

    prod1 01/01/1990

    prod1 01/01/2000

    prod2 02/02/1980

    prod2 02/02/2000
    < /p >
    < p >


    The expected result is



    Product EffectiveDate

    prod1 01/01/2000

    prod2 02/02/2000
    < /p >

    Assuming that there is a single line with max (effectivedate) for a given product

    SELECT product, attrib1, attrib2, ... , max_effective_date
      FROM (SELECT product,
                   attrib1,
                   attrib2,
                   ... ,
                   effectivedate,
                   max( effectivedate ) over (partition by product) max_effective_date
              FROM history_table)
     WHERE effectivedate = max_effectivedate
    

    should work.

    Justin

    Published by: Justin cave on October 30, 2008 18:32

    Formatting changes

  • Select the data from collections plsql

    Hi all

    I'm not a developer but working as a DBA, so not very familiar with pl/sql, always crossed with documentation and could lead to a solution of my problem. I need advice from expert here.

    Problem: I am writing in a kind of special program plsql for surveillance of certain lots, I know that we have much option to do the same db/grid control including... etc but for some
    the reason I have to do this, use only plsql.

    Requirement: my requirement is to select data in the plsql table and then have the opportunity to ask questions again and again. I prefer not to go to table, rather than directly from plsql...

    I wrote below the code for the sample, bulk data in collection type collection and can print using the loop.

    Declare
    TS type is table v$ session % rowtype index by pls_integer;
    tsess ts.
    Start
    Select * bulk collect into tsess from v$ session;
    I'm looping 1.tsess.count
    dbms_output.put_line (tsess (i) .terminal);
    end loop;
    end;
    /

    But is it possible same collection (tsess in the example above) can be queried using a select as ' select * from table (Tsess) "I searched the net and found this can be done using create type at the database level.» But my problem is that I can't create any object in the database as being it's a production one.

    I was looking as if is it possible even can be accomplished... as cast / multiset... However, I could not get it through.

    your help would be appreciated!

    Kind regards

    I don't think you should use the tables here, only SQL, take a look at the factors of subquery and will indicate if it is not enough...

    Published by: BrendanP on February 12, 2012 03:07 for an example:

    I understand you want to "Refresh" of data that you already have the database purely to be able to use the SQL such as ORDER BY in multiple ways. Here's how you can do it in the original SQL for a particular example, where you query v$ sql time control processor and disk reads separately (I tested it but the result won't be good look here, so omitting it):

    WITH v AS (
    SELECT
        Substr (sql_text,1,500)             sql_text,
        cpu_time/1000000                    cpu_seconds,
        disk_reads,
        buffer_gets,
        executions,
        CASE WHEN rows_processed != 0 THEN Round( buffer_gets / Nvl (Replace (rows_processed, 0, 1) ,1)) END Buffer_gets_rows_proc,
        Round (buffer_gets / Nvl (Replace (executions, 0, 1), 1)) Buffer_gets_executions,
        elapsed_time / 1000000              elapsed_second,
        module
    FROM v$sql s)
    SELECT
        'CPU'                order_by,
        cpu_seconds          order_val,
        sql_text,
        cpu_seconds,
        disk_reads,
        buffer_gets,
        executions,
        buffer_gets_rows_proc,
        buffer_gets_executions,
        elapsed_second,
        module
    FROM v
     UNION
    SELECT
        'Disk reads',
        disk_reads,
        sql_text,
        cpu_seconds,
        disk_reads,
        buffer_gets,
        executions,
        buffer_gets_rows_proc,
        buffer_gets_executions,
        elapsed_second,
        module
    FROM v
    ORDER BY order_by, order_val DESC
    
  • Cannot get removeInstance to remove the current instance

    I have a form that contains a table inside a subform that I added a button to add additional instances of the subform that contains the table. Add instance works fine, however, I have also a button to remove the current of the subform that contains instance the table, and it does not work well. Keep remove the first instance of the subform rather than the current instance. For example, lets say the first table is to order product A, then the user can add another instance of the table to order product B and then add a third table to the product C command. Then, let the user didn't need the second table (product B) for a reason, so they click on the button on delete in the second table, but instead of removing the second table containing product B, it deletes the first table that contains produced.

    I have the subform (OrderMain) defined to repeat with a minimum number of 1. The button to add an instance of the OrderMain subform contains the following code:

    this.resolveNode('MasterSubform._OrderMain').addInstance (1);

    If (xfa.host.version & lt; 8) {}

    XFA. Form.Recalculate (1);

    }

    The button to remove the current instance of the subform has the following code:

    this.resolveNode('MasterSubform._OrderMain').removeInstance (this.parent.index);

    If (xfa.host.version & lt; 8) {}

    XFA. Form.Recalculate (1);

    }

    I tried to adjust the parent index, but that did not work. I also put the code in the button Delete of table to view a message that contains the current index of parent and each instance returns an index of parent of 0. I use Adobe Acrobat XI to test the form. What I'm doing wrong here?

    I have it. Finish by checking the relative path of the Remove button to the OrderMain subform. While the button Delete in a subform that is different, I have taken into account in the determination of the index of the OrderMain subform repeatable. Given that each "parent" refers to an another subform, I changed the code of the delete button for the following:

    this.resolveNode('MasterSubform._OrderMain').removeInstance (this. parent.parent.parent.parent.index);

    If (xfa.host.version< 8)="">

    XFA. Form.Recalculate (1);

    }

Maybe you are looking for