Avoiding duplicate records while inserting into the table

Hi
I tried the following insert statement , where i want to avoid the duplicate records while inserting itself
but giving me the errror like invalid identifier, though the column exists in the table
Please let me know Where i'm doing the mistake.
INSERT INTO t_map tm(sn_id,o_id,txt,typ,sn_time)
   SELECT 100,
          sk.obj_id,
          sk.key_txt,
          sk.obj_typ,
          sysdate,
          FROM S_KEY sk
    WHERE     sk.obj_typ = 'AY'
          AND SYSDATE BETWEEN sk.start_date AND sk.end_date
          AND sk.obj_id IN (100170,1001054)
           and   not exists  (select 1
                                                               FROM t_map tm1 where tm1.O_ID=tm.o_id
                                                                    and tm1.sn_id=tm.sn_id
                                                                    and tm1.txt=tm.txt
                                                                    and tm1.typ=tm.typ
                                                                    and tm1.sn_time=tm.sn_time )

Then
you have to join the table with alias tml where is that ?do you want like this?
INSERT INTO t_map tm(sn_id,o_id,txt,typ,sn_time)
   SELECT 100,
          sk.obj_id,
          sk.key_txt,
          sk.obj_typ,
          sysdate,
          FROM S_KEY sk
    WHERE     sk.obj_typ = 'AY'
          AND SYSDATE BETWEEN sk.start_date AND sk.end_date
          AND sk.obj_id IN (100170,1001054)
           and   not exists  (select 1
                                                               FROM t_map tm where sk.obj_ID=tm.o_id
                                                                    and 100=tm.sn_id
                                                                    and sk.key_txt=tm.txt
                                                                    and sk.obj_typ=tm.typ
                                                                    and sysdate=tm.sn_time )

Similar Messages

  • Record not inserting into the table through Forms 10g

    Hi all,
    I have created a form in 10g(10.1.2.0.2) based on just one table that has 4 columns(col1, col2, col3, col4).
    Here col1, col2 and col3 are VARCHAR2 and col4 is date and all the columns are not null columns(There are no primary and foriegn key constrains, which means duplicates are allowed).
    My form contains 2 blocks where block 1 has one text item (col1) and 3 buttons (Delete, Save, Exit).
    And block2 is a database block and has col2,col3,col4 which are in tabluar layout frame displaying 10 records.
    When the form is opened the cursor has to be in block1.col1 for querrying. Here i enter a value in col1, and then when I click on col2 in the block2, then I put execute_query in new_block_instance of block2, which displays the records.
    The block2 properties are not updatable, insertable and query is allowed.
    Everything is working good until here. But here in the block2 when I want to insert another record into the table, by navigating all the way down to the last empty record and entering the new values for col2, col3 and col4 And then Ctrl+S will display the message "*FRM-40400: Transaction complete: 1 record applied and saved.*" But actually the record is not inserted into the table.
    I also disabled the col4 by setting the Enabled property to No, since while inserting new record the date have to be populated into it and it shouldnt be changed by the user. And im populating the sysdate into the new record by setting Intial Value property to *$$DATE$$*.
    And another requirement which I could not work arround here is that, the col3 also should be populated with the username of the user while inserting.
    please help me...

    Hi Sarah,
    I do not want to update the existing record. So I kept Udate Allowed to No in property palette for the items in block2.
    Do I have to do this property at block level also?
    I'm inserting a new record here.
    Edited by: Charan on Sep 19, 2011 8:48 AM

  • Taking More Time while inserting into the table (With foriegn key)

    Hi All,
    I am facing problem while inserting the values into the master table.
    The problem,
    Table A -- User Master Table (Reg No, Name, etc)
    Table B -- Transaction Table (Foreign key reference with Table A).
    While inserting the data's in Table B, i need to insert the reg no also in table B which is mandatory. I followed the logic which is mentioned in the SRDemo.
    While inserting we need to query the Table A first to have the values in TableABean.java.
    final TableA tableA= (TableA )uow.executeQuery("findUser",TableA .class, regNo);
    Then, we need to create the instance for TableB
    TableB tableB= (TableB)uow.newInstance(TableB.class);
    tableB.setID(bean.getID);
    tableA.addTableB(tableB); --- this is for to insert the regNo of TableA in TableB.. This line is executing the query "select * from TableB where RegNo = <tableA.getRegNo>".
    This query is taking too much time if values are more in the TableB for that particular registrationNo. Because of this its taking more time to insert into the TableB.
    For Ex: TableA -- regNo : 101...having less entry in TableB means...inserting record is taking less than 1 sec
    regNo : 102...having more entry in TableB means...inserting record is taking more than 2 sec
    Time delay is there for different users when they enter transaction in TableB.
    I need to avoid this since in future it will take more time...from 2 sec to 10 sec, if volume of data increases mean.
    Please help me to resolve this issue...I am facing it now in production.
    Thanks & Regards
    VB

    Hello,
    Looks like you have a 1:M relationship from TableA to TableB, with a 1:1 back pointer from TableB to TableA. If triggering the 1:M relationship is causing you delays that you want to avoid there might be two quick ways I can see:
    1) Don't map it. Leave the TableA->TableB 1:M unmapped, and instead just query for relationship when you do need it. This means you do not need to call tableA.addTableB(tableB), and instead only need to call tableB.setTableA(tableA), so that the TableB->TableA relation gets set. Might not be the best option, but it depends on your application's usage. It does allow you to potentially page the TableB results or add other query query performance options when you do need the data though.
    2) You are currently using Lazy loading for the TableA->TableB relationship - if it is untriggered, don't bother calling tableA.addTableB(tableB), and instead only need to call tableB.setTableA(tableA). This of course requires using TopLink api to a) verify the collection is an IndirectCollection type, and b) that it is hasn't been triggered. If it has been triggered, you will still need to call tableA.addTableB(tableB), but it won't result in a query. Check out the oracle.toplink.indirection.IndirectContainer class and it's isInstantiated() method. This can cause problems though in highly concurrent environments, as other threads may have triggered the indirection before you commit your transaction, so that the A->B collection is not up to date - this might require refreshing the TableA if so.
    Change tracking would probably be the best option to use here, and is described in the EclipseLink wiki:
    http://wiki.eclipse.org/Introduction_to_EclipseLink_Transactions_(ELUG)#Attribute_Change_Tracking_Policy
    Best Regards,
    Chris

  • Record is not inserting into the Table thourgh forms 10g

    Hi All,
    I have the form built in 10g(10.1.2.0.2).
    Basically the form has 2 blocks.
    Block 1 with only one item, where we enter some value and hit enter(this will navigate to block2 and execute the query).
    Block 2(tabular) will fetch the records. Now this block2 have 3 columns(caseid, userid, date).
    Now when I insert a new record, I just need to enter the caseid only. And userid and date have to be automatically populated.
    I can populate the USERID and DATE fields.
    And when I enter some value in caseid item of block 2, and then do Control+S(to insert the record and Save the transaction),
    i get the message saying FRM-40400: Transaction complete: 1 records applied and saved.
    But when I query again for the same, I dont se the record inserted into the table.
    Why is this happening?
    Help please...

    @ Inol
    There is no promary or foriegn key relation ship. The form is fetching records from just one table. As I said block1 has col1. and Block2 has col2,3,4.
    @Andreas
    Yes I did select * from table, select count(*) from table in SQL*Plus. Nothing is inserted.
    And one thing I have to tall here is, I have a ON-INSERT trigger in block2.
    The code in ON-INSERT trigger is
    --  :BLOCK2.DATE := TO_DATE(:DATE,'DD-MON-YYYY') ;
    /* commented since I was populating date by assigning $$DATETIME$$ to the Initial value property of the data item. */
    :BLOCK2.SOURCE_CASE := :BLOCK1.SOURCE_CASEID;Forgot to tell you,
    Since I was inserting the record from block2(3 columns), to the table which has 4 columns, there is another item in block 2 which has the visible property No.
    So the block 2 has 4 columns. And the hidden column will hold the value that is in the item of block1. This is what i'm pushing in the ON-INSERT trigger.
    Edited by: Charan on Sep 20, 2011 1:51 PM

  • Record not inserting into sap table with connector framework ?

    here is the code, but record not being inserting into the table ... but same piece of code working fine while updating ... the record ...
    try {
    interaction = connection.createInteractionEx();
    IInteractionSpec interactionSpec = interaction.getInteractionSpec();
    String functionName = "Z_XYZ";
    interactionSpec.setPropertyValue("Name", functionName);
    String writingTable = "MYTABLE";
    RecordFactory rf = interaction.getRecordFactory();
    MappedRecord importParams = rf.createMappedRecord("input");
    importParams.put("ATTR1", "VALUE1");
    importParams.put("ATTR2", "VALUE2");
    IFunction function = connection.getFunctionsMetaData().getFunction(functionName);
    IStructureFactory sf = interaction.retrieveStructureFactory();
    IRecordSet table = (IRecordSet) sf.getStructure(function.getParameter(writingTable).getStructure());
    table.insertRow();
    table.setString("ATNAME", "VALUE");
    table.setString("ATWRT", "VALUE");
    importParams.put(writingTable, table);
    MappedRecord output = (MappedRecord) interaction.execute(interactionSpec, importParams);
    } catch (Exception e) {
    any idea?
    than ks
    MMK

    Hi Mohan,
    Does a creation through SE37 with the same input work?
    Yoav.

  • Problem while inserting into a table which has ManyToOne relation

    Problem while inserting into a table *(Files)* which has ManyToOne relation with another table *(Folder)* involving a attribute both in primary key as well as in foreign key in JPA 1.0.
    Relevent Code
    Entities:
    public class Files implements Serializable {
    @EmbeddedId
    protected FilesPK filesPK;
    private String filename;
    @JoinColumns({
    @JoinColumn(name = "folder_id", referencedColumnName = "folder_id"),
    @JoinColumn(name = "uid", referencedColumnName = "uid", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Folders folders;
    public class FilesPK implements Serializable {
    private int fileId;
    private int uid;
    public class Folders implements Serializable {
    @EmbeddedId
    protected FoldersPK foldersPK;
    private String folderName;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "folders")
    private Collection<Files> filesCollection;
    @JoinColumn(name = "uid", referencedColumnName = "uid", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Users users;
    public class FoldersPK implements Serializable {
    private int folderId;
    private int uid;
    public class Users implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer uid;
    private String username;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "users")
    private Collection<Folders> foldersCollection;
    I left out @Basic & @Column annotations for sake of less code.
    EJB method
    public void insertFile(String fileName, int folderID, int uid){
    FilesPK pk = new FilesPK();
    pk.setUid(uid);
    Files file = new Files();
    file.setFilename(fileName);
    file.setFilesPK(pk);
    FoldersPK folderPk = new FoldersPK(folderID, uid);
         // My understanding that it should automatically handle folderId in files table,
    // but it is not…
    file.setFolders(em.find(Folders.class, folderPk));
    em.persist(file);
    It is giving error:
    Internal Exception: java.sql.SQLException: Field 'folderid' doesn't have a default value_
    Error Code: 1364
    Call: INSERT INTO files (filename, uid, fileid) VALUES (?, ?, ?)_
    _       bind => [hello.txt, 1, 0]_
    It is not even considering folderId while inserting into db.
    However it works fine when I add folderId variable in Files entity and changed insertFile like this:
    public void insertFile(String fileName, int folderID, int uid){
    FilesPK pk = new FilesPK();
    pk.setUid(uid);
    Files file = new Files();
    file.setFilename(fileName);
    file.setFilesPK(pk);
    file.setFolderId(folderId) // added line
    FoldersPK folderPk = new FoldersPK(folderID, uid);
    file.setFolders(em.find(Folders.class, folderPk));
    em.persist(file);
    My question is that is this behavior expected or it is a bug.
    Is it required to add "column_name" variable separately even when an entity has reference to ManyToOne mapping foreign Entity ?
    I used Mysql 5.1 for database, then generate entities using toplink, JPA 1.0, glassfish v2.1.
    I've also tested this using eclipselink and got same error.
    Please provide some pointers.
    Thanks

    Hello,
    What version of EclipseLink did you try? This looks like bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=280436 that was fixed in EclipseLink 2.0, so please try a later version.
    You can also try working around the problem by making both fields writable through the reference mapping.
    Best Regards,
    Chris

  • How to avoid Duplicate Records  while joining two tables

    Hi,
    I am trying to join three tables, basically two tables are same one is like history table, so I wrote a query like
    select
    e.id,
    e.seqNo,
    e.name,
    d.resDate,
    d.details
    from employees e,
    ((select * from dept)union(select * from dept_hist)) d
    join on d.id=e.id and e.seqno=d.seqno
    but this returing duplicate records.
    Could anyone please tell me how to avoid duplicate records of this query.

    Actually it is like if the record is processed it will be moved to hist table, so both table will not have same records and I need the record from both the tables so i have done the union of both the tables, so d will have the union of both records.
    But I am getting duplicate records if even I am distinct.

  • How to avoid duplicate data while inserting from sample.dat file to table

    Hi Guys,
    We have issue with duplicate data in flat file while loading data from sample.dat file to table. How to avoid duplicate data in control file.
    Can any one help me on this.
    Thanks in advance!
    Regards,
    LKR

    No, a control file will not remove duplicate data.
    You would be better to use an external table and then remove duplicate data using SQL as you query the data to insert it to your destination table.

  • How to use header information in line records while inserting into table?

    Hi,
    Requirement: Data in flat file needs to be loaded into Oracle Tables.
    File has header information (basically file information, some account info) and Line information ( Actual data need to be loaded to oracle tables).
    File has position based data, first 2 char for Header is 00 and line is 50
    Now, header has some extra info which needs to be loaded along with details lines ( This has to be done using sql loader control file).
    What should be the control file logic to capture header information in details lines?
    Please suggest.
    I am calling this control file from Unix, so I can change the control file definition dynamically by retrieving the first line of the data file and modify the control file before executing the sql loader command. Is there any option to achieve this using SQL LOADER commands?
    Thanks,
    Venkat.

    Pl post details of OS and database versions.
    Use the WHEN clause to load header and detail lines into separate tables, then write PL/SQL code to perform needed post-processing.
    See the examples in section titled "Distinguishing Different Input Record Formats" here http://docs.oracle.com/cd/E11882_01/server.112/e22490/ldr_control_file.htm
    HTH
    Srini

  • Writing a trigger to update the QOH in a Parts table for for each item of the order whenever the order is filled. The trigger is for the OrderItem table when an item record is inserted into the OrderItem table.

    Any ideas?

    Hi,
    If orderitem and parts are the only tables involved, and each orderitem references only 1 part, then it's pretty simple: just update parts, like this
    UPDATE  parts
    SET     qoh       = qoh - :NEW.quantity
    WHERE   part_num  = :NEW.part_num;
    If you can modify filled orderitems (e.g., DELETE orderitems or change the part_num after the order is filled, or change the status from filled back to unfilled then it's more complicated; you might have UPDATE the :OLD.part_num as well as the :NEW.part_num
    I hope this answers your question.
    If not, post your best attempt, along with a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Since you're asking about a DML statement, such as UPDATE, the sample data will be the contents of the table(s) before the DML, and the results will be state of the changed table(s) when everything is finished.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Remove all duplicate records and load into temp table

    Hi
    I have a table contains data like this.
    Emp No Designation location
    1111 SE CA
    1111 DE CT
    3456 WE NJ
    4523 TY GH
    We found that there are two duplicate records for emp no: 1111. I want to delete all duplicate records (in this case two records for emp no:1111) and load into the temp table.
    Please advice me how to do it.

    Oh look, you can search the forums...
    http://forums.oracle.com/forums/search.jspa?threadID=&q=delete+duplicates&objID=f75&dateRange=all&userID=&numResults=30

  • If Records of different list items are entered, then the data is not getting inserted in the table.

    Hi Everyone,
    A Very Very Happy, Fun-filled, Awesome New Year to You All.
    Now coming to the discussion of my problem in Oracle Forms 6i:
    I have created a form in which the data is entered & saved in the database.
    CREATE TABLE MATURED_FD_DTL
      ACCT_FD_NO    VARCHAR2(17 BYTE)               NOT NULL,
      CUST_CODE     NUMBER(9),
      FD_AMT        NUMBER(15),
      FD_INT_BAL    NUMBER(15),
      TDS           NUMBER(15),
      CHQ_NO        NUMBER(10),
      CREATED_DATE  DATE,
      CREATED_BY    VARCHAR2(15 BYTE),
      PREV_YR_TDS   NUMBER(15),
      ADD_FD_AMT    NUMBER(15),
      DESCRIPTION   VARCHAR2(100 BYTE),
      P_SAP_CODE    NUMBER(10),
      P_TYPE        VARCHAR2(1 BYTE)
    The form looks like below:
    ENTER_QUERY     EXECUTE_QUERY     SAVE     CLEAR     EXIT
    ACCT_FD_NO
    CUST_CODE
    FD_AMT
    FD_INT_BAL
    PREV_YR_TDS
    TDS
    ADD_FD_AMT
    P_SAP_CODE
    P_TYPE
    CHQ_NO
    DESCRIPTION
    R
    W
    P
    List Item
    There are 5 push buttons namely ENTER_QUERY, EXECUTE_QUERY, SAVE, CLEAR, EXIT.
    The table above is same as in the form. All the fields are text_item, except the P_TYPE which is a List_Item ( Elements in List Item are R, W & P).
    The user will enter the data & save it.
    So all this will get updated in the table MATURED_FD_DTL .
    I am updating one column in another table named as KEC_FDACCT_MSTR.
    and
    I want this details to get updated in another table named as KEC_FDACCT_DTL only if the P_TYPE='P'
    CREATE TABLE KEC_FDACCT_DTL
      FD_SR_NO                NUMBER(8)             NOT NULL,
      FD_DTL_SL_NO            NUMBER(5),
      ACCT_FD_NO              VARCHAR2(17 BYTE)     NOT NULL,
      FD_AMT                  NUMBER(15,2),
      INT_RATE                NUMBER(15,2),
      SAP_GLCODE              NUMBER(10),
      CATOGY_NAME             VARCHAR2(30 BYTE),
      PROCESS_YR_MON          NUMBER(6),
      INT_AMT                 NUMBER(16,2),
      QUTERLY_FD_AMT          NUMBER(16,2),
      ITAX                    NUMBER(9,2),
      MATURITY_DT             DATE,
      FDR_STAUS               VARCHAR2(2 BYTE),
      PAY_ACC_CODE            VARCHAR2(85 BYTE),
      BANK_CODE               VARCHAR2(150 BYTE),
      NET_AMOUNT_PAYABLE      NUMBER,
      QUATERLY_PAY_DT         DATE,
      CHEQUE_ON               VARCHAR2(150 BYTE),
      CHEQUE_NUMBER           VARCHAR2(10 BYTE),
      CHEQUE_DATE             DATE,
      MICR_NUMBER             VARCHAR2(10 BYTE),
      PAY_TYPE                VARCHAR2(3 BYTE),
      ADD_INT_AMT             NUMBER(16,2),
      ADD_QUTERLY_FD_AMT      NUMBER(16,2),
      ADD_ITAX                NUMBER(16,2),
      ECS_ADD_INT_AMT         NUMBER(16),
      ECS_ADD_QUTERLY_FD_AMT  NUMBER(16),
      ECS_ADD_ITAX            NUMBER(16)
    So for the push button 'Save' , i have put in the following code in the Trigger : WHEN BUTTON PRESSED,
    BEGIN
         Commit_form;
              UPDATE KEC_FDACCT_MSTR SET PAY_STATUS='P' WHERE ACCT_FD_NO IN (SELECT ACCT_FD_NO FROM MATURED_FD_DTL);
              UPDATE MATURED_FD_DTL SET CREATED_DATE=sysdate, CREATED_BY = :GLOBAL.USER_ID WHERE ACCT_FD_NO = :acct_fd_NO;
    IF :P_TYPE='P' THEN
         INSERT INTO KEC_FDACCT_DTL
              SELECT FD_SR_NO, NULL, MATURED_FD_DTL.ACCT_FD_NO, FD_AMT, INT_RATE, P_SAP_CODE,
                   GROUP_TYPE, (TO_CHAR(SYSDATE, 'YYYYMM'))PROCESS_YR_MON,
                   FD_INT_BAL, (FD_INT_BAL-MATURED_FD_DTL.TDS)QUTERLY_FD_AMT , MATURED_FD_DTL.TDS,
                   MATURITY_DATE, P_TYPE, NULL, NULL, (FD_INT_BAL-MATURED_FD_DTL.TDS)NET_AMOUNT_PAYABLE,
                   NULL, NULL, CHQ_NO, SYSDATE, NULL, 'CHQ', NULL, NULL, NULL, NULL, NULL, NULL
              FROM MATURED_FD_DTL, KEC_FDACCT_MSTR
         WHERE KEC_FDACCT_MSTR.ACCT_FD_NO=MATURED_FD_DTL.ACCT_FD_NO;
    END IF;
    COMMIT;
         MESSAGE('RECORD HAS BEEN UPDATED AS PAID');
         MESSAGE(' ',no_acknowledge);
    END;
    If P_TYPE='P' , then the data must get saved in KEC_FDACCT_DTL table.
    The problem what is happening is,
    If i enter the details with all the records as 'P' , the record gets inserted into the table KEC_FDACCT_DTL
    If i enter the details with records of 'P' and 'R' , then nothing gets inserted into the table KEC_FDACCT_DTL.
    Even the records with 'P' is not getting updated.
    I want the records of 'P' , to be inserted into table KEC_FDACCT_DTL, even when multiple records of all types of 'P_Type' (R, w & P) are entered.
    So, can you please help me with this.
    Thank You.
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    Oracle Forms Builder 6i.

    Its not working properly.
    At Form_level_Trigger: POST_INSERT, I have put in the following code.
    IF :P_TYPE='P'THEN
      INSERT INTO KEC_FDACCT_DTL
      SELECT FD_SR_NO, NULL, MATURED_FD_DTL.ACCT_FD_NO, FD_AMT, INT_RATE, P_SAP_CODE,
      GROUP_TYPE, (TO_CHAR(SYSDATE, 'YYYYMM'))PROCESS_YR_MON,
      FD_INT_BAL, (FD_INT_BAL-MATURED_FD_DTL.TDS)QUTERLY_FD_AMT , MATURED_FD_DTL.TDS,
      MATURITY_DATE, P_TYPE, NULL, NULL, (FD_INT_BAL-MATURED_FD_DTL.TDS)NET_AMOUNT_PAYABLE,
      NULL, NULL, CHQ_NO, SYSDATE, NULL, 'CHQ', NULL, NULL, NULL, NULL, NULL, NULL
      FROM MATURED_FD_DTL, KEC_FDACCT_MSTR
      WHERE KEC_FDACCT_MSTR.ACCT_FD_NO=MATURED_FD_DTL.ACCT_FD_NO;
      END IF;
    MESSAGE('RECORD HAS BEEN UPDATED AS PAID');
    MESSAGE(' ',no_acknowledge);
    It worked properly when i executed first time, but second time , in database duplicate values were stored.
    Example: First I entered the following in the form & saved it.
    ACCT_FD_NO
    CUST_CODE
    FD_AMT
    FD_INT_BAL
    PREV_YR_TDS
    TDS
    ADD_FD_AMT
    P_SAP_CODE
    P_TYPE
    CHQ_NO
    DESCRIPTION
    250398
    52
    50000
    6000
    0
    600
    0
    45415
    P
    5678
    int1
    320107
    56
    100000
    22478
    3456
    2247
    0
    45215
    R
    456
    320108
    87
    50000
    6500
    0
    650
    0
    21545
    W
    0
    In the database, in table KEC_FDACCT_DTL, the ACCT_FD_NO:250398 with P_TYPE='P' record was inserted.
    ACCT_FD_NO
    P_TYPE
    250398
    P
    But second time, when i entered the following in the form & saved.
    ACCT_FD_NO
    CUST_CODE
    FD_AMT
    FD_INT_BAL
    PREV_YR_TDS
    TDS
    ADD_FD_AMT
    P_SAP_CODE
    P_TYPE
    CHQ_NO
    DESCRIPTION
    260189
    82
    50000
    6000
    0
    600
    0
    45415
    P
    5678
    interest567
    120011
    46
    200000
    44478
    0
    4447
    0
    45215
    R
    456
    30191
    86
    50000
    6500
    0
    650
    0
    21545
    W
    56
    In the database, in the table KEC_FDACCT_DTL, the following rows were inserted.
    ACCT_FD_NO
    P_TYPE
    250398
    P
    250398
    P
    260189
    P
    320107
    R
    320108
    W
    There was duplicate of 250398 which i dint enter in the form second time,
    All the other P_TYPE was also inserted , but i want only the P_TYPE='P' to be inserted into the database.
    I want only those records to be inserted into the form where P_TYPE='P' and duplicate rows must not be entered.
    How do i do this???

  • How can I get a count at the same time I am inserting into another table

    I have a requirement where I have to find out the count(number of records inserted into another table) at the same time I insert into the table:
    Like
    I am copying records from table B to A, while doing this I have to find out how many records I've inserted since I need this count in subsequent steps
    INSERT INTO A
    SELECT * FROM B
    how can I store the count into any variable while doing above statement
    Please advice

    No, Warren that doesn't work!
    SQL> set serveroutput on
    SQL> declare
      2     vCtr  number := 0;
      3  begin
      4     insert into emp2
      5     select * from emp;
      6
      7     select count(*)
      8       into vCtr
      9       from emp2;
    10
    11     dbms_output.put_line('rows created '||to_char(vCtr));
    12  end;
    13  /
    rows created 15
    PL/SQL procedure successfully completed.
    SQL> declare
      2     vCtr  number := 0;
      3  begin
      4     insert into emp2
      5     select * from emp;
      6
      7     select count(*)
      8       into vCtr
      9       from emp2;
    10
    11     dbms_output.put_line('rows created '||to_char(vCtr));
    12  end;
    13  /
    rows created 30
    PL/SQL procedure successfully completed.
    SQL>

  • Trigger a process when a record is inserted into database

    Hi, could someone tell me how to do the following (if it's possible):
    when a record is inserted into a table in a database,
    I want it to somehow trigger an action which will put an item into user's To-Do inBox of the WorkSpace,
    the user can then open the form in the To-Do and use it to view the data in the newly inserted record.
    this "user"'s login ID is part of the inserted record.
    thanks

    Mmm, trigger?  I don't know of a way.
    But I supposed you could have a process that has a timer that peroidically queries the database for changes and then do the same thing.
    You could also perhaps write a Service and then use the Java API to start a process?
    Maybe take a look here
    http://blogs.adobe.com/livecycle/2010/12/how-to-invoke-a-livecycle-process-periodically.ht ml

  • Does a temp table is reuired to insert into a table

    Hi ,
    I am using a stored procedure to check the availability of a record in a table and deleting the record if exists ,
    actually  if the user have multiple record i need to delete and store it in removed table  , so i used insert with select command to insert into the table , do i need to use a temp table to insert multiple record in removed table .
    Thank You
    Jeevan Vinay

    No, it doesn't need to be that complex.
    The records need to go to your deleted/history table, and they also need to be deleted from the main table. I would just insert the records into the history table and delete the records from your main table by joining back to it on the delete with the PK.
    You could try something like this:
    CREATE TABLE ##main_table (employee_id INT IDENTITY(1,1), employee_name VARCHAR(50))
    CREATE TABLE ##history_table (employee_id INT, employee_name VARCHAR(50))
    INSERT INTO ##main_table (employee_name)
    SELECT 'Alice'
    UNION ALL
    SELECT 'Bob'
    UNION ALL
    SELECT 'Charlie'
    --Bob is the user that will get deleted (employee_id = 2)
    --Insert record into history table
    INSERT INTO ##history_table
    SELECT *
    FROM ##main_table
    WHERE employee_id = 2
    --Delete record from main table
    DELETE m
    FROM ##main_table m
    JOIN ##history_table h
    ON m.employee_id = h.employee_id
    SELECT *
    FROM ##history_table
    SELECT *
    FROM ##main_table

Maybe you are looking for

  • Power problem with Time Capsule 2 To

    Ma Time Capsule ne redémarre plus, ce n'est pas la première fois mais cette fois, je crains que ce soit définitif. Elle n'est plus couverte par la garantie et j'aimerais savoir si il est possible de la réparer ou échanger à moindre frais. Merci d'ava

  • AC/DC Combo adapter failure/short

    I bought the thin AC/DC combo adapter with my ThinkPad, and at first it seemed to work, but it quickly became clear that it had a short that would cause it to intermittently fail. I've isolated it to the point the cable exits the brick. I first notic

  • 10.4.6 Install Problem re: Internet

    Hello, I installed 10.4.6 yesterday on my G4 933 iBook and everything initially went smoothly. Since the installation I've been unable to run Dashboard, iTunes, Mail, Safari, etc. Basically, if I have an active Internet connection (Airport, ethernet)

  • Custom fields in Source of Supply screen - not getting saved

    Hello Experts, There is a requirement to create 2 customizing fields on Souce of Supply (SOS) screen of Shopping Cart in SRM7.0 and has to be updated in the Backend system (PR,PO etc). I have created CUST1 and CUST2 in the standard include - INCL_EEW

  • [CS2/CS3] - Changing font for TextEditBoxWidget

    Hello,    could someone help me how to change default font for mentioned widget to f.e. Arial MS which has rich support for Unicode special symbols ? Thank you, marxin