How to delete a table type

Hi,
I've defined a
type reg is table of mytable%rowtype INDEX BY BINARY_INTEGER;
reg_tab  reg;
In my script I load some data on reg_tab
How can I delete the data from it? I mean I'd like to do something like delete from reg_tab; after finishing to work on reg_tab
Thanks
Edited by: Mark1970 on 1-lug-2010 3.23

PL/SQL tables have the following attributes that could be used on them:
• DELETE—Deletes rows in a table.
• EXISTS—Return TRUE if the specified entry exists in the table.
• COUNT—Returns the number of rows in the table.
• FIRST—Returns the index of the first row in the table.
• LAST—Returns the index of the last row in the table.
• NEXT—Returns the index of the next row in the table after the specified row.
• PRIOR—Returns the index of the previous row in the table be-fore the specified row.
In your case, you could either use
reg_tab.delete - to delete all rows
reg_tab.delete (n) - to delete nth row.
To delete all rows after inspecting them one by one ... you could use the COUNT attribute in a FOR loop similar to this...
FOR idx in 1 .. reg_tab.COUNT
LOOP
-- do necessary checks
-- reg_tab.delete (idx) ;
END LOOP;

Similar Messages

  • ADF Desktop Integration : How to delete the table in Excel?

    Hi,
    I am using Jdev 11.1.1.3.0 and Excel 2007 for Oracle ADF DI, I had created an ADF table using pageDef file in the excel. Now I wanted to delete that table and use a different pageDef file.
    I could not find a way to delete that table.
    I deleted full row of tables and then I used different pageDef file and created a new adf table. But when I am running this version of excel, I am getting runtime exception and excel is getting corrupted.
    My question how to delete the table not corrupting the Excel.
    Thanks
    Pavan

    Pavan,,
    Welcome to OTN.
    You can delete the table by selecting the top left column (of the table) and then select delete from the ADFdi tab.
    Refer the documentation for more info.
    http://docs.oracle.com/cd/E17904_01/web.1111/e10139/get_start_dev_tools.htm#ADFDI608
    -Arun

  • How to delete parent table data even though it has child records

    hi all,
    How to delete parent table data even though it has child records.
    ex: delete from pa_request cascade constraints;
    But this command is not working .
    Regards,
    P Prakash

    833560 wrote:
    ex: delete from pa_request cascade constraints;cascade constraints is DROP table option. It can't be used with DELETE. You need to delete child rows first or drop foreign keys and recreate them with ON DELETE CASCADE. Then:
    delete from pa_request will automatically delete child rows. However, personally I don't like ON DELETE CASCADE. You can, by mistake, delete half of your database without even realizing it.
    SY.

  • How to delete a table at dictionary level

    Hi All,
          i have deleted custom table zaccount from database, usin se14 transaction.
    now i want to create a new table using same name zaccount, but it is showing me error that table already exists in data dictionary. now i am trying to delete from data dictionary also, but it is giving me error that table is refrenced at multiple levels
    guys how can i forcefully delete it from datadictionary.
    thanks and regards
    Al-salfi

    Your table was active and had data right and also it was referred at various places in different contexts.
    okay now please type the table name in SE11; can you see if yes fine you caught the problem display the table do not delete directly; click on where used list to generate a list of different places where the table has been referred.
    at all those points remove the references as per the context and do not forget to activate. so once you have done that and the where used list returns no result means all references moved then again delete the table.
    You won't have any more issues with the table
    this problem happens because of the active name tab of the table that is yet present but inconsistent as the changes to the dictionary definition have been made inconsistent by your earlier efforts.

  • How to use Oracle Table Type values in Select Statement.

    Hi,
    I am fetching initial set of values into Oracle Table of Records Type and want to use list of values in the Select statement.
    For example, try something like the following:
    TYPE t_record IS RECORD (
    ID TABLEA.ID%type,
    NO TABLEA.NO%type,
    v_record t_record;
    TYPE t_table IS TABLE OF v_record%TYPE;
    v_table t_table;
    -- Code to populate the values in v_table here.
    SELEC ID,NO, BULK COLLECT INTO <some other table variabes here> FROM TABLEA
    WHERE ID IN v_table(i).ID;
    I want to know how to use the values from Oracle Table Type in the Select Statement.

    Something like this:
    create or replace type t_record as  object (
    id number,
    no number
    CREATE or replace type t_table AS TABLE OF t_record;
    set serveroutput on
    declare
      v_table t_table := t_table();
      v_t1 t_table := t_table();
    begin
      v_table.extend(1);
      v_table(1).ID := 1;
      v_table(1).No := 10;
      v_table.extend(1);
      v_table(2).ID := 2;
      v_table(2).ID := 20;
      SELEC t_record (ID,NO) BULK COLLECT INTO v_t1
      from TableA
      FROM TABLEA
      WHERE ID IN (select t.ID from table(v_Table) t);
      for i in 1..v_t1.count loop
        dbms_output.put_line(v_t1(i).ID);
        dbms_output.put_line(v_t1(i).No);
      end loop;
    end;
    /Untested!
    P;
    Edited by: bluefrog on Mar 5, 2010 5:08 PM

  • How to delete a table of contents?

    It sounds like a stupid question, but I cannot delete my table of contents again? I only used the TOC in the draft, but don't need it in the final version of my document anymore. But - it sounds stupid - I cannot delete it. I marked it and hit the delete key, the back key. No more idea of how to delete the TOC. I even found no hint in the manual.
    Any tips? Thanks.

    Double-click the TOC so that it is surrounded by a dark border, then hit the 'delete' key.
    Good luck,
    Terry

  • How to Populate a table type variable from a cursor

    Hi
    I have a stored procedure (P1) that returns a ref cursor as the output.
    Another procedure (P2) receives this ref cursor (C).
    In this procedure (P2), I want to do a Bulk Collect from this ref cursor (C) in
    a table type variable that has been declared locally in the procedure P2. I have created appropriate Object Type and Table Types at the database level.
    Please advise how to do it. I tried to do it in different ways, but was not able to do it - each time I faced incompatible data-type related issues.
    Regards
    Madhup

    What I wrote was unclear. Syntactically it is valid and does something. But consider the advantage of a decent design.
    SQL> create or replace procedure p1 (o out sys_refcursor) as
      2  begin
      3   open o for select * from emp;
      4  end p1;
      5  /
    Procedure created.
    SQL> create or replace procedure p2(i sys_refcursor) as
      2   type emp_tab is table of emp%rowtype;
      3   l_emp_tab emp_tab;
      4  begin
      5   fetch i bulk collect into l_emp_tab;
      6   close i;
      7  
      8   for i in 1..l_emp_tab.count loop
      9     NULL;
    10   end loop;
    11  end p2;
    12  /
    Procedure created.
    SQL> CREATE OR REPLACE PROCEDURE p3 IS
      2 
      3  TYPE myarray IS TABLE OF emp%ROWTYPE;
      4  l_data myarray;
      5 
      6  CURSOR r IS
      7  SELECT * FROM emp;
      8 
      9  BEGIN
    10    OPEN r;
    11    LOOP
    12      FETCH r BULK COLLECT INTO l_data;
    13 
    14      FOR j IN 1 .. l_data.COUNT
    15      LOOP
    16        NULL;
    17      END LOOP;
    18 
    19      EXIT WHEN r%NOTFOUND;
    20    END LOOP;
    21    CLOSE r;
    22  END p3;
    23  /
    Procedure created.
    SQL> set serverout on
    SQL> set timing on
    SQL> declare
      2   r sys_refcursor;
      3  begin
      4    FOR i IN 1 .. 10000 LOOP
      5      p1(r);
      6      p2(r);
      7    END LOOP;
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:01.71
    SQL> begin
      2    FOR i IN 1 .. 10000 LOOP
      3      p3;
      4    END LOOP;
      5  end;
      6  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:01.21
    SQL> Again sorry for being less than clear.

  • How to create a table type context node

    Hi,
    I am trying to create table type context node. While creating, in the wizard no where I can see the option for this.
    Could you please let me know how can I do this?
    In one standard component: SRQM_INCIDENT_H, I can see multiple table type context nodes. Not sure how and why?
    Thanks,
    Sandeep

    HI Sandeep,
      When you right click on context node and create , a wizard will open. In that Wizard in one sreen it will ask for type of view. There you have to select Table View.
    Regards,
    Lakshmi.Y

  • How to DELETE condition tables in IDES

    Hi Experts,
    while practicing in IDES I have created tables in the range 501-999. I have no tables to create now. Can any one tell me how to delete the existing condition table. when I tried deleting its giving error: TABLE 911 IS REFERENCED FOR ACCESS SEQUENCE.
    Thank you
    SAHER

    Dear Saher,
    The best solution is to do as below.
    TCODE: SE11
    Database Table : T682I  --> choose DISPLAY
    CTRLSHIFTF10
    Input 911 in KOTABNR
    Execute / F8
    you will get the access sequences which use the condition table 911.
    go to v/07 of the access sequence obtained from the previous operation and
    delete the access which use condition table 911.
    Then you will be able to DELETE 911 condition table of your own.
    Please check and revert back.
    Thanks & Regards,
    Hegal  Charles

  • How to delete a table using pages without losing its content!

    I need to delete a table on my pages docuement but i dont want to lose its content. how can i proceed?

    Try this on a duplicate of your file to be sure it produces the desired results and you don’t risk your original file: Select the entire table, then Format > Table > Convert Table to Text.
    Walt

  • Solved: how to delete a table in 3.2

    some how a duplicate table appeared - how to delete it?
    silly me - simple highlight/ delete

    Use the CASCADE CONSTRAINTS clause.
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9003.htm
    C.
    Message was edited by:
    cd

  • How to insert into table type variables

    hi all,
    how to assingn values to table type variable, i am getting error.
    declare
    dept1 dept%rowtype;
    begin
    dept1:=(100,'SHIPPING','HYDERABAD');
    end;
    ERROR at line 4:
    ORA-06550: line 4, column 8:
    PLS-00382: expression is of wrong type
    regards,
    Sri Ram.

    You can do like this
    declare
      dept1 dept%rowtype;
    begin
      dept1.deptno := 10;
      dept1.dname := 'IT';
    end;
    /

  • How to access the table type field in the structure

    Hi All,
    I have a BADI CRM_MKT_ADR_SEARCH and a method CHANGE_SEARCH_RESULTS in this method I have a parameter CT_BP_CP_CHANNEL .This parameter has type CRMT_BP_CP_CHANNEL_TAB(this is table type) this has the line type CRMT_BP_CP_CHANNEL(this is structure) in this line type we have one field addrnumber.How to access this field in my method?Please help me in this regard.

    data lw_tab type CRMT_BP_CP_CHANNEL.
    loop at CRMT_BP_CP_CHANNEL_TAB into lw_tab.
       lv_field = lw_tab-addrnumber.
       <further processing>
    endloop.

  • JDBC Adapter Sender How to delete 3 tables?

    Hi all, I need to delete records of 3 tables after the Communication Channel send the information.
    The problem is I want to put the 3 sentences in the Update SQL Statement separated with ";" but it does not work.
    This is my statement
    DELETE from table1 WHERE field1='3';DELETE from table2 WHERE field1='3';DELETE from table3 WHERE field1='3';
    This is the error in the Runtime Workbench.
    Database-level error reported by JDBC driver while executing statement 'DELETE from pruebas.SAPRCTGH WHERE DGHSTS='3'.'. The JDBC driver returned the following error message: 'java.sql.SQLException: Token . was not valid. Valid tokens: <END-OF-STATEMENT>.'. For details, contact your database server vendor.
    When I tested from Razor SQL it works fine, I do not know what more to change.
    Regards,
    Sebastián Alvarez

    Hi all.
    Thank you very much for your answers.
    I'll try one thing, I'll create another Service Interface and in the Configuration Scenario create another Receiver Agreement, so the message will be sent to ECC and will "return" like inbound to delete the tables with 3 delete statements.
    Thank you very much to all of you.
    I'll try this and I'll tell you
    Regards

  • How to change partition table type

    I want to change my windows 7 partition table type, but I don't know anything about computer, is there any simple ways to do that? Someone recommend me Easeus partition master, which is a free partition software, but I don't know this kind of software,
    any advice?

    Hi,
    You can use diskpart command to convert partition table type.
    Change a GUID Partition Table (GPT) Disk into a Master Boot Record (MBR) Disk:
    http://technet.microsoft.com/en-us/library/cc725797.aspx
    Convert a MBR Disk to a GPT Disk:
    http://www.sevenforums.com/tutorials/26193-convert-mbr-disk-gpt-disk.html
    Note Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.
    Thanks!
    Andy Altmann
    TechNet Community Support

Maybe you are looking for

  • Video import from AE to PP blurry and bad quality video.

    Hi all, Im having a weird problem with AE cs6 and Premiere pro cs6. Whenever i import an AE to Premiere Pro, the quality becomes bad and blurry. When the project is rendered from AE to a video project (like QT) the quality is great. The videos I am w

  • Customer report in Multi currency

    Hi, my client has customers in different country , so he want to see multicurrency report . i.e as well as indian curreny and customers country currency,please can any help me in this issue, does in sap there are standard reports or else we need to d

  • Invoice Receipt by Line Item

    Hi How is the Differences between invoice Receipt  and  Invoice Receipt by Line Item according to purchasing thanks SM

  • Mac OS X 10.6.8 Update?

    Hello Apple, out of curiosity, when will the Mac OS X 10.6.8 update be available for download. I received an email message from Serato, the manufacturers of Scratch Live, stating that the Mac OS X 10.6.8 update will resolve the "hard freeze" graphics

  • Not able to download or update apps on iphone

    I'm not able to update or download apps on my iphone 5 (iOS 6.1.2). I'm logged in, but when I tap update all or update next to the individual app or install at a new app, nothing happens. It's as if the phone is not registering my tap - or that there