multi line based on LOV table insert

SEQ / / desc Ref number value of the option of lov to insert
15DESC 1011
16DESC 2022
17033
18044
19055
20.... 6067

I have table, need multi line unique insert in process.there is a lov as values from 1 to 10 as number.when return value I select LOV (for example selected value 7) then the rows inserted in table 1 to 7 lines only.the table sequence number must increment as well use.

Well, if your "seq by trigger" is a sequence number created via a trigger, then you don't need to add yourself as the trigger must do.

You can then insert the number of rows you want, based on the input parameters...

Suppose that your values in the apex are: OPT_NUMBER and: SL_NUMBER

Insert into tablename (option_seq_num, sl_number)
Select to_char(level,'fm09')
,: sl_number + (level-1)
of the double
connect by level<=>

Example of the data...

SQL > ed
A written file afiedt.buf

1 Select to_char(level,'fm09')
2, & sl_number + (level-1)
3 double
4 * connect by level<=>
SQL > /.
Enter the value for sl_number: 0
2 old:, & + sl_number (level-1)
2 new:, 0 + (level-1)
Enter the value of opt_number: 10
4 old: connect by level<=>
new 4: connect by level<=>

TO_ 0 + (LEVEL-1)
--- -----------
01            0
02            1
03            2
04            3
05            4
06            5
07            6
08            7
09            8
10            9

10 selected lines.

Tags: Database

Similar Questions

  • Update multi lines according to a table of update

    Hello!

    I want to update multiple rows in a table according to a table of update like this:

    key
    col_a
    col_b
    123ABCdef
    456XYZUVW
    888KLMIJK

    The table to be updated has this (and other) columns. I use this code to do the update:

    Update my_table set t0

    col_a = (select col_a updates t1 where the t1.key = t0.key)

    col_b = (select col_b from t1 updates where the t1.key = t0.key)

    where

    key (select updates button);

    It works very well, but...

    .. .it seems to be ineffective. It seems that the systems needed to create keys in the table updates. He must then go through my_table and search the table updates twice for each update. Right? OK, the system can optimize it. I hope that. Is it possible to see how the system will perform the foregoing.

    .. .is too laborious to write in code. Is there a better way to specify:

    "For any row from my_table where the key is the key of table updates, updates col_a and col_b my_table with values according to table updates?

    THX!

    Hello

    1010848 wrote:

    Hello!

    I want to update multiple rows in a table according to a table of update like this:

    key
    col_a
    col_b
    123 ABC def
    456 XYZ UVW
    888 KLM IJK

    The table to be updated has this (and other) columns. I use this code to do the update:

    Update my_table set t0

    col_a = (select col_a updates t1 where the t1.key = t0.key)

    col_b = (select col_b from t1 updates where the t1.key = t0.key)

    where

    key (select updates button);

    It works very well, but...

    .. .it seems to be ineffective. It seems that the systems needed to create keys in the table updates. He must then go through my_table and search the table updates twice for each update. Right? OK, the system can optimize it. I hope that. Is it possible to see how the system will perform the foregoing.

    .. .is too laborious to write in code. Is there a better way to specify:

    "For any row from my_table where the key is the key of table updates, updates col_a and col_b my_table with values according to table updates?

    THX!

    FUSION is often more effective than the UPDATE, precisely for the reasons you mentioned.

    Try using the MERGER: http://docs.oracle.com/database/121/SQLRF/statements_9016.htm#sthref7153

    something like:

    MERGE INTO my_table mt

    USING update u

    WE (mt.key = u.key)

    WHEN MATCHED THEN UPDATE

    SET mt.col_a = u.col_a

    mt.col_b = u.col_b,

    ;

    If you would care to post a small example of data (CREATE TABLE and INSERT statements for both tables) and outcomes from this data, I was able to test this.

    Check out the Forum FAQ: Re: 2. How can I ask a question on the forums?

  • When possible in Oracle Forms to insert a second line based on 1st row, so why not in the ADF?

    Mr President

    When possible in Oracle Forms to insert a second line based on 1st row, so why not in the ADF?

    The user just enter data in the Module of sales in one line of a Bill as below

    and it is displayed in two rows in financial Module.like below how to proceed in the ADF.

    You can see that invoice line contains the sales tax and the gross sales amounts, then it is posted to the financial Module above two lines.

    How to make ADF

    Respect of

    What I realized, this is:

    -You have a table in you screen.

    -You call CreateInsert 2 times to create 2 rows at the same time.

    -You will enter value in a specific column (c1) line1

    Looking for the value that you entered in row1 can be completely copied in the same column (c1), but in line2. is this correct?

    If so try to do the following:

    1. in the table inputText (c1) column set autoSubmit = true and setValueChangeListener to a method in backbean

    
           
    
    

    2. in the inputTextValueChangeListener method to write this code

      public void inputTextValueChangeListener(ValueChangeEvent valueChangeEvent)
      {
        DCIteratorBinding tableIter = (DCIteratorBinding) BindingContext.getCurrent().getCurrentBindingsEntry().get("tableIteratorName");// write table iterator name from pageDef.
        for (int i = 0; i < tableIter.getViewObject().getEstimatedRowCount(); i++)
        {
          ViewRowImpl myRow = (ViewRowImpl) tableIter.getRowAtRangeIndex(i);
          EntityImpl entityImpl = myRow.getEntity(0);
          if (EntityImpl.STATUS_NEW == entityImpl.getEntityState())
          {
            System.out.println("New row found");
            myRow.setAttribute("AttributeName", valueChangeEvent.getNewValue());// write attribute name
          }
        }
      }
    

    3 - Add inputText id in the partialTrigger table

    
    

    4 - pageDef. Set of table iterator rangeSize = "-1".

  • Created the form based on the table - created new line - how to retrieve line editing?

    Hello

    Sorry for such a stupid question, but being new in APEX, I don't know much about how the end user on a form.

    I have created a new form (not in a table), based on a table.

    I ran the form and created a new line.

    After the line was created, the form comes back ready to create another line (all the values in the fields).

    How can I go on the recovery of the line, I added just to make a few changes?

    Again, please forgive my ignorance.

    Mason

    Masong says:

    Sorry for such a stupid question, but being new in APEX, I don't know much about how the end user on a form.

    Or about how best to use this forum. Always include all the details of your environment and your application when you post a question so that we can provide a solution version - and context, case-specific: How to get the answers from the forum

    I have created a new form (not in a table), based on a table.

    I ran the form and created a new line.

    After the line was created, the form comes back ready to create another line (all the values in the fields).

    How can I go on the recovery of the line, I added just to make a few changes?

    Ensure that the attribute key back to point in the line process of... The ARP process is defined to return the value of PK of records inserted in the element of key primary page and delete any Reset Page clearly session state process created by the wizard page.

  • Possible to insert more than once in the same table using multi table insert?

    I used multi-table insert before insert a source separate from the tables without problem.

    However, when I want to insert into the same table two or more distinct lines, I encountered a problem because when I call nextval on the sequence since this is the same sequence # will try to use the same number for two inserts, which will raise a violation of PK constraint on the 2nd insert.

    A way around this problem?

    Another option is to create the sequence with increases of 2 or however many tables, you are targeting.
    When you then specify the. NEXTVAL, you must subtract the relative number of it, apart from the first table that you insert in to.

    Something like that;

    drop table t1;
    
    create table t1 (a number, b number);
    
    drop table t2;
    
    create table t2 (a number, b number);
    
    drop sequence test_seq
    /
    
    create sequence test_seq increment by 2 minvalue 0
    /
    
    insert all
    when 1 = 1 then
      into t1 (a, b) values (test_seq.nextval, 1)
    when 1 = 1 then
      into t2 (a, b) values (test_seq.nextval  - 1, 1)
    select 1, 1 from dual
    /
    
  • I create a form based on two tables that have sequences also. When I create insert only row is inserted in the fields in table first and second fields of the table are empty. Why?

    Mr President.

    I create a form based on two tables that have sequences also. When I create insert only row is inserted in the fields in table first and second fields of the table are empty. Why?

    formdoubletables.png

    the page source is

    <?xml version='1.0' encoding='UTF-8'?>
    <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
                    xmlns:f="http://java.sun.com/jsf/core">
      <af:panelFormLayout id="pfl1">
        <af:group id="Group">
          <af:inputText value="#{bindings.VoucherId.inputValue}" label="#{bindings.VoucherId.hints.label}"
                        required="#{bindings.VoucherId.hints.mandatory}" columns="#{bindings.VoucherId.hints.displayWidth}"
                        maximumLength="#{bindings.VoucherId.hints.precision}"
                        shortDesc="#{bindings.VoucherId.hints.tooltip}" id="it1">
            <f:validator binding="#{bindings.VoucherId.validator}"/>
            <af:convertNumber groupingUsed="false" pattern="#{bindings.VoucherId.format}"/>
          </af:inputText>
          <af:inputDate value="#{bindings.VoucherDate.inputValue}" label="#{bindings.VoucherDate.hints.label}"
                        required="#{bindings.VoucherDate.hints.mandatory}"
                        columns="#{bindings.VoucherDate.hints.displayWidth}"
                        shortDesc="#{bindings.VoucherDate.hints.tooltip}" id="id1">
            <f:validator binding="#{bindings.VoucherDate.validator}"/>
            <af:convertDateTime pattern="#{bindings.VoucherDate.format}"/>
          </af:inputDate>
          <af:inputText value="#{bindings.Credit.inputValue}" label="#{bindings.Credit.hints.label}"
                        required="#{bindings.Credit.hints.mandatory}" columns="#{bindings.Credit.hints.displayWidth}"
                        maximumLength="#{bindings.Credit.hints.precision}" shortDesc="#{bindings.Credit.hints.tooltip}"
                        id="it2">
            <f:validator binding="#{bindings.Credit.validator}"/>
          </af:inputText>
        </af:group>
        <af:group id="g1">
          <af:inputText value="#{bindings.Lineitem.inputValue}" label="#{bindings.Lineitem.hints.label}"
                        required="#{bindings.Lineitem.hints.mandatory}" columns="#{bindings.Lineitem.hints.displayWidth}"
                        maximumLength="#{bindings.Lineitem.hints.precision}" shortDesc="#{bindings.Lineitem.hints.tooltip}"
                        id="it3">
            <f:validator binding="#{bindings.Lineitem.validator}"/>
            <af:convertNumber groupingUsed="false" pattern="#{bindings.Lineitem.format}"/>
          </af:inputText>
          <af:inputText value="#{bindings.VoucherId1.inputValue}" label="#{bindings.VoucherId1.hints.label}"
                        required="#{bindings.VoucherId1.hints.mandatory}"
                        columns="#{bindings.VoucherId1.hints.displayWidth}"
                        maximumLength="#{bindings.VoucherId1.hints.precision}"
                        shortDesc="#{bindings.VoucherId1.hints.tooltip}" id="it4">
            <f:validator binding="#{bindings.VoucherId1.validator}"/>
            <af:convertNumber groupingUsed="false" pattern="#{bindings.VoucherId1.format}"/>
          </af:inputText>
          <af:inputText value="#{bindings.Debit.inputValue}" label="#{bindings.Debit.hints.label}"
                        required="#{bindings.Debit.hints.mandatory}" columns="#{bindings.Debit.hints.displayWidth}"
                        maximumLength="#{bindings.Debit.hints.precision}" shortDesc="#{bindings.Debit.hints.tooltip}"
                        id="it5">
            <f:validator binding="#{bindings.Debit.validator}"/>
          </af:inputText>
          <af:inputText value="#{bindings.Credit1.inputValue}" label="#{bindings.Credit1.hints.label}"
                        required="#{bindings.Credit1.hints.mandatory}" columns="#{bindings.Credit1.hints.displayWidth}"
                        maximumLength="#{bindings.Credit1.hints.precision}" shortDesc="#{bindings.Credit1.hints.tooltip}"
                        id="it6">
            <f:validator binding="#{bindings.Credit1.validator}"/>
          </af:inputText>
          <af:inputText value="#{bindings.Particulars.inputValue}" label="#{bindings.Particulars.hints.label}"
                        required="#{bindings.Particulars.hints.mandatory}"
                        columns="#{bindings.Particulars.hints.displayWidth}"
                        maximumLength="#{bindings.Particulars.hints.precision}"
                        shortDesc="#{bindings.Particulars.hints.tooltip}" id="it7">
            <f:validator binding="#{bindings.Particulars.validator}"/>
          </af:inputText>
          <af:inputText value="#{bindings.Amount.inputValue}" label="#{bindings.Amount.hints.label}"
                        required="#{bindings.Amount.hints.mandatory}" columns="#{bindings.Amount.hints.displayWidth}"
                        maximumLength="#{bindings.Amount.hints.precision}" shortDesc="#{bindings.Amount.hints.tooltip}"
                        id="it8">
            <f:validator binding="#{bindings.Amount.validator}"/>
            <af:convertNumber groupingUsed="false" pattern="#{bindings.Amount.format}"/>
          </af:inputText>
        </af:group>
        <f:facet name="footer">
          <af:button text="Submit" id="b1"/>
          <af:button actionListener="#{bindings.CreateInsert.execute}" text="CreateInsert"
                     disabled="#{!bindings.CreateInsert.enabled}" id="b2"/>     
          <af:button actionListener="#{bindings.Commit.execute}" text="Commit" disabled="#{!bindings.Commit.enabled}"
                     id="b3"/>
          <af:button actionListener="#{bindings.Rollback.execute}" text="Rollback" disabled="#{!bindings.Rollback.enabled}"
                     immediate="true" id="b4">
            <af:resetActionListener/>
          </af:button>
        </f:facet>
      </af:panelFormLayout>
    </ui:composition>
    
    
    
    

    Concerning

    Go to your VO Wizard, select the tab of the entity and to check if both the EO is editable or not.

    See you soon

    AJ

  • IKM Oracle Multi Table Insert obsolete?

    The description for 'IKM Oracle Multi Table Insert' reads:

    -Snip-

    DEPRECATED: KM has been deprecated and may be removed without notice in future versions ODI. Please use the MTI ODI mappings feature.

    -Snip-

    Can someone tell me the right way to do it in 12 c?  Everything I tried publishes two inserts instead of an insert of all.

    Thank you

    Scott

    12 c, there is now a revenge for this called "IKM Oracle down".  He doesn't appear on the physical tab and cannot be imported because it is built in.

  • Multi Oracle Table inserts

    Hi every1,

    Do you know how do Oracle multi-table insert in ODI 11 g.

    Thank you
    Kishore.

    Hello

    Yes, you need to import IKM Oracle Multi table Insert location of reference ODI_HOME\oracledi\xm

    In ODi 11 g, you develop project > extend your knowledge Module > expand integration (IKM) and right click on even (integration (IKM) and choose Import Modules of knowledge... it will open a window KM, you them select above the location to directory import file: (search and select the location above) below text box area, you can see all kms toll-free) , out of them, you will need to select IKM Oracle Multi Table Insert KM and click on the OK button

    Kind regards
    Phanikanth

  • How can I change an icon based on data in a block of multi line?

    I have a pack of multi line and I would like to change the appearance of an icon, a particular field based on that data, is - it possible using APEX (3.0.0) or y at - it an equivalent Java script?

    Hello

    Look at this blog entry, he describes how you do with the reports:

    [http://apex-at-work.blogspot.com/2008/09/report-with-changing-icons-on-row-level.html | http://apex-at-work.blogspot.com/2008/09/report-with-changing-icons-on-row-level.html]

    Kind regards

    Tobias
    -----
    [http://apex-at-work.blogspot.com/]

  • multi line / rowspan header table

    I need a table with a head composed of multiple rows and columns.

    Is this possible with CVI and if so, how?

    Column headers or a table row can be multiline like (almost) any other item of text in CVI signs: you can get part by pressing Ctrl + enter if you change the text in the editor of the IUR. You need to increase the size of header to fitthe newlabel line.

    However, unfortunately it is not possible to have more than one header line in the native tables of CVI. In addition, it is not possible to merge cells on some lines as you can do in Excel, so when I need a setting more complicated for the headers I normally use a separate to table it. The table "header" is defined as an indicator, and I put the cell widths according to my needs.

    You can see the two tricks in this example:

  • How not to show duplicate lines, based on a field

    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0

    Hello

    I have a query that looks like some scripts that did not stand on a given date compared to what ran the same day about a week ago. We want to include the start_datetime and the end_datetime but when I add it to the select statement, it evokes all instances of jobs that run several times during the day. Is it possible to exclude the extra lines based on the field of script_name?
    SELECT instances.script_name, 
                             instances.instance_name, 
                             REGEXP_REPLACE(master.description, 
                                            chr(49814),  -- em-dash
                                            '-') description
                                            --instances.start_datetime
                      FROM   xxcar.xxcar_abat_instances Instances,
                             xxcar.xxcar_abatch_master  Master
                      WHERE  1 = 1
                      AND    TRUNC(start_datetime) = TRUNC(TO_DATE(:p_StartDate, 'YYYY/MM/DD HH24:MI:SS')) - (:p_NumOfWeeks * 7)
                      AND    Instances.SCRIPT_NAME = Master.SCRIPT_NAME (+)
                      MINUS
                      SELECT script_name, 
                             instance_name, 
                             NULL
                             --NULL
                      FROM   xxcar.xxcar_abat_instances 
                      WHERE  1 = 1
                      AND    TRUNC(start_datetime) = TRUNC(TO_DATE(:p_StartDate, 'YYYY/MM/DD HH24:MI:SS'))

    LESS performs a set operation - remove lines from the first series that exactly match the second set.
    When you add columns to the first series, you want a smaller filter - try a NOT IN multi-column:
    To remove several courses, to regroup and get min/max

    SELECT instances.script_name,
                             instances.instance_name,
                             REGEXP_REPLACE(master.description,
                                            chr(49814),  -- em-dash
                                            '-') description,
                             min(instances.start_datetime) start_datetime,
                             min(instances.end_datetime) end_datetime
                      FROM   xxcar.xxcar_abat_instances Instances,
                             xxcar.xxcar_abatch_master  Master
                      WHERE  1 = 1
                      AND    TRUNC(start_datetime) = TRUNC(TO_DATE(:p_StartDate, 'YYYY/MM/DD HH24:MI:SS')) - (:p_NumOfWeeks * 7)
                      AND    Instances.SCRIPT_NAME = Master.SCRIPT_NAME (+)
                      AND (script_name, instance_name) NOT IN
                    ( SELECT script_name,
                             instance_name
                      FROM   xxcar.xxcar_abat_instances
                      WHERE  1 = 1
                      AND    TRUNC(start_datetime) = TRUNC(TO_DATE(:p_StartDate, 'YYYY/MM/DD HH24:MI:SS'))
                    )
    group by instances.script_name, instances.instance_name, master.description
    

    You do not give the definitions of table and query schemas in him, therefore I don't test it.

    Kind regards
    David

  • Multi lines convert to a single line

    Dear Group members
    I want to convert the queries that return multiple lines in a single line. Scanario is provided for in
    select * from inout v
    where v.empcode = '00047'
    and v. dated = '27-dec-09'
    
    EMPCODE      DATED        IN_TIME   NET_TIME     ATT_STATUS     VAL
    00047     27/12/2009     0     0       G             1
    00047     27/12/2009     0     0       R             1
    00047     27/12/2009     7.44     483       P             1
    This query gives multi lines, but I would like to convert it into a line like this
    EMPCODE      DATED        IN_TIME   NET_TIME     ATT_STATUS     VAL
    00047     27/12/2009     7.44     483       R             1
    If the employee came the day that has three traffic status ('G', 'R', 'P'), then it should show in_time, net_time situation and their participation should be 'R '.

    In this example there are two rows. I need the line that has in_time > 0, which is the 2nd bet replaces att_status 'P' for 'R '.
    EMPCODE      DATED        IN_TIME   NET_TIME     ATT_STATUS     VAL
    00047     25/12/2009     0     0       R             1
    00047     25/12/2009     7.59     476       P             1
    Suppose that there are the 25/12/2009 and employee came that day then it shows the following result.
    EMPCODE      DATED        IN_TIME   NET_TIME     ATT_STATUS     VAL
    00047     25/12/2009     7.59     476       R             1
    It presents 'R' Att_status coloums instead of 'P '.

    >
    Note that
    'G' = blew in gusts
    'R' = rest
    "P" = present
    >

    Test case is provided for in
    CREATE TABLE INOUT
    (
      EMPCODE     VARCHAR2(10),
      DATED       DATE,
      IN_TIME     NUMBER(10,2),
      NET_TIME    NUMBER(10,2),
      ATT_STATUS  VARCHAR2(5),
      VAL         NUMBER(3)
    )
    
    insert into inout(EMPCODE,    DATED     ,IN_TIME , NET_TIME, ATT_STATUS, VAL  )
    values           ('00047','25-DEC-2009',     0    ,       0     ,   'R' ,           1);
    insert into inout(EMPCODE,    DATED     ,IN_TIME , NET_TIME, ATT_STATUS, VAL  )
    values           ('00047','25-DEC-2009',     7.59 ,       476   ,   'P' ,           1);
    insert into inout(EMPCODE,    DATED     ,IN_TIME , NET_TIME, ATT_STATUS, VAL  )
    values           ('00047','27-DEC-2009', 0    ,    0         ,   'G'     ,       1);
    insert into inout(EMPCODE,    DATED     ,IN_TIME , NET_TIME, ATT_STATUS, VAL  )
    values           ('00047','27-DEC-2009',     0    ,       0     ,       'R'     ,       1);
    insert into inout(EMPCODE,    DATED     ,IN_TIME , NET_TIME, ATT_STATUS, VAL  )
    values           ('00047','27-DEC-2009',     7.44 ,       483   ,       'P' ,           1);
    Thanks and greetings
    select distinct empcode,dated,
           case when cnt>0 then
             max(in_time) over (partition by empcode,dated)
            else
               in_time
            end in_time,
           case when cnt>0 then
             max(net_time) over (partition by empcode,dated)
            else
               net_time
            end net_time,
    
           case when cnt >0 then
               case when status in  ('G','P','R')  then
                'R'
                    when status in ('HCP','1/2') THEN
                'HCP'
               end
             else
               status
            end status
           from (
            select v.empcode,v.dated,v.in_time,v.net_time,(count(*) over (partition by v.empcode,v.dated)) cnt,att_status status
             from inout v
            where v.empcode = '00047')
    

    Published by: Khaled Aradhye, January 20, 2010 02:23

  • Form based on a Table, only updated authorized, form does not display the data

    Hello

    I created a form based on a Table by the corresponding wizzard. The table has only one line. The shape didn't create or delete buttons, only update & Cancel is allowed. The PK (id field) is hidden and it takes the value of a database trigger when insert (in fact never is apllied because there is no Create).

    When the form is called it is already displayed in update mode, with cancel button allowed but not data in the fields. Line seems ok, session data available null to variables/positions. No idea why this is happenning? I expect to HAV the data in the form fields.

    TIA

    Hello

    Your primary key item have no value, I guess.
    Create calculations to set the value of the item that is in this single line in your table

    BR, Jari

  • Multi line form and onload

    Hello

    I have a Multi line form (MRF) function wizard based on views (2 tables) with instead of triggers to manage the DML. I have an onchange event on a particular list item select according to each line that simply enables / disables other line items according to the value. It all works well, but I need to repeat the toggle points for each line, once the page is loaded.

    My first thought is to use an event onload in the definition of the Page, but cannot, and should I handle this in a process Page instead (keep in mind that he is a wizard generated MRF)? Also, I need to check that the new lines (via the Add Row button) are managed properly. If I go down the route of onload event, then is the easiest just to get a table (getElementsById?) of items and loop through them? Any thoughts would be most appreciated on the most effective way to do.

    See you soon,.

    PaulB

    Hello

    Yes, it appears same as an onload but, fortunately, does not interfere with any existing onload code - you can have only a single function of the window object onload call.

    You can iterate through the items in the form using something like:

    function disableItems()
    {
    var x = document.getElementsByName("f03");
    var y = document.getElementsByName("f04");
    for (int k = 0; k < x.length; k++)
    {
     if (x(k).value == 'A')
     {
      y(k).disabled = true;
     }
     else
     {
      y(k).disabled = false;
     }
    }
    }
    

    This assumes that the selection list is in column 3 (which should mean that SELECT objects must have a name of "f03" attribute) and that the element you want to toggle is in column 4 ("f04") - so adjust as needed.

    Like you have the same number of items in the column 3 and column 4 - loops above through those in column 3, checks the selected value, and then activates / deactivates the item in the same row in column 4.

    Andy

  • Lines left in the table LT after removal of the direct workspace and the removal of all workspaces

    I had a lot of data in a table enabled version that has been modified in some workspaces.  The LIVE workspace, I deleted all the rows in the table and I then drove back the workspaces (yes I probably should have done differently).  Once workspaces have been cancelled table LT empty, I would have expected, but it wasn't.

    I can reproduce this in the example below.  I insert two lines in the test table and allow it to version.  In a workspace I update a row in the table, which leads to 3 ranks in LT as expected.  Live, I delete the two lines of the table that translates into 5 lines of LT which is fine.  So I restore and delete the workspace I created for the update.  At this point, nothing should versioned LT lines, so I expect to go, but two lines remain.  In my real-world scenario, it is initially questions as the table LT is now much more it must be and requests on the versioned table are slow.

    Is this expected behavior?  Can I do anything to clean?

    Thank you

    John

    scott@JOHNOT> select * from v$version;
    
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
    PL/SQL Release 11.2.0.4.0 - Production
    CORE    11.2.0.4.0      Production
    TNS for 64-bit Windows: Version 11.2.0.4.0 - Production
    NLSRTL Version 11.2.0.4.0 - Production
    
    
    scott@JOHNOT> create table test_wm_table (
      2    id number primary key,
      3    name varchar2(20));
    
    
    Table created.
    
    
    scott@JOHNOT> execute dbms_wm.enableVersioning('test_wm_table');
    
    
    PL/SQL procedure successfully completed.
    
    
    scott@JOHNOT> insert into test_wm_table (id, name) values (1, 'first value');
    
    
    1 row created.
    
    
    scott@JOHNOT> insert into test_wm_table (id, name) values (2, 'second value');
    
    
    1 row created.
    
    
    scott@JOHNOT> commit;
    
    
    Commit complete.
    
    
    scott@JOHNOT> select * from test_wm_table_lt;
    
    
            ID NAME                    VERSION NEXTVER     DELSTATUS LTLOCK
    ---------- -------------------- ---------- ---------- ---------- ------------------------
             1 first value                   0 -1                 10 *-1,-9,-1*$#SCOTT$#
             2 second value                  0 -1                 10 *-1,-9,-1*$#SCOTT$#
    
    
    scott@JOHNOT> execute dbms_wm.createWorkspace('test_workspace');
    
    
    PL/SQL procedure successfully completed.
    
    
    scott@JOHNOT> execute dbms_wm.goToWorkspace('test_workspace');
    
    
    PL/SQL procedure successfully completed.
    
    
    scott@JOHNOT> update test_wm_table set name = 'something else' where id = 1;
    
    
    1 row updated.
    
    
    scott@JOHNOT> commit;
    
    
    Commit complete.
    
    
    scott@JOHNOT> select * from test_wm_table_lt;
    
    
            ID NAME                    VERSION NEXTVER     DELSTATUS LTLOCK
    ---------- -------------------- ---------- ---------- ---------- ------------------------
             1 first value                   0 ,45,               10 *-1,-9,-1*$#SCOTT$#
             2 second value                  0 -1                 10 *-1,-9,-1*$#SCOTT$#
             1 something else               45 -1                 11 *0,10,0*$#SCOTT$#
    
    
    scott@JOHNOT> execute dbms_wm.gotoworkspace('LIVE');
    
    
    PL/SQL procedure successfully completed.
    
    
    scott@JOHNOT> delete test_wm_table;
    
    
    2 rows deleted.
    
    
    scott@JOHNOT> commit;
    
    
    Commit complete.
    
    
    scott@JOHNOT> select * from test_wm_table order by id;
    
    
    no rows selected
    
    
    scott@JOHNOT> select * from test_wm_table_lt order by id;
    
    
            ID NAME                    VERSION NEXTVER     DELSTATUS LTLOCK
    ---------- -------------------- ---------- ---------- ---------- ------------------------
             1 first value                   0 ,44,45,            10 *-1,-9,-1*$#SCOTT$#
             1 something else               45 -1                 11 *0,10,0*$#SCOTT$#
             1 first value                  44 -1                -11 *-1,-9,0*$#SCOTT$#
             2 second value                 44 -1                -11 *-1,-9,0*$#SCOTT$#
             2 second value                  0 ,44,               10 *-1,-9,-1*$#SCOTT$#
    
    
    scott@JOHNOT> execute dbms_wm.rollbackWorkspace('test_workspace');
    
    
    PL/SQL procedure successfully completed.
    
    
    scott@JOHNOT> execute dbms_wm.removeWorkspace('test_workspace');
    
    
    PL/SQL procedure successfully completed.
    
    
    scott@JOHNOT> select * from test_wm_table order by id;
    
    
    no rows selected
    
    
    scott@JOHNOT> select * from test_wm_table_lt order by id;
    
    
            ID NAME                    VERSION NEXTVER     DELSTATUS LTLOCK
    ---------- -------------------- ---------- ---------- ---------- ------------------------
             1 first value                   0 -1                -11 *-1,-9,0*$#SCOTT$#
             2 second value                  0 -1                -11 *-1,-9,0*$#SCOTT$#
    
    
    

    Post edited by: John OToole

    OK, I see.

    Options (depending on the structure of your current workspace if it is not as simple as in the example) are rollback, purgetable or compressworkspace.

    More information on when and how to use them can be found in this thread: https://community.oracle.com/message/4027735#4027735

    Rollback works in your example, certainly, but might not be applicable in a real scenario.

    Hope that helps.

    Kind regards

    Andreas

Maybe you are looking for