Delete rows on basis of other table

I am trying to delete records from table PS_BUN_CM on basis of table PS_BUN_UPDATE ...
below is the select statment which i want to convert to delete ... Please help
select *  FROM PS_BUN_CM a
inner join PS_BUN_UPDATE c on a.MAP_ID = c.MAP_ID
where a.ps_map_id in ('2400') and (a.las_name = 'NA' or a.las_name = 'na')and (c.LAS_NAME <> '  ');  

Not sure, how it is deleting all rows at your end. Please see below test
create table PS_BUN_CM(MAP_ID number,PS_MAP_ID varchar2(10),las_name varchar2(100))
Insert into PS_BUN_CM(MAP_ID, PS_MAP_ID, LAS_NAME)
Values(100, '10', 'abc')
Insert into PS_BUN_CM(MAP_ID, PS_MAP_ID, LAS_NAME)
Values(100, '100', 'NA')
Insert into PS_BUN_CM(MAP_ID, PS_MAP_ID, LAS_NAME)
Values(100, '100', 'na')
Insert into PS_BUN_CM(MAP_ID, PS_MAP_ID, LAS_NAME)
Values(1000000, '10022', 'na')
Insert into PS_BUN_CM(MAP_ID, PS_MAP_ID, LAS_NAME)
Values(100, '2400', 'na')
COMMIT
SQL> select * from ps_bun_cm;
    MAP_ID PS_MAP_ID  LAS_NAME
    100    10         abc
    100    100        NA
    100    100        na
   1000000 10022      na
    100    2400       na
SQL>
create table PS_BUN_UPDATE(MAP_ID number,las_name varchar2(100))
Insert into PS_BUN_UPDATE(MAP_ID, LAS_NAME)
Values(100, 'xyz')
Insert into PS_BUN_UPDATE(MAP_ID, LAS_NAME)
Values(100, '  ') 
COMMIT
SQL> select a.*,length(las_name)  from ps_bun_update a;
    MAP_ID  LAS_NAME   LENGTH(A.LAS_NAME)
    100     xyz           3
    100                   2
SQL>
SQL>select a.* from PS_BUN_CM a
  2 inner join PS_BUN_UPDATE c on a.map_id=c.map_id
  3 where a.ps_map_id in('2400') and (a.las_name='NA' or a.las_name='na')
  4 and c.las_name='  ';
    MAP_ID  PS_MAP_ID LAS_NAME
    100       2400     na
SQL> select * from     ps_bun_cm a
  2  where exists(select 1 from ps_bun_update c
  3               where a.map_id=c.map_id
  4               and a.ps_map_id in('2400')
  5               and (a.las_name='NA' or a.las_name='na')
  6               and c.las_name='  '
  7               ) ;
    MAP_ID  PS_MAP_ID  LAS_NAME
       100       2400   na
SQL> ed
Wrote file afiedt.buf
  1  delete from     ps_bun_cm a
  2  where exists(select 1 from ps_bun_update c
  3               where a.map_id=c.map_id
  4               and a.ps_map_id in('2400')
  5               and (a.las_name='NA' or a.las_name='na')
  6               and c.las_name='  '
  7*              )
SQL> /
1 row deleted.
SQL> select * from PS_BUN_CM;
    MAP_ID PS_MAP_ID  LAS_NAME
     100   10         abc
     100   100        NA
     100   100        na
   1000000 10022      na
SQL>

Similar Messages

  • How we can restrict record in CTL file on the basis of other table ?

    Hello all,
    How we can restrict record in CTL file on the basis of other table ?
    Eg.
    I have following control file to load the records in the table through the sql loader.
    LOAD DATA
    INTO TABLE THIST APPEND
    FIELDS TERMINATED BY "|" TRAILING NULLCOLS
    LNUM POSITION(1) Char "substr(:LOAN_NUM, 4, 13)",
    TSRNUM Char "rtrim:TRAN_SR_NUM)" ,
    TPROCDT Char "to_char(to_date rtrim:TRAN_PROC_DT), 'MMDDYYYY'), 'YYYYMMDD')"      
    I have another table c all TFILE in which I have LNUM. I want to import only those records from input text file using the control file and sql loader in which LNUM is exist in the TFILE.
    So how i can restrict it in the Control File.
    Thanks
    Kamlesh Gujarathi
    [email protected]

    Hello Satyaki De.
    Thank you very much for your suggestion but my Private information is totally apart from this question & I already I have changed each and every information from the question.
    Thanks
    Kamlesh Gujarathi
    [email protected]

  • Deleting rows by key from several tables

    Hello! 
    One of action of my stored procedure is deleting rows from several tables on a key , that I'm getting through statement :
    delete from table3 where key_column in ();
    delete from table4 where key_column in ();
    commit;
    select key_column from Table!
    minus
    select key_column from Table2
    Unfortunately the number of lines mentioned by this statement isn't known in advance .
    How do You think , is better way to
    -- execute select each time for every delete-statement or
    -- create table as select result set and then select again keys for each delete- ststement or
    I'm usung 11.2.0.3
    Thanks and regards,
    Pavel

    By using : 1.trigger 2. on delete cascade you can achieve this.
    OraFAQ Forum: SQL &amp;amp; PL/SQL &amp;raquo; delete rows from multiple tables (more than 2 tables)
    Regards
    Girish Sharma

  • Deleting record on basis of master table ID

    Hello,
    SQL> desc news
    Name                                      Null?    Type
    NEWS_ID                                   NOT NULL NUMBER(14)
    NEWS_DATE                                          TIMESTAMP(0)
    SL_ID                                              NUMBER(2)
    HEADING                                            VARCHAR2(3120)
    DESCRIPTION                                        VARCHAR2(3900)
    SQL> desc news_location
    Name                                      Null?    Type
    NEWS_ID                                            NUMBER(14)
    COUNTRY                                            VARCHAR2(32)
    REGION                                             NUMBER(2)
    SQL> desc news_product
    Name                                      Null?    Type
    NEWS_ID                                            NUMBER(14)
    PRODUCT_CATEGORY_ID                       NOT NULL NUMBER(14)
    PRODUCT                                            VARCHAR2(27)
    SQL> desc news_service
    Name                                      Null?    Type
    NEWS_ID                                            NUMBER(14)
    SERVICE_ID                                NOT NULL NUMBER(14)
    SRVIS                                              VARCHAR2(16)
    SQL> desc news_info
    Name                                      Null?    Type
    NEWS_ID                                            NUMBER(14)
    SOURCE                                             VARCHAR2(203)
    ORIGIONAL_NEWS                                     VARCHAR2(3900)
    HEADING                                            VARCHAR2(3110)
    SQL> select count(*) from news where TO_CHAR(news_date,'YYYY') <  2012;
      COUNT(*)
          8759I am trying to delete news that are published before 2012 but detail tables consists child record on basis of news_id. Certainly simple delete query will not work
    Please advise and thanks in anticipation

    Thanks again for favorable replies
    SQL> alter table news_info drop constraint NEWS_INFO_FK;
    Table altered.
    SQL> alter table news_info add constraint NEWS_INFO_FK FOREIGN KEY (news_id) REF
    ERENCES   news(news_id) on delete cascade enable novalidate ;
    Table altered.
    SQL> alter table news_info modify constraint NEWS_INFO_FK validate ;
    Table altered.
    SQL> alter table news_location drop constraint NEWS_LOCATION_FK;
    Table altered.
    SQL> alter table news_location add constraint NEWS_LOCATION_FK FOREIGN KEY (news
    _id) REFERENCES   news(news_id) on delete cascade enable novalidate ;
    Table altered.
    SQL> alter table news_location modify constraint NEWS_LOCATION_FK validate ;
    Table altered.
    SQL> alter table news_PRODUCT drop constraint NEWS_PRODUCT_FK;
    Table altered.
    SQL> alter table news_PRODUCT add constraint NEWS_PRODUCT_FK FOREIGN KEY (news_i
    d) REFERENCES   news(news_id) on delete cascade enable novalidate ;
    Table altered.
    SQL> alter table news_PRODUCT modify constraint NEWS_PRODUCT_FK validate ;
    Table altered.
    SQL> alter table news_SERVICE drop constraint NEWS_SERVICE_FK;
    Table altered.
    SQL> alter table news_SERVICE add constraint NEWS_SERVICE_FK FOREIGN KEY (news_i
    d) REFERENCES   news(news_id) on delete cascade enable novalidate ;
    Table altered.
    SQL> alter table news_SERVICE modify constraint NEWS_SERVICE_FK validate ;
    Table altered.
    SQL> delete from news where TO_CHAR(news_date,'YYYY') <  2008 ON DELETE CASCADE;
    delete from news where TO_CHAR(news_date,'YYYY') <  2008 ON DELETE CASCADE
    ERROR at line 1:
    ORA-00933: SQL command not properly ended
    SQL> select constraint_name, constraint_type, table_name, delete_rule
      2    from user_constraints
      3   where constraint_name= 'NEWS_SERVICE_FK';
    CONSTRAINT_NAME                C TABLE_NAME                     DELETE_RU
    NEWS_SERVICE_FK                R NEWS_SERVICE                   CASCADE
    SQL> select constraint_name, constraint_type, table_name, delete_rule
      2    from user_constraints
      3   where constraint_name= 'NEWS_PRODUCT_FK';
    CONSTRAINT_NAME                C TABLE_NAME                     DELETE_RU
    NEWS_PRODUCT_FK                R NEWS_PRODUCT                   CASCADE
    SQL> select constraint_name, constraint_type, table_name, delete_rule
      2    from user_constraints
      3   where constraint_name= 'NEWS_LOCATION_FK';
    CONSTRAINT_NAME                C TABLE_NAME                     DELETE_RU
    NEWS_LOCATION_FK               R NEWS_LOCATION                  CASCADE
    SQL> select constraint_name, constraint_type, table_name, delete_rule
      2    from user_constraints
      3   where constraint_name= 'NEWS_INFO_FK';
    CONSTRAINT_NAME                C TABLE_NAME                     DELETE_RU
    NEWS_INFO_FK                   R NEWS_INFO                      CASCADE
    SQL> delete from news where TO_CHAR(news_date,'YYYY') <  2008 ON DELETE CASCADE;
    delete from news where TO_CHAR(news_date,'YYYY') <  2008 ON DELETE CASCADE
    ERROR at line 1:
    ORA-00933: SQL command not properly ended
    SQL>Edited by: Christy H. on Jan 17, 2013 1:58 AM
    I removed ON DELETE CASCADE and ran again delete from news where TO_CHAR(news_date,'YYYY') <  2008; Wow deleted!!
    This forum is miracle to learn oracle. Thanks from the bottom of my heart

  • Delete rows in Pages in a table for iOS

    I created a table in Pages for iOS, I am trying to delete a row within tables. How do I delete a row or rows?

    Thank you Picas for your response. I already knew and tried your suggestion. What failed to clarify is that I am attempting to delete a row in the middle of the table. Using the down/up arrow icon does not delete the row I am attempting to delete. I would appreciate any further suggestions you may have. Thanks again.

  • How to delete rows in the SQL Server table based on the contents of Excel file

    Hello, everyone,
    I have an Excel file which contains data for certain dates. I need to load it in a SQL Server table. But before doing that, I need to check if the table already contains data for the dates in the Excel file. If it does, I need to delete those data
    first. Not sure what is the best and efficient way to do this. Your help and guidance would be much appreciated.
    Thank you in advance.

    there are multiple ways of doing this
    Fastest method would be below
    1. Have a data flow task using excel source. Then add a OLEDB destination to dump the data to a staging table
    2. Have a Execute sql task to delete data from your actual table based on staging table data. The query would look like
    DELETE t
    FROM YourTable t
    WHERE EXISTS (SELECT 1
    FROM StagingTable
    WHERE DateField = t.DateField)
    3. Have another execute sql task to do final insert like
    INSERT YourTable (Col1,Col2,...)
    SELECT Col1,Col2,..
    FROM StagingTable
    the above operations will be set based and faster
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • DELETED rows from internal table

    Hi Experts,
    If I delete row/s from an internal table
    using the command DELETE ADJACENT DUPLICATES,
    is there a way to get these deleted rows.
    Thanks in advance.
    Rose

    Hi roselie,
    1. ofcourse not.
    2.hence, before that,
      u can declare another internal table,
      similar to original,
      and use like this.
    3. ITAB1[]   = ORIGINALITAB[].
    regards,
    amit m.

  • Delete rows from table...Bizarre problem.

    Folks
    i HAVE this bizarre problem.
    I hava a Java class which displays data read into a table with a delete
    option by the side of each row.
    Now lets assume you have 3 rows in the Table.
    abc deleteButton
    efg deleteButton
    xyz deleteButton
    When I click the first delete,that row gets deleted from the table.(perfect...)
    Now I have 2 rows.
    When I click on the first row,I get the error
    'You clicked -1'
    java.lang.ArrayIndexOutofBoundsException: -1 < 0.
    Can anyone tell me why this is happening even though there are rows in the table.???
    ActionListener al = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    System.out.println("You clicked row : " + table.getSelectedRow());
    javax.swing.table.TableModel model = table.getModel();
    Object o = model.getValueAt(table.getSelectedRow(),0);
    //System.out.print(model.getValueAt(table.getSelectedRow(), 0));
    //System.out.println();
    MyDeleteFunction(o.toString());
    // Delete row from window.
    ((DefaultTableModel)table.getModel()).removeRow(table.getSelectedRow());
    table.revalidate();
    table.repaint();

    Hi ritu,
    This class is called
    new DisplayCall_IDTodisconnect(hashTable);
    its a long file.
    its attached below.
    The rows are displayed by reading a hashtable into a vector
    and the vector is iterated and appended..
    public class DisplayCall_IDToDisconnect {
    public static JTable createTable(Vector data, String buttonLabel, ActionListener action){
    return createTable(data.iterator(), buttonLabel, action);
    public static JTable createTable(
    Iterator dataIterator,
    String buttonLabel,
    ActionListener action) {
    DefaultTableModel model = new DefaultTableModel() {
    public boolean isCellEditable(int row, int col) {
    return col == 1;
    model.setColumnCount(2);
    while (dataIterator.hasNext()) {
    Object[] row = { dataIterator.next().toString(), null };
    model.addRow(row);
    DefaultTableColumnModel columnModel = new DefaultTableColumnModel();
    columnModel.addColumn(new TableColumn(0, 100));
    columnModel.addColumn(new TableColumn(1, 80,
    new TableButtonCellRenderer(buttonLabel),
    new TableButtonCellEditor(buttonLabel, action)
    JTable table = new JTable(model, columnModel) {
    public void valueChanged(ListSelectionEvent e) {
    super.valueChanged(e);
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    return table;
    private static class TableButtonCellRenderer implements TableCellRenderer {
    final JButton button;
    TableButtonCellRenderer(String buttonLabel) {
    button = new JButton(buttonLabel);
    public Component getTableCellRendererComponent(
    JTable table,
    Object value,
    boolean isSelected,
    boolean hasFocus, int row, int column) {
    return button;
    private static class TableButtonCellEditor
    extends AbstractCellEditor
    implements TableCellEditor, ActionListener {
    final JButton button;
    final ActionListener callback;
    TableButtonCellEditor(String buttonLabel, ActionListener callback) {
    button = new JButton(buttonLabel);
    this.callback = callback;
    button.addActionListener(this);
    public Component getTableCellEditorComponent(
    JTable table,
    Object value,
    boolean isSelected,
    int row, int column) {
    return button;
    public Object getCellEditorValue() {
    return null;
    public void actionPerformed(ActionEvent e) {
    button.getParent().requestFocus();
    callback.actionPerformed(e);
    static JTable table;
    Vector items;
    final ClientManager clientMgr;
    // Constructor.
    public DisplayCall_IDToDisconnect(Hashtable callLegTable,ClientManager clientMgr){
    Vector vCSeqnos = displayCSeqNos(callLegTable);
    this.clientMgr = clientMgr;
    JFrame frame = new JFrame("Disconnect Options");
    /*Vector*/ items = new Vector();
    Enumeration vEnum = vCSeqnos.elements();
    while(vEnum.hasMoreElements()){
    items.add(vEnum.nextElement());
    ActionListener al = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    //System.out.println("You clicked row ,col: " + table.getSelectedRow()+
    // table.getSelectedColumn());
    javax.swing.table.TableModel model = table.getModel();
    Object o = model.getValueAt(table.getSelectedRow(),0);
    System.out.print(model.getValueAt(table.getSelectedRow(), 0));
    System.out.println();
    closeConnection(o.toString());
    // Delete row from window too.
    ((DefaultTableModel)table.getModel()).removeRow(table.getSelectedRow());
    table.revalidate();
    table = DisplayCSeqNos.createTable(items, "Disconnect", al);
    frame.getContentPane().add(new JScrollPane(table));
    frame.pack();
    frame.show();
    } // End Constructor.
    public void closeConnection(String s){
    /*1. Disconnect the current session*/
    this.clientMgr.disconnectCall(s);
    /*2. refresh the Disconnect window*/
    this.refreshWindow();
    public Vector displayCSeqNos(Hashtable callLegTable){
    Enumeration eNum;
    String str;
    Vector v = new Vector();
    eNum=callLegTable.keys();
    while(eNum.hasMoreElements()){
    str = (String) eNum.nextElement();
    //System.out.println("Key : " + str + " Value : " + callLegTable.get(str));
    v.addElement(str);
    return v;
    } // End of displayCSeqNos.

  • Deleting rows.

    I have a CORD_LOB_MAPPING table which has a line_of_business as a column
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    D2>DESC CORD_LOB_MAPPING
    Name Null? Type
    LINE_OF_BUSINESS NOT NULL VARCHAR2(10)
    LOB_DESCRIPTION VARCHAR2(100)
    LOB_SID NOT NULL VARCHAR2(10)
    D2>SELECT LINE_OF_BUSINESS FROM CORD_LOB_MAPPING;
    LINE_OF_BU
    OPNRCH
    OPNWLD
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    I have the following 3 tables:
    I want to delete rows from all the 3 tables depending on the follwoing rule.
    In all the 3 tables i want to retain those rows whose data is present in CORD_LOB_MAPPING's line_of_business column
    All those rows which do not corrospond to the line_of_business in CORD_LOB_MAPPING should be deleted.
    For example, in the example given below, i am deleteing all rows from TMP_CORD_OUCS whose line_of_business
    does not match with CORD_LOB_MAPPING line_of_business.
    In other words, delete all rows which do not belong to OPNRCH and OPNWLD
    DELETE FROM TMP_CORD_OUCS TCO
    WHERE NOT EXISTS ( SELECT 1 FROM CORD_LOB_MAPPING CLM
    WHERE UPPER(TCO.LINE_OF_BUSINESS) = UPPER(CLM.LINE_OF_BUSINESS));
    D2>DESC tmp_cord_oucs
    Name Null? Type
    OUC_CODE VARCHAR2(9)
    LATEST_PERIOD NUMBER(10)
    OUC_PROCESS_FLAG VARCHAR2(1)
    LINE_OF_BUSINESS VARCHAR2(10)
    I want to know the delete statement for this table?
    Delete all those rows from tmp_cord_rate_ids whose line_of_business is anything except OPNRCH and OPNWLD
    DELETE FROM TMP_CORD_RATE_IDS TCRI
    WHERE NOT EXISTS (SELECT 1
              FROM TMP_CORD_OUCS TCO, CORD_LOB_MAPPING CLM
              WHERE TCO.LINE_OF_BUSINESS=CLM.LINE_OF_BUSINESS
              AND TCRI.OUC_CODE=TCO.OUC_CODE)
    D2>DESC tmp_cord_rate_ids
    Name Null? Type
    OUC_CODE VARCHAR2(9)
    RATE_ID VARCHAR2(5)
    RATEID_PROCESS_FLAG VARCHAR2(1)
    I want to know the delete statement for this table?
    Delete all those rows from tmp_cord_rates whose line_of_business is anything except OPNRCH and OPNWLD
    D2>DESC TMP_CORD_RATES
    Name Null? Type
    RATE_ID VARCHAR2(5)
    RATE NUMBER(13,4)
    RATE_PROCESS_FLAG VARCHAR2(1)

    Hi folks,
    I will explain again.
    I have a table
    D2>DESC CORD_LOB_MAPPING
    Name Null? Type
    LINE_OF_BUSINESS NOT NULL VARCHAR2(10)
    LOB_DESCRIPTION VARCHAR2(100)
    LOB_SID NOT NULL VARCHAR2(10)
    I have a column in cord_lob_mapping as line_of_business.
    Now i want to delete rows from all the following 3 tables whose rows do not match up with line_of_business of cord_lob_mapping.
    D2>DESC tmp_cord_rates
    Name Null? Type
    RATE_ID VARCHAR2(5)
    RATE NUMBER(13,4)
    RATE_PROCESS_FLAG VARCHAR2(1)
    D2>DESC tmp_cord_rate_ids
    Name Null? Type
    OUC_CODE VARCHAR2(9)
    RATE_ID VARCHAR2(5)
    RATEID_PROCESS_FLAG VARCHAR2(1)
    D2>DESC tmp_cord_oucs
    Name Null? Type
    OUC_CODE VARCHAR2(9)
    LATEST_PERIOD NUMBER(10)
    OUC_PROCESS_FLAG VARCHAR2(1)
    LINE_OF_BUSINESS VARCHAR2(10)
    Suppose the cord_lob_mapping table has the following rows in line_of_business
    column
    Line_of_business
    world
    universe
    Now all rows from tmp_cord_oucs whose line_of_business is not world or universe should be deleted.
    Simillarly, all corrosponding rates from tmp_cord_rates and rate_ids from tmp_cord_rate_ids should also be deleted whose line_of_business is not world or universe.
    I have included the delete statements for each of the 3 tables. Could anyone of you please verify them to be correct.
    delete from tmp_cord_rates tcr
    where not exists(select 1
         from cord_lob_mapping clm, tmp_cord_oucs tco, tmp_cord_rate_ids tcri     where clm.line_of_business=tco.lob_mapping
         and tco.ouc_code=tcri.ouc_code
         and tcri.rate_id=tcr.rate_id);
    delete from tmp_cord_rate_ids tcri
    where not exists(select 1
         from cord_lob_mapping clm, tmp_cord_oucs tco
         where clm.line_of_business=tco.lob_mapping
         and tco.ouc_code=tcri.ouc_code);
    delete from tmp_cord_oucs tco
    where not exists(select 1
         from cord_lob_mapping clm
         where clm.line_of_business=tco.lob_mapping);

  • Replicate deleted rows through Archiver

    Hi all
    I'm trying to replicate deleted rows from a custom UCM table, but when a record is deleted from the source table, the deleted record doesn't get replicated to the target table through Archiver.
    The source archive is setup to export and transfer automatically. Also, the "replicate deleted rows" option is ticked on the source archive and the recommended Create and Modify time stamp columns are selected.
    I'm deleting the records through the Configuration Manager applet after creating a view on the table.
    I can see that new rows (the deleted record) are added into the "DeletedRows" table but they don't get deleted on the target instance. Am I missing anything else?
    Regards,
    Alex
    Edited by: user8859325 on Jan 18, 2013 2:28 AM

    Hi
    I have done other tests and can see that there is first of all a problem with the strSQL = strSQL & " AND PeriodKey = '" & dtePerKey & "'"
    in the where clause.
    If I execute this SQL request in SQL Developer, I have a non-zero number in the TMP table :
    INSERT INTO TMP (SELECT COUNT(*) FROM tDataSeg3 WHERE PartitionKey='749' AND CatKey = '12' AND PeriodKey = to_date('30/04/10'))If I execute the same request through FDM, I have 0 in the TMP table.
    Thanks for your help
    Fanny

  • Table layout w.r.t other tables and text while inserting/deleting rows.

    I have 3 tables in a single page. One is left aligned and other two are right aligned. Then there is some text below the tables. 
    Now when I delete some rows from Table-1 the left aligned one, the Table 2 and text shift up filling the space below Table1.
    Now I don't want the text/table to shift up/down when I add/delete rows from Table1 i.e Table1  should expand/contract in the empty space below it.
    Now If I do the same thing for Table3 (Right aligned one) i.e add/delete rows there is no effect on text as shown :
    All 3 tables are same and have exact positioning and other properties.
    Please suggest any solution as I would be populating the table through word automation service (interop).

    Another approach would be to use nested tables, with your 'outer' table having two columns and the inner tables going into different columns. You can hide the outer table's cell borders so its presence is less apparent. If the Outer table has auto row
    height, it will adjust to accommodate whatever row addition/deletion you do to the inner tables. The only proviso is that the inner tables shouldn't have 'around' text wrapping. The two rhs tables can go into the same cell - all they need is a separating paragraph.
    With this layout, the text will always remain below the outer table.
    Cheers
    Paul Edstein
    [MS MVP - Word]

  • How to delete the source table rows once loaded in Destination Table in SSIS?

    Data Base=kssdata
    Tables= Userdetails having 1000 rows
    Using SSIS: 
    Taking A  
    OLE DB Source----------------->OLE DB Destination
    Am Taking 200 rows in Source table and loaded into Destination table once
    Constraint: here once 200 rows are exported in destination table , that 200 rows are deleted in source table
    repeat the task as source table all the records are loaded into Destination table 
    After that am taking another 200 rows in source table and loaded into Destination table

    Provided you've a sequential primary key  or audit timestamp (datetime/date) column in the table you can do an approach like this
    1. Add a execute sql task connectng to source db with below statement
    SELECT COUNT(*) FROM table
    Store the result in a variable
    2. Have another variable and set it to below expression
    (@[User::CountVariable]/200) + (@[User::CountVariable]%200 >0? 1:0)
    by setting EvaluatesExpression as true. Here CountVariable is variable created in previous step
    3. Have a for loop container with below settings
    InitExpression
    @NewVariable = @CounterVariable
    EvalExpression
    @NewVariable > 0
    AssignExpression
    @NewVariable = @NewVariable - 1
    3. Add a data flow task with OLEDB source and OLEDB Destination
    4. Use source query as
    SELECT TOP 200 columns...
    FROM Table
    ORDER BY [PK | AuditColumn]
    Use PK or audit column depending which one is sequential
    5. After data flow task have a execute sql task with statement as below
    DELETE t
    FROM (SELECT ROW_NUMBER() OVER (ORDER BY PK) AS Rn
    FROM Table)t
    WHERE Rn <= 200
    This will make sure the 200 records gets deleted each time
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Problem with creating and deleting row in table

    Hi
    I'm using JDev11.1.1.2.0. I have a table "A" with primary key X -> CHAR(1). I have created Entity and ViewObject (with the primary key X).
    I created an editable Table with CreateInsert and Delete actions.
    When I click Insert, a new record is added and I enter some data. Then I move selection to some other row, and return back to the new row. When I press Delete, It does not delete the new row, but the previous one selected.
    In the console, when I navigate back two the new added record: <FacesCtrlHierBinding$FacesModel><makeCurrent> ADFv: No row found for rowKey: [oracle.jbo.Key[null ]].
    I tried the same scenario with a different table, that has RowID as a primary key and it works correctly.
    Any Idea why this is happening ? I suppose it's connected somehow with the primary key.
    Thanks
    agruev
    Edited by: a.gruev on Nov 26, 2009 9:47 AM

    I changed my entity: unchecked the X column to be primary key added RowID as a primary key. Now it works.
    What's wrong with my CHAR(1) as a primary key ?
    I also tried to add a Refresh button:
      <af:commandButton text="Refresh" id="cb3"/>and in the table add a partialTarget to the button. Now when I add new row and press the Refresh button - then it works.
    So it seems that the problem is when I add new row and enter data, the table is not refreshed and the row is missing it's primary key.
    Any solutions?
    Edited by: a.gruev on Nov 26, 2009 4:18 PM

  • How to Restore deleted records in other table in oracle database 10g...

    Hi All,
    i want to restore deleted records of a particular table in other table
    suppose:
    i perform a query
    delete from emp
    where deptno =30;
    now i wont to restore deptno=30 records in other table, let say in emp1 table
    can any one let me know how to do it?
    Thanks..

    This is what flashback query is for:
    orclz> conn scott/tiger
    Connected.
    orclz> select count(*) from emp;
      COUNT(*)
            14
    orclz> delete from emp where deptno=30;
    6 rows deleted.
    orclz> commit;
    Commit complete.
    orclz> create table deleted30 as select * from emp as of timestamp(systimestamp - 5/1440) where deptno=30;
    Table created.
    orclz> select count(*) from deleted30;
      COUNT(*)
             6
    orclz>

  • Database, Dataset, Table Adaptors Error "Unable to load, Update requires a valid DeleteCommand when passed DataRow collection with deleted row"

    Microsoft Visual Basic 2010 Express.
    I am new to Visual Basic programing and i am trying to understand the relationships between Datasets, database, table Adaptors. I have to following code that is is giving me the following error" Unable to load, Update requires a valid DeleteCommand
    when passed DataRow collection with deleted rows". 
    I can track the error and its located in "OffsetTableTableAdapter.Update(MaterionOffsetDataSet.OffsetTable)" code. What am i missing?
    It seems that i can delete the data on the DataGridView Table and it only displays the correct data. but my database is not updating, even though the data grid displays differently.I can determine this because, when i save the offset database, i have all
    the previous uploads and all the rows that i wanted to delete are still there.
    My final goal is to be able to import offset data from a CSV file, save this data on the pc, send a copy of this data to a NuermicUpDown so the customer can modify certain numbers. From here they download all the date to a controller.  IF the customer
    needs to modify the imported data, they can go to a tab with a data grid view and modify the table. They will also have to option to save the modified data into a csv file.  
    Im not sure if i am making this overcomplicated or if there is a easier way to program this.
    CODE:
    Private Function LoadOffSetData()
            Dim LoadOffsetDialog As New OpenFileDialog 'create a new open file dialog and setup its parameters
            LoadOffsetDialog.DefaultExt = "csv"
            LoadOffsetDialog.Filter = "csv|*.csv"
            LoadOffsetDialog.Title = "Load Offset Data"
            LoadOffsetDialog.FileName = "RollCoaterOffset.csv"
            If LoadOffsetDialog.ShowDialog() = Windows.Forms.DialogResult.OK Then  'show the dialog and if the result is ok then
                Try
                    Dim myStream As New System.IO.StreamReader(LoadOffsetDialog.OpenFile) 'try to open the file with a stream reader
                    If (myStream IsNot Nothing) Then 'if the file is valid
                        For Each oldRow As MaterionOffsetDataSet.OffsetTableRow In MaterionOffsetDataSet.OffsetTable.Rows
                            oldRow.Delete()                       
    'delete all of the existing rows
                        Next
                        'OffsetTableTableAdapter.Update(MaterionOffsetDataSet.OffsetTable)
                        Dim rowvalue As String
                        Dim cellvalue(25) As String
                        'Reading CSV file content
                        While myStream.Peek() <> -1
                            Dim NRow As MaterionOffsetDataSet.OffsetTableRow
                            rowvalue = myStream.ReadLine()
                            cellvalue = rowvalue.Split(","c) 'check what is ur separator
                            NRow = MaterionOffsetDataSet.OffsetTable.Rows.Add(cellvalue)
                            Me.OffsetTableTableAdapter.Update(NRow)
                        End While
                        Me.OffsetTableTableAdapter.Update(MaterionOffsetDataSet.OffsetTable)
                        MainOffset.Value = OffsetTableTableAdapter.MainOffsetValue          'saves all the table offsets
    to the offset numericUpDown registers in the main window
                        StationOffset01.Value = OffsetTableTableAdapter.Station01Value
                        StationOffset02.Value = OffsetTableTableAdapter.Station02Value
                       myStream.Close() 'close the stream
                        Return True
                    Else 'if we were not able to open the file then
                        MsgBox("Unable to load, check file name and location") 'let the operator know that the file wasn't able to open
                        Return False
                    End If
                Catch ex As Exception
                    MsgBox("Unable to load, " + ex.Message)
                    Return False
                End Try
            Else
                Return False
            End If
        End Function

    Hello SaulMTZ,
    >>I can track the error and its located in "OffsetTableTableAdapter.Update(MaterionOffsetDataSet.OffsetTable)" code. What am i missing?
    This error usually shows that you do not initialize the
    DeleteCommand object, you could check this
    article to see if you get a workaround.
    >> Im not sure if i am making this overcomplicated or if there is a easier way to program this.
    If you are working CSV file, you could use OleDB to read it which would treat the CSV file as a Table:
    http://www.codeproject.com/Articles/27802/Using-OleDb-to-Import-Text-Files-tab-CSV-custom
    which seems to be easier (in my opinion).
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for