Deletion of rows in a table while the filter condition is in another table

Hi all

I am facing a problem of deletion of a row in a table where the condition is in the other table. To ealaborate the scenario further Let's say I have two tables T1 (the transactions table) and T2 (Master Table). I want to delete a record in the table T1 by checking conditions lies in table T2.
I tried with the query below, but this request deletion of records in the table two.

DELETE FROM (SELECT * high INNER JOIN T2 on T1 page TP)
THE top. TID = TP. TID
WHERE at the top. DEAL_SITE_ID = inputparameter1
AND (TP. SEGMENT <>inputparameter2 OR tp.segment is not null));

Here the record is deleted in the two tables, but I don't want to delete the data in my table master i.e table T2.

Any help would be much appreciated. Thanks in advance.

Kind regards
Delphine
SQL> select *
  2   from the_table;

X          Y
---------- ----------
AA         a
BB         a
CC         a
AA         b
DD         b

SQL> select *
  2   from the_table_2;

X          Y
---------- ----------
AA         a
BB         a
CC         a

SQL>  delete from
  2  (
  3  select *
  4  from the_table  t1 inner join the_table_2 t2
  5  on  t1.x = t2.x
  6  and t1.y = t2.y);

3 rows deleted.

SQL> select *
  2   from the_table;

X          Y
---------- ----------
AA         b
DD         b

SQL> select *
  2   from the_table_2;

X          Y
---------- ----------
AA         a
BB         a
CC         a

Tags: Database

Similar Questions

  • How to use OMB to change the filter conditions in OWB maps

    Hello
    I want to know how we can use the OMB to change the filter conditions in an OWB map.

    In my scenario, I have a filter FLTR_1 operator in my cards and I need to change the filter condition of


    INOUTGRP1.ID IN (1,2)
    AND
    INOUTGRP1. VALUE > CONST_0_MAX_VAL

    TO

    INOUTGRP1.ID IN (1,2)
    AND
    INOUTGRP1. VALUE > CONST_6_MAX_VAL


    Just for more information for everyone we are migrating from OWB 9.2 10.2 OWB and we called constant procedures and used their values in filter conditions. 10.2 OWB generates the values for the constants in a way different than OWB 9.2 which is why this change is necessary. I want to automate the Act of changing the names of constants so that we can save time to change maps.

    THX

    Hello

    change in the framework of your database module, then try

    OMBALTER MAPPING 'MY_MAP' MODIFY OPEARTOR 'FLTR_1' SET PROPERTIES (FILTER_CONDITION) VALUES ('INOUTGRP1.ID IN (1,2) AND INOUTGRP1.VALUE > CONST_6_MAX_VAL ')
    

    Kind regards
    Carsten.

  • Delete a row in a table

    Hello

    My requirement in the OPS is to remove a line in a table if the line has no mapping to another table.
    If there is a mapping then the line should not be deleted.

    I created two VO and formed two rows.
    While using my code if there is a mapping for a line of tables, then the line is not deleted.

    But I want to DELETE when there is no reference to the second table.

    The Code used in AM is

    * public void deleteOU (String ReferenceId1) {*}
    OAViewObject VOB = getBLTARBOUMAPEOView1 ();
    Line row = VOB.getCurrentRow ();
    Boolean flag = false;

    * while(Row!=null) {*}
    OAViewObject VOB1 = getBLTINVMAPVO1 ();
    Line row1 = VOB1.first ();

    * while(row1!=null) {*}
    * if ((row1.getAttribute("OuReffId").equals (ReferenceId1))) {*}
    flag = true;
    throw new OAException ("Unable to delete because the inventory is assigned to this operating Unit", OAException.ERROR);
    *}*
    * otherwise {*}
    Row1 = VOB1. Next();
    *}*
    *}*
    *}*

    * if(flag==false) {*}
    System.out.println ("Remove");
    Row.Remove ();
    *}*
    *}*



    Ex:
    ----
    Table1:
    ---------
    ReferenceId OR
    1 ABC
    DEF 2

    Table2
    ---------
    ReferenceId OUID
    2 567

    In the example of my code should not allow to remove the 2nd ReferenceId in table 1.


    Please advice.

    Thanks in advance,
    Roselyne

    Compare VO using iterators. For example code, see link below

    Problem of VORowImpl - compare two lists of LINE]

    -Anand

  • What happens when you insert/modify/delete a row in a table - concepts

    I am trying to understand the below concepts regarding the internal concepts (for example, undo and redo)

    (1) what is happening in the database when you insert a row in a table?

    (2) what is happening in the database when you update a row in a table?

    (3) what is happening in the database when you remove one line in the table?

    I have read the oracle documentation and mistook the redo and undo behavior. It would be great if someone explains the concept in a simple way.  I'm a novice programmer to understand database concepts. Any help would be much appreciated.

    INSERTIONS and deletions are handled the same way.  The cancellation of an INSERT is a DELETE.   The cancellation of a REMOVAL is an INSERT.

    Therefore, the generation 'Cancel' for INSERTION is less than that of a DELETION (because the cancellation of a DELETION is to reinsert the line - the value of each column in the row must be captured in the undo).

    If restore you an INSERT, then Oracle executes effectively a DELETE tablename WHERE rowid =... rowid_that_was_inserted.  A cancellation for an INSERTION is 'rapid '.

    If restore you a DELETION, then Oracle executes effectively an INSERT tablename values (col1, col2, coln).  The cancellation of a DELETION takes more time because Oracle would have to re-enter the values.

    Remember that Oracle also captures the redo to undo it (and do it again for the price drop if you do a restore).

    Hemant K Chitae

  • Deletion of rows in a Table

    Is it possible to have a button to remove lines in a static table?  Each line is different, but some lines may not be required depending on the customer and I was wondering if a static table lines can be deleted.  Help on it is very that much appreciated... Thank you.

    Surely you can remove lines of static Tables.

    The line that the user wants to delete should meet the following conditions.

    1 line to repeat for each item of data option must be selected

    2 min Count must be set to 0. (This will be deselct the option number of minutes, but do not worry)

    3. initial count must be set to 1 (otherwise the row will not appear in the form)

    Now write the code to remove the line; as shown below...

    Table1._Row2.removeInstance (0);

    I hope this can help...

    Join me on [email protected] if you need a sample for this.

    Nith

  • Photos taken of 20 GB of storage while the library is located on another volume

    Hello community,

    I installed macOS Sierra (on an empty SSD) two days ago, yesterday I opened pictures and changed the photo library location to another volume on my computer. The volume that I installed the OS on watch 20 GB of photos. in the storage management window. My library is on another drive and I checked the pictures folder in my home directory and it is empty.

    What is 20 GB

    Hard to say - have you rebooted?

    This is clearly not a matter of pictures but if it's a problem at all (it may need a reboot and/or time) you would probably do better in the OS forum

    LN

  • How the snippet to the filter condition?

    Hello world
    I have a doubt. I searched a lot for the explanation, but could not find.

    I have a table TAB1 with columns A(primary key), B, C source
    There's an excerpt on TAB1, ext1, which has a filter clause "* filter (@compute (c) = 1) *"
    When I do an update on TAB1 with the following query
    setting a day TAB1 value B = 100 where A = 200; *
    the redo log will not have the value of C stored for this transaction (it will have the values between A and B only according to my knowledge)
    but the snippet should check if the operation meets the filter clause 'c = 1' which cannot be controlled of redo logs
    How to check?

    I did the update, has confirmed that the update is reflected also in the target table, then checked v$ sql area for any selection made by goldengate on source table query to check the value of C for the operation but I have not found such a request

    Published by: 958073 on February 13, 2013 12:41

    Published by: 958073 on February 13, 2013 12:42

    There are two ways to do:

    (1) to activate the extra record for column C, so each time a record is updated in the table, column C is recorded in the journals of recovery. This can be done in

    GGSCI > TRANDATA ADD . TAB1 COLLARS (C)

    (2) FETCHCOLS use in the TABLE of your snippet file param clause to allow for the recovery of column c of the source database when the value is not in the record of the transaction. This can be done by adding the following

    TABLE TAB1, FETCHCOLS (C),
    FETCHBEFOREFILTER,
    FILTER (@COMPUTE = 1 (c));

  • Help needed to apply the filter condition

    I need to apply a filter condition based on the database environment:
    1. only if the database name is UAT tb1. > 23 - OCT-2012 CREATED_DT.
    2. only if the database name is OATS then tb1.application_no in ('1 ', ' 2')
    3 If the database is a different database then these conditions do not apply.

    Try this

    Select  tb1.*,tb2.* from tb1
    join tb2
    on (tb1.col1=tb2.col1)
    join (select  case when global_name='UATDB' then 'UAT'
                             when global_name='QATDB' then 'QAT'
                             else 'OTHERDB' end DB_NAME  from global_name) DB
    on 1=1
    where (DB.DB_NAME='UATDB' and tb1.CREATED_DT > 23-OCT-2012)
    or (DB.DB_NAME='QATDB' and tb1.application_no in ('1' ,'2'))
    or (DB.DB_NAME='OTHERDB');
     
    

    Note: not tested code

  • How to call SQL in the filter condition

    Hello

    Booking dashboard report, I need filter order_date between this quarter beginning date and this date of end of quarter.
    I customized data are available from quarter to quarter end date.
    How do I use the filter.

    Thank you

    Looks like you need filter the date of the order between the start of quarter and the ending quarter by ensuring that order dates is always present between the quarter start date and the date of end of quarter

    Create a report of sub with a column of order date and order date is invited.

    So now, in the report main use filter option advanced and

    Take the quarter start date column and use the advanced on this filter option. Use the results to filter based on another request. You can specify the quarter start date is greater than the date of the selected order (order reporting date column)

    and

    Take the quarter end date column and use the advanced on this filter option. Use the results to filter based on another request. You can specify the quarter end date is less than the date of the selected order (order reporting date column)

    In this way, you can force the order date always between the date of beginning of quarter and quarter end date columns

    It may be useful
    Thank you
    Prash

  • Outer join on the Filter Condition

    Hello

    I would like to show all rows in a query for two conditions to filter on the 'status '. I used an outer join on the outer query to return the values inside the inline query, but it returns not to return all rows.

    create table (test)
    ID number,
    start_date date,
    status varchar2 (1).
    number of amount,
    number of cust_type
    );


    Insert test values (001, June 1, 2014 ", am ', 189, 78");
    Insert test values (001, March 26, 2014 ", 'R', 175, 4");
    Insert test values (001, December 1, 2014 ", 'R', 89, 91");
    Insert test values ("001, 13 August 2014 ', 'J', 19, 2);
    Insert test values (001, 12 August 2014 ', 'E', 19, 2);

    Insert test values (002, January 1, 2014 ', 'R', 17, 4);
    Insert test values (002, 26 June 2014 ", 'R', 175, 4");
    Insert test values (' 002, February 1, 2014 ', 'J', 9, 8);
    Insert test values (002, 13 October 2014 ', ', 190, 2);

    Insert test values (' 003, June 1, 2014 ', 'J', 189, 78);
    Insert test values (003, March 26, 2014 ", 'R', 175, 4");
    Insert test values (003, December 1, 2014 ", 'R', 89, 91");
    Insert test values (' 003, 13 August 2014 ', 'J', 19, 2);
    Insert test values (' 003, 12 August 2014 ', 'J', 19, 2);

    commit;

    Select i.ids, i.start_date, i.cust_type, i.amount as gross_amount, i.amount + ii.amount as net_amount
    test I have,
    (select id, amount)
    of the test
    where (status = status or 'R' = 'J')) ii
    where i.cust_type in (4, 78, 91, 2, 4, 8)
    and i.ids (+) = ii.ids
    and i.status (+) to (', 'E')
    "and i.start_date between 1 January 14 ' and 31-dec-2014."

    The query above exclude ID 003 because there is that no status (M / E) butI want always display all codes, even if the condition is not consistent

    Hello

    Want results from an inner join to match identifiers, but the results of an outer join for identifiers that are not?  In other words, you want to include the rows of the table I only when one of the following is true:

    The line of table I have ticked all the boxes, or

    No line in not table i with the same ID meets all conditions

    ?

    If so, here's a way to do it:

    WITH got_rnk AS

    (

    Select i.ids, i.start_date, i.cust_type

    , nvl2 (ii.ids, i.amount, 0) as gross_amount

    , i.amount + nvl (ii.amount, 0) as net_amount

    dense_rank () over (partition of i.ids

    order of nvl2 (ii.ids, 'A', 'B')

    ) as rnk

    I have test

    (in left outer join

    SELECT ID, amount

    of the test

    where status ('R', 'J')

    ) ii on i.ids = ii.ids

    and i.cust_type in (4, 78, 91, 2, 4, 8)

    and i.start_date between to_date (January 1, 2014 ", 'dd-mon-yyyy')

    and to_date (31-dec-2014', 'dd-mon-yyyy')

    and i.status in (', 'E')

    )

    SELECT ID, start_date, cust_type

    gross_amount, net_amount

    of got_rnk

    where rnk = 1

    ;

    Results of your sample data:

    ID START_DATE GROSS_AMOUNT NET_AMOUNT CUST_TYPE

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

    1 1 June 2014 78 189 364

    1 1 June 2014 78 189 278

    1 1 June 2014 78 189 208

    1 12 August 2014 2 19 38

    1 12 August 2014 2 19 108

    1 12 August 2014 2 19 194

    2 13 October 2014 2 190 207

    2 13 October 2014 2 190 365

    2 13 October 2014 2 190 199

    3 March 26, 2014 4 0 175

    3 1 June 2014 78 0 189

    3 12 August 2014 2 0 19

    3 August 13, 2014 2 0 19

    3 1 December 2014 91 0 89

  • AID GROUP BY IN THE FILTER CONDITION

    Hello

    I'm trying to filter the report based on the account number and year, for specific account numbers, that I want the limit by fiscal 2010, for others I want every year starting in 2007. How can I group under filters in OBIEE.

    Ex: for numbers 1000, 1001, 1002, 1003 account I want to pull records for the year 2010. For 7000, 7003, 7700 account numbers I want to shoot in 2007, 2008, 2009.

    I'm new to OBIEE. Need help.

    Thank you.

    You can create a new column in response to logic

    Case when account_numer in (1000, 1001, 1002, 1003) and  year in (2010) then 1
           when account_numbers  in (7000, 7003, 7700 ) then year in (2007, 2008, 2009) then 1
    else 2
    end
    

    Now apply filter on the column where the value = 1

    See you soon
    Katia

  • How to apply the filter to a specific column condition, but not to the report?

    Hello

    I'm having a problem in the application of a filter to one of the column condition.
    I have a scheme with the table around 10 dimension tables and a fact. My requirement is to provide a count on the table of facts with associated with some other columns in the dimension tables.

    Lets consider a scenario with tables as sales (Fact), region (Dimension), Year (Dimension), Type of sale (Dimension).

    Now my requirement is to highlight the fields

    City (Region) - city
    Year-
    Sales Count (dirty table) - number of all sales of the fact table
    Sales Count (dirty table) - count of all sales of the fact which type of sale table is 'Cash'

    Here, my question is how to apply the filter condition of Sales Type = 'MONEY in' only on one of the Sales Count column that comes from the fact table. I want to be ordered for the fourth column, the filter condition.

    Can someone let me know how?

    Thank you

    You must do this:

    1) click the button column fx sales. (This procedure does than on fact, not attributes.0

    2) click on the filter button.

    (3) select the size of sales from the left Type "selection list."

    (4) in the filter window, enter CASH, and click OK.

    This will create one filter on sales 'use' size 'type sales' as the filter. It willl filter only to this column.

  • Error in the use of a variable in the filter in an Interface condition

    Hi all
    I use a variable in my interface in a filter condition. I have a the scott schema EMP table and want to get all records with date date of hire ranging between 2 dates, progressive traction. To do this, I created 2 variables and their use in the filter condition. I get an error in the interface when I run in a package after declaring and refresing variables.
    com.sunopsis.sql.SnpsMissingParametersException: missing parameter

    at com.sunopsis.sql.SnpsQuery.completeHostVariable (SnpsQuery.java)

    at com.sunopsis.sql.SnpsQuery.updateExecStatement (SnpsQuery.java)

    at com.sunopsis.sql.SnpsQuery.executeUpdate (SnpsQuery.java)

    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execStdOrders (SnpSessTaskSql.java)

    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt (SnpSessTaskSql.java)

    at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt (SnpSessTaskSqlI.java)

    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask (SnpSessTaskSql.java)

    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep (SnpSessStep.java)

    at com.sunopsis.dwg.dbobj.SnpSession.treatSession (SnpSession.java)

    at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand (DwgCommandSession.java)

    at com.sunopsis.dwg.cmd.DwgCommandBase.execute (DwgCommandBase.java)

    at com.sunopsis.dwg.cmd.e.i (e.java)

    at com.sunopsis.dwg.cmd.g.y (g.java)

    at com.sunopsis.dwg.cmd.e.run (e.java)

    at java.lang.Thread.run (unknown Source)

    Kind regards
    Krishna

    Hello Krishna,

    What is the data type of the Variable lastupdate?

    In my case

    Variable
    ----------
    Name: LastUpdateDate
    DataType: alphanumeric
    Action: Historize
    Query: select to_char (to_date(sysdate,'DD-MON-YY'), 'DD-MON-YY') of sys.dual

    Then I used in the filter

    EMP. HIREDATE > to_date('#LastUpdateDate','DD-mon-YY')

    Thank you
    Fati

  • Use the dynamic filter Condition in the mapping

    Hello

    I tried to use a dynamic filter condition in my correspondence.

    I wrote this condition as:

    INOUTGRP1. Numer1 = ' | Number 1 | '
    and INOUTGRP1. Number2 = ' | Number2 '

    Number1 and number2 are setting for mapping entry, now I want to use the input parameter for the Filter Condition.

    Can someone tell me how I can handle this?

    Thanks in advance.

    Greetings

    You used wrong input parameters.
    Rather a link an input parameter to the operator to filter, then you can insert it from list of attributes as long as the same way as other attributes of filter operator group

    Kind regards
    Oleg

  • I put the filter for my file flat source?

    Hi all
    Please help me with best practices of ODI.
    My source is the flat file and I want to put the filter.

    I put the filter for my file flat source? If so, please help me with best practices from the application of the filter.

    Concerning
    Suresh

    Hello

    If you try to create--> Datastore model---> filter---> Insert condition
    then it will not work for files technology. You will get "Invalid Format Description"

    But you can specify a filter in the interface.
    Just drag the columns in your flat file of data store into the canvas and then specify the filter condition.

    Thank you
    Fati

Maybe you are looking for