Insert OR Update records

Hi All,
I want to write a stored procedure to insert or update the value into the customer table. If the record exist, I need to insert. If it does not exist, I need to update. Could you tell me how do we do it.
My Current stored procedure is :
CREATE OR REPLACE PROCEDURE customer_update
(p_cust_id IN VARCHAR2,
p_cust_name IN VARCHAR2)
AS
BEGIN
INSERT INTO CUSTOMER (cust_id, cust_NAME, update_dm)
VALUES (p_cust_id, p_cust_name, sysdate);
COMMIT;
END customer_update;

I think we need to be careful about using EXCEPTION to handle normal (expected) processing. Also, if the row is more likely to exist than not exist, it might be better to try the UPDATE first, and only go for INSERT if SQL%ROWCOUNT = 0;
There's been a few of these sort of questions posted recently, and I find them worrying, becuase it suggests poorly designed systems. The user ought to know whether they are inserting a new record or amending an existing one. The MERGE functionality is useful for data migration/upload scenarios, but I think using it in a business situation is, in the words of Kent Beck, a "code smell".
Cheers, APC

Similar Messages

  • Need help to insert and update records in MDM

    Hi ,
    I am trying to develop an webdynpro application which can create and update records in tables of a repository of MDM . For example .. I want to insert values and later update values in Vendor table.
    I am new to webdynpro and MDM. If any one can help step by step or can send a sample code which I can be ready to use that would be great help.
    If anyone can have a sample code .. kindly mail to "[email protected]"
    It is urgent. Please help.
    Regards,
    Niraj
    Edited by: Niraj Kumar on May 23, 2008 6:50 AM

    Hi Niraj,
    Are u going to work with webdynpro Java/ABAP?
    some materials which are found useful are sent.
    Cheers,
    Mary

  • How to avoid mutating error when insert or update record

    Hi ,
    I have one transaction table which is having some detail record under one transaction number, after the one transaction number is over by insert or update, i
    want to check the total amounts of one flag should be matched on same table if it is not then give error message. But i am getting mutating error on insert or update event trigger on statement level trigger on above table.
    Is there any other way to avoid mutating error to solve the above problem or some temp table concepts to be used. help me its urgent.
    Thanks in advance,
    Sachin Khaladkar
    Pune

    Sachin, here's as short of an example as I could come up with on the fly. The sample data is ficticious and for example only.
    Let's say I need to keep a table of items by category and my business rule states that the items in the table within each category must total to 100% at all times. So I want to insert rows and then make sure any category added sums to 100% or I will rollback the transation. I can't sum the rows in a row-level trigger because I'd have to query the table and it is mutating (in the middle of being changed by a transaction). Even if I could query it while it is mutating, there may be multiple rows in a category with not all yet inserted, so checking the sum after each row is not useful.
    So here I will create;
    1. the item table
    2. a package to hold my record collection (associative array) for the trigger code (the category is used as a key to the array; if I insert 3 rows for a given category, I only need to sum that category once, right?
    3. a before statement trigger to initialize the record collection (since package variables hang around for the entire database session, I need to clear the array before the start of every DML (INSERT in this case) statement against the item table)
    4. a before row trigger to collect categories being inserted
    5. an after statement trigger to validate my business rule
    I then insert some sample data so you can see how it works. Let me know if you have any questions about this.
    SQL> CREATE TABLE item_t
      2   (category  NUMBER(2)   NOT NULL
      3   ,item_code VARCHAR2(2) NOT NULL
      4   ,pct       NUMBER(3,2) NOT NULL);
    Table created.
    SQL>
    SQL> CREATE OR REPLACE PACKAGE trg_pkg IS
      2    TYPE t_item_typ IS TABLE OF item_t.category%TYPE
      3      INDEX BY PLS_INTEGER;
      4    t_item       t_item_typ;
      5    t_empty_item t_item_typ;
      6  END trg_pkg;
      7  /
    Package created.
    SQL> SHOW ERRORS;
    No errors.
    SQL>
    SQL> CREATE OR REPLACE TRIGGER item_bs_trg
      2    BEFORE INSERT
      3    ON item_t
      4  BEGIN
      5    DBMS_OUTPUT.put_line('Initializing...');
      6    trg_pkg.t_item := trg_pkg.t_empty_item;
      7  END item_bs_trg;
      8  /
    Trigger created.
    SQL> SHOW ERRORS;
    No errors.
    SQL>
    SQL> CREATE OR REPLACE TRIGGER item_br_trg
      2    BEFORE INSERT
      3    ON item_t
      4    FOR EACH ROW
      5  BEGIN
      6    trg_pkg.t_item(:NEW.category) := :NEW.category;
      7    DBMS_OUTPUT.put_line('Inserted Item for Category: '||:NEW.category);
      8  END item_br_trg;
      9  /
    Trigger created.
    SQL> SHOW ERRORS;
    No errors.
    SQL>
    SQL> CREATE OR REPLACE TRIGGER item_as_trg
      2    AFTER INSERT
      3    ON item_t
      4  DECLARE
      5    CURSOR c_item (cp_category item_t.category%TYPE) IS
      6      SELECT SUM(pct) pct
      7        FROM item_t
      8       WHERE category = cp_category;
      9  BEGIN
    10    DBMS_OUTPUT.put_line('Verifying...');
    11    FOR i IN trg_pkg.t_item.FIRST..trg_pkg.t_item.LAST LOOP
    12      DBMS_OUTPUT.put_line('Checking Category: '||trg_pkg.t_item(i));
    13      FOR rec IN c_item(trg_pkg.t_item(i)) LOOP
    14        IF rec.pct != 1 THEN
    15          RAISE_APPLICATION_ERROR(-20001,'Category '||trg_pkg.t_item(i)||' total = '||rec.pct);
    16        END IF;
    17      END LOOP;
    18    END LOOP;
    19  END item_as_trg;
    20  /
    Trigger created.
    SQL> SHOW ERRORS;
    No errors.
    SQL> INSERT INTO item_t
      2    SELECT 1, 'AA', .3 FROM DUAL
      3    UNION ALL
      4    SELECT 2, 'AB', .6 FROM DUAL
      5    UNION ALL
      6    SELECT 1, 'AC', .2 FROM DUAL
      7    UNION ALL
      8    SELECT 3, 'AA',  1 FROM DUAL
      9    UNION ALL
    10    SELECT 1, 'AA', .5 FROM DUAL
    11    UNION ALL
    12    SELECT 2, 'AB', .4 FROM DUAL;
    Initializing...
    Inserted Item for Category: 1
    Inserted Item for Category: 2
    Inserted Item for Category: 1
    Inserted Item for Category: 3
    Inserted Item for Category: 1
    Inserted Item for Category: 2
    Verifying...
    Checking Category: 1
    Checking Category: 2
    Checking Category: 3
    6 rows created.
    SQL>
    SQL> SELECT * FROM item_t ORDER BY category, item_code, pct;
      CATEGORY IT        PCT
             1 AA         .3
             1 AA         .5
             1 AC         .2
             2 AB         .4
             2 AB         .6
             3 AA          1
    6 rows selected.
    SQL>
    SQL> INSERT INTO item_t
      2    SELECT 4, 'AB', .5 FROM DUAL
      3    UNION ALL
      4    SELECT 5, 'AC', .2 FROM DUAL
      5    UNION ALL
      6    SELECT 5, 'AA', .5 FROM DUAL
      7    UNION ALL
      8    SELECT 4, 'AB', .5 FROM DUAL
      9    UNION ALL
    10    SELECT 4, 'AC', .4 FROM DUAL;
    Initializing...
    Inserted Item for Category: 4
    Inserted Item for Category: 5
    Inserted Item for Category: 5
    Inserted Item for Category: 4
    Inserted Item for Category: 4
    Verifying...
    Checking Category: 4
    INSERT INTO item_t
    ERROR at line 1:
    ORA-20001: Category 4 total = 1.4
    ORA-06512: at "PNOSKO.ITEM_AS_TRG", line 12
    ORA-04088: error during execution of trigger 'PNOSKO.ITEM_AS_TRG'
    SQL>
    SQL> SELECT * FROM item_t ORDER BY category, item_code, pct;
      CATEGORY IT        PCT
             1 AA         .3
             1 AA         .5
             1 AC         .2
             2 AB         .4
             2 AB         .6
             3 AA          1
    6 rows selected.
    SQL>

  • Inserting and Updating records in ORACLE using WebDynpro Java

    Hi All
    I got connected to oracle backend (using my previous thread), but now i want to insert and update the records
    i have created views  for insert and update,
    Thanks in advance
    Sushma

    Hi shusma..
    chk this link..
    <b><u>Creating Connection</u></b>
    package com.sap.xirig;
    import javax.naming.*;
    import javax.sql.*;
    import java.sql.*;
    public class DBLookup {
    String Conn_Status = "Not Connected";
    String Language_Desc = "Empty";
    String Language_Cd = "Empty";
    Connection conn;
    Context ctx;
    DataSource ds;
    //Constructor for the DBLookup object
    public DBLookup {
    try {
    ctx = new InitialContext();
    if (ctx == null) {
    throw new Exception("Boom - No Context");
    // If JDBC 2.0 connection is used please create the DataSource object as below
    // ds = (DataSource) ctx.lookup("jdbc/ORACLEDATASOURCE");
    // If JDBC 1.0 connection is used please create the DataSource object as below
    // ds = (DataSource) ctx.lookup("jdbc/notx/ORACLEDATASOURCE");
    if (ds == null) {
    throw new Exception("Boom - No dataSource");
    catch (Exception e) {
    e.printStackTrace();
    public String getLanguageDesc(String v_str) {
    Statement stmt = null;
    ResultSet rst = null;
    try {
    if (ds != null) {
    conn = ds.getConnection();
    Conn_Status = "Could not get connection to
    datasource";
    if (conn != null) {
    Conn_Status = "Got Connection " +
    conn.toString();
    stmt = conn.createStatement();
    rst = stmt.executeQuery("SELECT
    LANGUAGE_DESC FROM LANGUAGETRANSLATION WHERE LANGUAGE_CD='" + v_str +
    if (rst.next()) {
    Language_Desc = rst.getString(1);
    conn.close();
    catch (Exception e) {
    e.printStackTrace();
    finally {
    if (rst != null) {
    try {
    rst.close();
    catch (Exception e) {
    e.printStackTrace();
    if (stmt != null) {
    try {
    stmt.close();
    catch (Exception e) {
    e.printStackTrace();
    if (conn != null) {
    try {
    conn.close();
    catch (Exception e) {
    e.printStackTrace();
    return Language_Desc;
    http://e-docs.bea.com/wls/docs81/oracle/API_joci.html
    Hope this will help u..
    URs GS

  • How to see inserted or updated record when they are inserted or updated?

    Hello friends ,
    I have a huge table with, it do NOT contain any field with date or date and time.
    I want date and time when record are inserted or updated.....
    There are many row inserted in table ,So how to know when rows are inserted in particular table.
    & How to retrieve it using  SQL query?
    My database is 10gR2 and win-xp is the OS.

    Try some thing like this
    select  Field, Filed2, ORA_ROWSCN, SCN_TO_TIMESTAMP(ORA_ROWSCN)  from Table Name
    You will get the recent  date of  insert/update of record

  • Merge to Insert or update records in SQL Database

    Hello ,
    I am having hard time with creating a Stored Procedure to insert/update the selected records from Oracle data base to SQL database using BizTalk.
    ALTER PROCEDURE [dbo].[uspInsertorUpdateINF]
    @dp_id char(32),
    @dv_id char(32),
    @em_number char(12),
    @email varchar(50),
    @emergency_relation char(32),
    @option1 char(16),
    @status char(20),
    @em_id char(35),
    @em_title varchar(64),
    @date_hired datetime
    AS
    BEGIN
    SET NOCOUNT ON;
    MERGE [dbo].[em] AS [Targ]
    USING (VALUES (@dp_id, @dv_id , @em_number, @email, @emergency_relation, @option1, @status, @em_id, @em_title, @date_hired))
    AS [Sourc] (dp_id, dv_id, em_number, email, emergency_relation, option1, status, em_id, em_title, date_hired)
    ON [Targ].em_id = [Sourc].em_id
    WHEN MATCHED THEN
    UPDATE SET dp_id = [Sourc].dp_id,
    dv_id = [Sourc].dv_id,
    em_number = [Sourc].em_number,
    email = [Sourc].email,
    emergency_relation = [Sourc].emergency_relation,
    option1 = [Sourc].option1,
    status = [Sourc].status,
    em_title = [Sourc].em_title,
    date_hired = [Sourc].date_hired
    WHEN NOT MATCHED BY TARGET THEN
    INSERT (dp_id, dv_id, em_number, email, emergency_relation, option1, status, em_id, em_title,date_hired)
    VALUES ([Sourc].dp_id, [Sourc].dv_id, [Sourc].em_number, [Sourc].email, [Sourc].emergency_relation, [Sourc].option1, [Sourc].status, [Sourc].em_id, [Sourc].em_title, [Sourc].date_hired);
    END;
    I am getting an error like
    WcfSendPort_SqlAdapterBinding_
    TypedProcedures_dbo_Custom" with URL "mssql://abc//def?". It will be retransmitted after the retry interval specified for this Send Port. Details:"System.Data.SqlClient.SqlException (0x80131904): Procedure or function 'uspInsertorUpdateINF'
    expects parameter '@dp_id', which was not supplied
    I cannot give the Oracle Database name directly in the stored Procedure
    I am stuck with this, and cannot figure out since I am new to SQL Queries and Stored Procedures. Any help is greatly appreciated.
    Thanks

    Hi sid_siv,
    Only the first record is inserted because of the scalar variables of the stored procedure(SP), when you call the SP, only one row is passed. To get all rows inserted, you can either declare a
    table-valued parameter
    (TVP) for the SP or using an Oracle linked server in the SP.
    Create a stored procedure with a table-valued parameter
    As you mentioned linked server is not good in your case, then TVP SP can be the only option. Regarding how to call a SP with TVP parameter in BizTalk, that's a typically BizTalk question then. I would suggest you post your question in a dedicated
    BizTalk Server forum. It is more appropriate and more experts will assist you.
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Confirmation inserted or updated records

    After insert, update or delete on master-detail form I would like to requery the master-record and make confirmation of inserted, updated or deleted records.
    I manage to requery my form I I can not give confirmation.
    begin
    doSave;
    l_msg := p_session.get_value_as_varchar2
    ( p_block_name => l_master_block
    , p_attribute_name => '_STATUS'
    p_session.set_shadow_value
    ( p_block_name => l_master_block
    , p_attribute_name => 'A_ID'
    , p_value => to_char(l_id)
    , p_language => l_language
    p_session.set_shadow_value
    ( p_block_name => l_master_block
    , p_attribute_name => '_STATUS'
    , p_value => l_msg
    , p_language => l_language
    WWV_MASTER_GENSYS_1
    ( p_block_name => null
    , p_object_name => null
    , p_instance => null
    , p_event_type => null
    , p_user_args => null
    , p_session => p_session
    p_session.save_session();
    end;
    Thanks,
    Anna

    Hi,
    At this point this is only partially doable, you can get the case into the mapping... The hard part will be to get the readings in a table or on the screen. So if you are able to get the row counters into a table you can get close...
    Jean-Pierre

  • Insert/Update Record - Server Behavior

    Help Please!
    I have several pages with forms that insert records, but I
    over the weekend when I went to open them from the web to
    insert/update records errors appeared. They were working fine
    before. Using PHP, MYSQL and Dreamweaver CS3
    I have tried everything I know to do. I have recreated the
    page, same problem as well as delete behaviors and reapply them.
    Once the server behavior is added it no longer says Insert
    Record in the Application window instead it says "Dynamic
    Attribute" Further, when I click it to make any changes etc,
    instead of the screen for Insert or Update record coming up it is a
    "Dynamic Text box" regarding POST or GET or URL stuff.
    Edited to add: And once posted, the page only shows an error
    and references this line
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    Error Message
    Parse error: syntax error, unexpected '<' on line 40
    What can I do?

    You don't say which server-side language you're using, but the way that I would troubleshoot this in PHP is to use echo to display the value of $_SESSION['MM_Username'] at the bottom of the admin page. This is the session variable Dreamweaver uses to control access to a page with username and password. If the value is displayed, it means sessions are working, and the variable hasn't been destroyed.
    If that works, move onto the next page, and use echo to display the value of $_SESSION['MM_Username'] as soon as the session has been started. To prevent being redirected to the fail page, temporarily comment out the following line:
    header("Location: ". $MM_restrictGoTo);
    Basically, you need to check what's happening to the session variable that controls access to the pages.

  • Count of inserted and updated rowcount in @@rowcount

    Similarly I have created a sp which is inserting and updating the records.
    Now I want to track the count of new record inserted and updated record in @@rowcount .
    please suggest me the code .
    below is my sp
    alter Procedure SP_Archive_using_merge
    AS
    --exec SP_Archive
    BEGIN
    SET NOCOUNT ON
    Declare @Source_RowCount int
    Declare @New_RowCount int
    DECLARE @TimeIn SMALLDATETIME
    DECLARE @LatestVersion INT
    SET NOCOUNT ON
    ---BBxKey and Hash value of all the source columns are derived in source query itself--
    select @TimeIn=getdate(),@LatestVersion=1
    MERGE Archive.dbo.ArchiveBBxCemxr AS stm
    USING (
    SELECT a.*,cast(SUBSTRING(a.Col001,1,10) as varchar(100)) BBxKey,
    HashBytes('MD5', CAST(CHECKSUM(a.Col001,a.Col002,a.Col003,a.Col004,a.Col005,a.Col006,a.Col007) AS varbinary(max))) RowChecksum,
    b.BBxKey as Archive_BBxKey, b.RowChecksum as Archive_RowChecksum
    FROM dbo.ImportBBxCemxr a LEFT OUTER JOIN Archive.dbo.ArchiveBBxCemxr b
    ON a.Col001 = b.BBxKey
    Where (b.LatestVersion = 1 OR b.LatestVersion IS NULL) AND a.Col001 IS NOT NULL
    ) AS sd 
    ON sd.Archive_BBxKey = stm.BBxKey and sd.RowChecksum = stm.RowChecksum
    WHEN MATCHED AND (stm.BBxKey = sd.Archive_BBxKey and stm.RowChecksum != sd.Archive_RowChecksum) THEN
    UPDATE SET 
    stm.TimeIn = @TimeIn,
    BBXKey=sd.BBXKey,
    RowChecksum=sd.RowChecksum,
    stm.Col001=sd.Col001,
    stm.Col002=sd.Col002,
    stm.Col003=sd.Col003,
    stm.Col004=sd.Col004,
    stm.Col005=sd.Col005,
    stm.Col006=sd.Col006,
    stm.Col007=sd.Col007,
    stm.LatestVersion=@LatestVersion
    WHEN NOT MATCHED and (sd.Archive_BBxKey is null) THEN
    Insert (TimeIn,BBXKey,RowChecksum,Col001,Col002,Col003,Col004,Col005,Col006,Col007,LatestVersion)
    values(getdate(),sd.BBXKey,sd.RowChecksum,sd.Col001,sd.Col002,sd.Col003,sd.Col004,sd.Col005,sd.Col006,sd.Col007,@LatestVersion);
    end 
    Thankx &amp; regards, Vipin jha MCP

    You need to OUTPUT clause with action column to get the info into teable variable and then count from the table variable.
    Try the below: (Not tested)
    alter Procedure SP_Archive_using_merge
    AS
    --exec SP_Archive
    BEGIN
    SET NOCOUNT ON
    Declare @Source_RowCount int
    Declare @New_RowCount int
    DECLARE @TimeIn SMALLDATETIME
    DECLARE @LatestVersion INT
    SET NOCOUNT ON
    ---BBxKey and Hash value of all the source columns are derived in source query itself--
    select @TimeIn=getdate(),@LatestVersion=1
    DECLARE @tableVariable TABLE (sAction VARCHAR(20), InsertedID INT, DeletedID INT)
    MERGE Archive.dbo.ArchiveBBxCemxr AS stm
    USING (
    SELECT a.*,cast(SUBSTRING(a.Col001,1,10) as varchar(100)) BBxKey,
    HashBytes('MD5', CAST(CHECKSUM(a.Col001,a.Col002,a.Col003,a.Col004,a.Col005,a.Col006,a.Col007) AS varbinary(max))) RowChecksum,
    b.BBxKey as Archive_BBxKey, b.RowChecksum as Archive_RowChecksum
    FROM dbo.ImportBBxCemxr a LEFT OUTER JOIN Archive.dbo.ArchiveBBxCemxr b
    ON a.Col001 = b.BBxKey
    Where (b.LatestVersion = 1 OR b.LatestVersion IS NULL) AND a.Col001 IS NOT NULL
    ) AS sd
    ON sd.Archive_BBxKey = stm.BBxKey and sd.RowChecksum = stm.RowChecksum
    WHEN MATCHED AND (stm.BBxKey = sd.Archive_BBxKey and stm.RowChecksum != sd.Archive_RowChecksum) THEN
    UPDATE SET
    stm.TimeIn = @TimeIn,
    BBXKey=sd.BBXKey,
    RowChecksum=sd.RowChecksum,
    stm.Col001=sd.Col001,
    stm.Col002=sd.Col002,
    stm.Col003=sd.Col003,
    stm.Col004=sd.Col004,
    stm.Col005=sd.Col005,
    stm.Col006=sd.Col006,
    stm.Col007=sd.Col007,
    stm.LatestVersion=@LatestVersion
    WHEN NOT MATCHED and (sd.Archive_BBxKey is null) THEN
    Insert (TimeIn,BBXKey,RowChecksum,Col001,Col002,Col003,Col004,Col005,Col006,Col007,LatestVersion)
    values(getdate(),sd.BBXKey,sd.RowChecksum,sd.Col001,sd.Col002,sd.Col003,sd.Col004,sd.Col005,sd.Col006,sd.Col007,@LatestVersion)
    OUTPUT $action as action, inserted.BBXKey as ins, deleted.BBXKey as del into @tableVariable;
    --To get the action count info
    SELECT sAction, COUNT(*) FROM @tableVariable GROUP BY sAction
    end

  • How to insert or update multiple values into a records of diff fields

    Hai All
    I have to insert or update or multiple values into a single records of diff fields from one to another table.
    Table1 has 3 fields
    Barcode bardate bartime
    0011 01-02-10 0815
    0022 01-02-10 0820
    0011 01-02-10 1130
    0022 01-02-10 1145
    0011 01-02-10 1230
    0022 01-02-10 1235
    0011 01-02-10 1645
    0022 01-02-10 1650
    these are the times that comes in at 0815 and goes break at 1130 and comes in at 1230 and goes home at 1645
    from these table i have to insert into another table called table2
    and the fields are barcode, date,timein intrin,introut,tiomout
    And the output want to like this
    barcode timein intrin introut timeout date
    0011 0815 1130 1230 1645 01-02-10
    0022 0820 1145 1235 1650 01-02-10
    If any give some good answer it will be help full..
    Thanks & Regards
    Srikkanth.M

    SQL> with table1 as (
      2  select '0011' Barcode,'01-02-10' bardate,'0815' bartime from dual union
      3  select '0022','01-02-10','0820' from dual union
      4  select '0011','01-02-10','1130' from dual union
      5  select '0022','01-02-10','1145' from dual union
      6  select '0011','01-02-10','1230' from dual union
      7  select '0022','01-02-10','1235' from dual union
      8  select '0011','01-02-10','1645' from dual union
      9  select '0022','01-02-10','1650' from dual
    10  )
    11  select barcode, bardate,
    12         max(decode(rn,1,bartime,null)) timein,
    13         max(decode(rn,2,bartime,null)) intrin,
    14         max(decode(rn,3,bartime,null)) introut,
    15         max(decode(rn,4,bartime,null)) timeout from (
    16                          select barcode, bardate, bartime,
    17                                 row_number() over (partition by barcode, bardate
    18                                                    order by bartime) rn
    19                            from table1)
    20  group by barcode, bardate;
    BARC BARDATE  TIME INTR INTR TIME
    0011 01-02-10 0815 1130 1230 1645
    0022 01-02-10 0820 1145 1235 1650Max
    http://oracleitalia.wordpress.com

  • How to search for a record before insert or update a table?

    I need use user input collected to check to see if there is a record already existing, if yes, update the record, if not insert a new record.
    I try to use the select command first to figure out if there is a record matching already:
    String User;
    String sql="select from OFA_WEB_REPORT where username=?"
    PreparedStatement pstmt=conn.prepareStatement(sql);
    pstmt.setString(1,User);
    I did not see a method in ResultSet could help me to determine if the resultset is null or not?
    Is there any better way to check to see if there is a matching record existing already?
    Thank you in advance

    ReSultSet rs=pstmt.execute();
    if(rs.next())
    System.out.println("there is a record existing");
    else
    System.out.println("there is not a record existing");
    another,pstmt.execute() return's Value never null.

  • DW CS3 Insert Record/Update Record: Record Form Wizard Error

    I have just bought Dreamweaver CS3 and I am running into some
    problems. I also have Dreamweaver MX 2004. When I use the Insert
    Record: Record Insertion Form Wizard on my Dreamweaver MX 2004 I
    have no problems using the Insert Record function. However, when I
    use the Dreaweaver CS3, I am running into errors. The error I am
    getting is the following..."Apache HTTP Server has encountered a
    problem and needs to close. We are sorry for the inconvenience."
    As well, when I use the update form wizard, when you place
    all your settings and place a redirection after updating to a page
    it does not do it, it stays on the same page and gives me the
    following error..."Warning: Cannot modify header information -
    headers already sent in C:\wamp\www\edit.php on line 50".
    This happens on all internet browsers when I want to insert a
    new record. It takes a long time to load the page and then it
    finally gives me an error which I stated above. I never had a
    problem before. I thought maybe I installed the application wrong,
    so I unistalled and reinstalled the DW CS3. I still get the same
    issue. I became so frustrated that I formatted my hard drive
    thinking make I have a adware or spyware, so to be cautious I
    formatted my computer and installed everything with a fresh install
    and still I get this error. Now my testing server that I use is
    called WAMP. I never had problems with it before using DW MX 2004
    or when I used the trial of DW 8. So now I am out of options. Is
    there a glitch in the new CS3 Web Premium that includes DW CS3
    upgrade software and if there is, is there a download. Can anyone
    help me, please.

    Please bare with me David. I know something is wrong because
    I have made two folders, one that is done in MX2004 and the other
    done in CS3. CS3 is generating errors. For example. In the insert
    page in MX2004 I do not need to make a recordset, however, for the
    CS3 insert page I noticed when I use the insert record form wizard
    it does not work unless I make a recordset where in MX2004 I did
    not need to do this. I've created a add.php and a edit.php of
    MX2004 and CS3. I will place it in the attach code so you can see
    side by side what it is generating. I can see that there are a few
    things that CS3 does change and some how it is making my internet
    browsers show an error saying......"Warning: Cannot modify header
    information - headers already sent in C:\wamp\www\edit.php on line
    50".
    What do I do?
    I noticed that in the following code difference in...
    MX2004 = <?php echo $row_rsTest['test']; ?>
    CS3 = <?php echo htmlentities($row_rsTest['test'],
    ENT_COMPAT, 'utf-8'); ?>
    There is a big difference.
    My database is the following...
    -- phpMyAdmin SQL Dump
    -- version 2.10.1
    http://www.phpmyadmin.net
    -- Host: localhost
    -- Generation Time: Jun 24, 2007 at 04:29 PM
    -- Server version: 5.0.41
    -- PHP Version: 5.2.3
    SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
    -- Database: `mysample`
    CREATE DATABASE `mysample` DEFAULT CHARACTER SET latin1
    COLLATE latin1_swedish_ci;
    USE `mysample`;
    -- Table structure for table `test`
    CREATE TABLE `test` (
    `testID` int(11) NOT NULL auto_increment,
    `test` longtext NOT NULL,
    PRIMARY KEY (`testID`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
    -- Dumping data for table `test`
    INSERT INTO `test` (`testID`, `test`) VALUES
    (3, 'Sample Test');
    =======================================================================
    I use the program called
    WAMP.
    =======================================================================
    PHP PAGES

  • How to get only updated records for a column using loading type INSERT

    Hi,
    Good morning all,
    I have source1 containg 3 columns bill_cd,bill_desc,bill_date and
    source2 has the columns bill_cd,bill_key,source_id.
    My target has the columns bill_cd,bill_date,bill_desc .
    Now the requirement is, bill_cd in target should not repeated when we run the mapping more than one thime. it should get only updated records not the previous records using only INSERT Loading type(for target) not to use update/insert.
    How can we achieve this logic in mapping level.
    Anybody Please give me some solution immediately.
    Thanks in Advance,
    Siv

    Thanks Herzog for your reply,
    Here bill_cd is not unique. Yes,I want only new records using INSERT as loading type. Suppose when the map runs for the first time, bill_cd is loaded with values 1 to 5.
    Now, in the source I have got new records 6 to 10 for bill_cd and when I run the mapping again I need to get only records for bill_cd from 6 to 10 using INSERT as loading type.
    Is it possible to achieve this at mapping level?
    Regards,
    Siv.

  • Can following query be used to find inserted update records.

    hi,
    i am using query1) to insert data query2) to update the record
    query1)
    INSERT INTO [t1]
               ( id
                ,createddatetime
               ,updateddatetime)
         VALUES
               (1
               ,GETDATE()
               ,GETDATE()) 
    query2)
    update t1 set updatedatetime=getdate() where id=@t1
    please tel me will two date cols get same time , that is, will i be able to 
    write following to find inserted/updated rows
    if exists(select * from t1 where createddt1=updateddt2)
    begin 
    select 'inserted'
    end 
    else
    begin 
    select 'updated'
    end
    yours sincerely

    Depending on how you execute both the queries there's a small chance date value comparison may not wok as expected as datetime also has timepart until milliseconds precision. So if you want to retrieve details on records inserted and updated you may use
    something like below
    query 1
    DECLARE @dt datetime
    SET @dt = GETDATE()
    INSERT INTO [t1]
    ( id
    ,createddatetime
    ,updateddatetime)
    VALUES
    (1
    ,@dt
    ,@dt)
    query2
    DECLARE @dt datetime
    SET @dt = GETDATE()
    update t1 set updatedatetime=@dt where id=@t1
    then you can do below to get inserted updated detailsif exists(select * from t1 where createddt1=updateddt2)begin select 'inserted'end elsebegin select 'updated'end
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • One submit button - Insert Record and Update Record

    I have a form in Dreamweaver CS3, using ASP VBScript and an
    Access database. When submitted, the form inserts a record into the
    table CountDate01. The record comes from a hidden field that gets
    its value from a field within that same table. There is no other
    data entered by the user in any other form fields. The info the
    form submits comes from: rsDate1Avail.Fields.Item("Date01").Value
    I would like if the same Submit button could also update a
    record in a second table (registrants) at the same time. I would
    like to submit the same info that comes from the hidden field to
    the second table. So it would be two actions occurring that both
    insert and update in 2 different tables from one submit button. Is
    this possible?
    Here is the code for the existing form action:
    <%
    If (CStr(Request("MM_insert")) = "submitDate1") Then
    If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd
    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_MumConn_STRING
    MM_editCmd.CommandText = "INSERT INTO CountDate01 (Date01)
    VALUES (?)"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param1", 135, 1, -1,
    MM_IIF(Request.Form("hiddenField"), Request.Form("hiddenField"),
    null)) ' adDBTimeStamp
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "form_FT_4.asp"
    If (Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0)
    Then
    MM_editRedirectUrl = MM_editRedirectUrl & "?" &
    Request.QueryString
    Else
    MM_editRedirectUrl = MM_editRedirectUrl & "&" &
    Request.QueryString
    End If
    End If
    Response.Redirect(MM_editRedirectUrl)
    End If
    End If
    %>

    >I have a form in Dreamweaver CS3, using ASP VBScript and
    an Access
    >database.
    > When submitted, the form inserts a record into the table
    CountDate01. The
    > record comes from a hidden field that gets its value
    from a field within
    > that
    > same table. There is no other data entered by the user
    in any other form
    > fields. The info the form submits comes from:
    > rsDate1Avail.Fields.Item("Date01").Value
    >
    > I would like if the same Submit button could also update
    a record in a
    > second
    > table (registrants) at the same time. I would like to
    submit the same info
    > that
    > comes from the hidden field to the second table. So it
    would be two
    > actions
    > occurring that both insert and update in 2 different
    tables from one
    > submit
    > button. Is this possible?
    Yes. Use a command on the redirect page to update the data.
    No, wait, the
    ASP COMMAND IMPLEMENTATION IS BROKEN IN CS3, and remains
    broken in CS4. So
    sorry, you'll have to hand-code it.
    Sorry, I'm just a little bit bitter about the callous
    attitude Adobe has
    shown in fixing the KNOWN BUGS IN THEIR SOFTWARE.

Maybe you are looking for

  • TS1627 I can receive my mail on my iPod and iPhone, but the messages are not coming into my macbook pro.

    When I set up my two email accounts on my new mac, I was receiving mail just fine, and I could check it on any of my 3 devices, and view read or unread between the devices. Now no mail is getting through to my laptop. Any ideas??

  • Encore CS4 Blu-ray Asset shows 00:01:00 upon Import?

    Hello, I was wondering if anybody elase has seen this.  I make my mpeg-2 Blu-rays in Edius (CBR because Encore will not accept VBR without transcoding) and make the BD n Encore. Every so often when I import a file it shows up as only one mintute in l

  • How to exchange data between two web application (servlet)

    Hello, all, I have two servlets: SerlvetA and ServletB, they are deployed as web appA and appB in the same web container(tomcat) How ServletA exchange data with ServletB? I have tried follow methods: 1) appA and appB could not share HttpSession, so I

  • Lightroom- Import or Export - BSOD

    I just wanted to share this information. I can not say it will work for all but it was a particular solution to my troubles. Had a newly built system. Gigabyte motherboard, 6 gb ram, geforce graphics card, Intel I7 chip. I had a clean install of Wind

  • Transfer office to Macbook Air

    Hi, I would like to know how can I simply (if possible) transfer the Office file (word, excel, power point, ...) from my Powerbook G4 to my new Macbook Air (limited connectivity). I just read on Google that the Migration assistant does not accept to