JDBC Adapter - DELETE like statement

Hi all,
I want to DELETE some data from SQL SERVER.
My SQL statement is:
DELETE FROM dbTableName  WHERE col1 = u2019val1u2019 AND
                                                          col2 LIKE u2019*u2019 AND
                                                          col3 = 'val3'
My XML message is:
<statement1>
   <LINES  action="DELETE">
      <table>dbTableName</table>
      <key>
        <col1>val1</col1>
        <col2 compareOperation="LIKE ">*</col12>
       <col3>val3</col3>
     </key>
  </LINES>
</statement1>
I don't receive any error, but nothing is deleted from dbTableName.
Waiting for some suggestions.
Regards,
Natalia.

Hi,
I have a trigger in SQL SERVER on this table:
add update/delete trigger to dbTableName table */
CREATE TRIGGER  tr_DBTABLENAME UPDATEDELETE ON DBTABLENAME
instead of update, delete
AS
UPDATE DBTABLENAME
   SET
     DBTABLENAME .DMLoperation=1,
     DBTABLENAME .DMLTimeStamp = GETDATE()
FROM DBTABLENAME  JOIN Deleted ON DBTABLENAME .Val1= Deleted.Val1AND DBTABLENAME .VAL2 = Deleted.VAL2 AND DBTABLENAME .VAL3 = Deleted.VAL3
INSERT INTO DBTABLENAME
   SELECT Inserted.*
      FROM Inserted LEFT JOIN DBTABLENAME  ON
           DBTABLENAME .Val1= Inserted.Val1AND DBTABLENAME .VAL2 = Inserted.VAL2 AND DBTABLENAME .VAL3 = Inserted.VAL3
   WHERE DBTABLENAME .DMLoperation is null
UPDATE DBTABLENAME
   SET
     DBTABLENAME .Val1= Inserted.Split_Src, DBTABLENAME .VAL2 = Inserted.VAL2, DBTABLENAME .VAL3 = Inserted.VAL3, DBTABLENAME .LAST_FILED = Inserted.LAST_FILED, DBTABLENAME .DMLTimeStamp = GETDATE(), DBTABLENAME .DMLoperation = 2
FROM DBTABLENAME  INNER JOIN Inserted ON DBTABLENAME .Val1= Inserted.Val1AND DBTABLENAME .VAL2 = Inserted.VAL2 AND DBTABLENAME .VAL3 = Inserted.VAL3
May be this is the reason.
Thanks,
Natalia.

Similar Messages

  • Sender JDBC adapter : Update SQL Statement : stored procedure

    Hi,
    Can we use a stored procedure in the sender jdbc adapter in 'Update SQL Statement'.
    The problem i am facing is like, we are selecting data from two tables in 'SQL statement for query' and then in 'Update SQL Statement' , we need to delete that data from these two tables.
    Please let me know if it is possible.
    Thanks,
    Rohit

    you can use a Stored procedure in the
    Query SQL Statement
    You have the following options:
    ·        Specify a valid SQL SELECT statement to select the data to be sent from the specified database.
    ·        Specify an SQL EXECUTE statement to execute a stored procedure, which contains exactly one SELECT statement.
    The expression must correspond to the SQL variant supported by the relevant JDBC driver. It can also contain table JOINs.
    so have your whole select and update as part of this single Stored procedure

  • JDBC Adapter - DELETE operation not working in receiver backend system

    Hi All,
    In my scenario ,I want  to delete entire records of the table from one backend system.
    I have created the inbound message and after mapping it is as below:
      <?xml version="1.0" encoding="UTF-8" ?>
    <ns0:abc_delete xmlns:ns0="http://abc/xi/BACKEND/IB_IF_18/100">
    <STATEMENTNAME>
      <F12345 action="DELETE" />
      </STATEMENTNAME>
      </ns0:abc_delete>
    here F12345 is the table name.
    When I execute this scenario I get black and white flag in XI SXMB_MONI but in backend system (SQL Server) no records get deleted the table is as it is.

    Please have a look on this (same mentioned by Bhavesh)...
    http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/frameset.htm
    <b><b>  <StatementName3>
    <dbTableName action=”DELETE”>
    <key1>
    <col2>val2old</col2>
    <col4>val4</col4>     
    </key1>
    <key2>
    <col2>val2old2</col2>
    </key2>
    </dbTableName> 
      </StatementName3></b></b>
    &#9679;      action=DELETE
    Statements with this action cause existing table values to be deleted. One or more <key> elements formulate the condition for which table values are deleted. The names of <key> elements are arbitrary. Column values within a <key> element are combined with a logical AND; different <key> elements are combined with a logical OR.
    The corresponding SQL statement for StatementName3 in the example above is as follows:
    DELETE FROM dbTableName  WHERE ((col2=’val2old’ AND col4=’val4’) OR (col2=’val2old2’))
    The response document contains the following element:
    <delete_count>count</delete_count>
    If there is no <key> element, or if there is a <key> element but it is empty, then no condition is specified and the entire table is to be deleted. This may not be permitted by the configuration of the JDBC adapter for security reasons and will therefore result in an error during message processing and an appropriate error message.
    Thanks
    Farooq.

  • Sender JDBC adapter -- Update SQL statement NOT work for the last record

    I'm trying to use SAP XI to send records from Oracle database to As/400 using JDBC adapter.  I've defined the communication channel for sender
    (1)  The "Query SQL statement"  = select  a_bgn_dt,  a_end_dt from  PX_PXXD WHERE NOT CU_ACTION_CD='P' 
    (2)   The "Update SQL statement"  = update PX_PXXD set CU_ACTION_CD='P'  WHERE NOT CU_ACTION_CD='P' 
    Supposed that 3 records were retrieved from (1) and successfully updated to AS/400 but only the first 2 records in Oracle database are updated according to (2)
    Any advise.
    Pansy

    Hi Pansy,
    You select and update query is looking like wrong
    kindly check below query,If you are using oracle
    (1) The "Query SQL statement" = select a_bgn_dt, a_end_dt from PX_PXXD WHERE CU_ACTION_CD !='P'
    (2) The "Update SQL statement" = update PX_PXXD set CU_ACTION_CD='P' WHERE  CU_ACTION_CD !='P'
    Thank you
    Sateesh

  • Xi JDBC Adapter - Query SQL Statement & Update SQL Statement

    Hi!
    I configure the JDBC adapter sender (XI) to take data from Oracle database.
    I set the Query and Update SQL Statement in the Processing parameters of the communication channel in this way:
    Query SQL Statement :
    SELECT * FROM XI_TABLE WHERE STATUS = 'WAIT' ORDER BY ROW_NUM
    Update SQL Statement :
    UPDATE XI_TABLE SET STATUS = 'DONE', DATE = SYSDATE WHERE STATUS = 'WAIT'
    My question is :
    If a new record with the field STATUS = 'WAIT' is added to the table (xi_table) during the time between the execution of the query statement and the start of the update statement, what will happen to that record during the update?
    There is a way to avoid the update of that record? or to pass to the update statement only the record selected in the query statement?
    Please, may you give me some example?
    Thanks,
    Francesco

    hi,
    did you check "Isolation Level for Transaction"
    for the sender jdbc adapter?
    http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm
    Regards,
    michal

  • JDBC Adapter: DELETE and INSERT in Mapping

    Hi,
    I have a JMS to JDBC interface. While this is straightforward enough, there is a requirement to clear the contents of the table before carrying out the insert
    What I've tried is:
    <MT_Message>
       <Statement>
            <TableClear>
                 <action> .....attribute mapped to SQL_DML
                 <access> ....element mapped to DELETE FROM table
            <TableInsert>
                  <action> .....attribute mapped INSERT constant
                  <table> ......element mapped to Table name
                  <access> ...allthe fields in the table
    The DELETE statement works and the Insert statement work but they won't work together. Is this possible at all? What other options are there in this case?

    I went for two different Statement tags so the structure of the Message Type is:
    <MT_Message>
      <StatementDelete>
             <TableClear>
                 <action> ....attribute mapped to SQL_DML
                 <access> ...element mapped to DELETE FROM Table
      <StatementInsert>
             <TableInsert>
                  <action> ....attribute mapped to INSERT constant
                  <table>  ....element mapped to table name
                  <access> ...all the columns in my table

  • Jdbc adapter log sql statement to file

    Hi,
    I'm using a Proxy to Jdbc scenario.
    In the Adapter Configuration the logSQLStatement is set to true.
    Is it possible to log the sql statement shown in the Audit  to a file?
    Regards Ralf

    Hi
    please try the below query in Update sql statement
    update table_name set fieldname = systimestamp where .....
    or
    update table_name set fieldname = current_timestamp where .....
    Regards
    Ramg.

  • JDBC Adapter - Update SQL Statement - Timestamp

    Hi All,
    I'm using a JDBC Sender channel to bring information from a database, when I bring the data I want to UPDATE a field inserting the date and time (timestamp) when you got the info.
    Sender Communication Channel: JDBC
    Query SQL Statement:  SELECT * FROM PI_Factory
    Update SQL Statement: ????????
    Could you tell me how to do this?

    Hi
    please try the below query in Update sql statement
    update table_name set fieldname = systimestamp where .....
    or
    update table_name set fieldname = current_timestamp where .....
    Regards
    Ramg.

  • Dynamic Parameters to JDBC Adapter

    Hi all,
    Normally we will setting JDBC adapter parameters like
    driver name & connection details in the adapter.
    Is it possible to change/set using a user-defined function in mapping ?
    Thanks in advance.
    Chemmanz

    hi michal,
    thanks for the reply.
    in our case we will have to access multiple schemas using one channel.
    schema is dynamic and is coming along with the message.
    Regards,
    Chemmanz

  • Output from JDBC Adapter mapped to multiple message types

    Hi!
    I face to a problem with the message mapping.. I do select with the JDBC adapter. This statement selects one field of clob type and it already contains a message - XML document. Depending of the type of this message will be done the message mapping and also the target message type depends on this XML document type. But when u define message mapping, there must be always a target message type... But in the design time, I don't know the exact type! It is dynamic...
    And not just with the message, the same situation is also with the target interface...
    Any ideas how to solve this?
    Thanx, Peter
    Message was edited by: Peter Jarsunek

    Hi,
    I saw the weblog, but I think more important is the 'XI in action' mentioned in this one..
    /people/ravikumar.allampallam/blog/2005/06/22/sap-xi-in-action
    What I just can not understand from that blog is the step 2/4:
    Receive XML file of any format and route to interface specific BPM..
    How is it possible? On the output from the 1st BPM must be exact interface defined... How can different messages go out and than into the 2nd BPM?
    Can you please write me, how the individual steps could follow after each other to achieve this?
    Message was edited by: Peter Jarsunek

  • Messages are in hold state due to one message at receiver JDBC adapter

    Hello,
    I am using a receiver JDBC adapter and trying to send an XML file which has an insert query to insert some data into the database i.e., Oracle 9i.
    Here at the receiver side due to one message (  which is in to be delivered state) all other messages are got hold and waiting for long time.
    I am getting the exceptions as this,
    JDBC Adapter processing failed with Error processing request in sax parser: Error when executing statement for table/stored proc. 'FSASMGR.XTBL_KL06_IINQUIRY' (structure 'REC01'): java.sql.SQLException: ORA-12899: value too large for column "FSASMGR"."XTBL_KL06_IINQUIRY"."CASE_TITLE" (actual: 81, maximum: 80)
    Exception caught when executing statement for table/stored proc. 'FSASMGR.XTBL_KL01_ISTAFF_MST' (structure 'REC1'):
    java.sql.SQLException: ORA-00001: unique constraint (FSASMGR.XTBL_KL01_ISTAFF_MST) violated
    Can anyone help me out in solving this issue.
    THanks,
    Soorya

    hi surya,
    jdbc channel tries a request for n number of times(no of rettries),if that request fails it will take up the following requests,its not like it will process a request forever.
    to be delivered will be resulting if reciever is down or network between XI and database server is bad.
    try to ping databse server from XI host system.
    if everything is fine then look at the channel configuration->advanced->no of retries of database transaction on sql server.
    just redue the count to 1 and recheck.
    Regards,
    rama Krishna

  • DYnamic select statement in JDBC adapter?

    Hi guys,
                 Is it possible so send dynamic select statement in jdbc adapter?
    XIer

    Aamir,
    The poster did not specify whether this was sender or receiver channel, but it would only make sense that a "dynamic query" must be on the receiver communication channel since if it was on the sender channel, the channel would have to intelligently determine how to do dynamic queries.
    Also, the poster asked if there was a way to "send a dynamic query" to the channel.  This seems to imply that the channel is receiving information from somewhere to determine the query, which could only mean it is a receiver channel.
    If you would like more information on the JDBC sender communication channel, please open a new thread.

  • JDBC Adapter Sender How to delete 3 tables?

    Hi all, I need to delete records of 3 tables after the Communication Channel send the information.
    The problem is I want to put the 3 sentences in the Update SQL Statement separated with ";" but it does not work.
    This is my statement
    DELETE from table1 WHERE field1='3';DELETE from table2 WHERE field1='3';DELETE from table3 WHERE field1='3';
    This is the error in the Runtime Workbench.
    Database-level error reported by JDBC driver while executing statement 'DELETE from pruebas.SAPRCTGH WHERE DGHSTS='3'.'. The JDBC driver returned the following error message: 'java.sql.SQLException: Token . was not valid. Valid tokens: <END-OF-STATEMENT>.'. For details, contact your database server vendor.
    When I tested from Razor SQL it works fine, I do not know what more to change.
    Regards,
    Sebastián Alvarez

    Hi all.
    Thank you very much for your answers.
    I'll try one thing, I'll create another Service Interface and in the Configuration Scenario create another Receiver Agreement, so the message will be sent to ECC and will "return" like inbound to delete the tables with 3 delete statements.
    Thank you very much to all of you.
    I'll try this and I'll tell you
    Regards

  • UPDATE statement in Receiver JDBC adapter

    Hi all,
    I would like to use UPDATE statement in my receiver JDBC adapter and would like to know how this UPDATE statement works in following case.
    1) If i have 10 records to be updated in database, whether Commit happens at the end of all 10 records updation OR it will be for every record update?
    Regards

    Hi,
    Then let me construct my query this way...
    i have 10 records that needs to be updated to database, say For Ex: 7 records are updated successfully and 8th record has issue in updating the table.
    In this case i would like to ROLLBACK entire 10 records with out committing any thing.
    So if i use your 2nd option, it should perform as i expected right?
    Regards

  • Providing Query statement in JDBC  adapter

    HI experts,
    Everybody knows we can provide Query to JDBC adapter by two ways...
    1st way is by constructing query as XML structure..
    2nd way is by giving exact query (Select * from tablename )by SQL_query in access ...
    I like to know the performance of these two ways...
    Regards,
    Sasitharan

    In XI version 3.0 there is only one way to do lookups - manually in the form of an exit in the mapping process. A user exits must be written in Java.
    There are a couple of considerations about performance that must be kept in mind besides just the question of “SQL Statement” while implementing a database lookup using a JDBC adapter:
    1.     The mechanism for database lookup
    There are 2 approaches – Direct, Indirect
    In Direct approach you poll the external table hence this may lock database for access to other users, also it is an intrusive approach. In indirect approach database table is replicated and the replicated table is accessed. The second approach is recommended for performance reasons.
    2.     Does the data to be looked up change frequently
    If data does not change frequently than pull in data and keep a copy locally – as this will improve performance
          2. It is possible to access an external database from within the mapping step of XI utilizing
    A.     regular JDBC constructs
    B.     utilization of J2EE JDBC Connector
    Approach 2 is recommended as it is more efficient because of Connection pools.
    There is no concept or need to XML code here. The Java code that executes the lookup, would call the sql statement, this java code can  be referenced from within a user-defined function in the graphical mapper or from within XSLT.
    Hence you need SQL statement in J2ee JDBC Connector to get the best performance.
    Refer to URL
    http://searchsap.techtarget.com/tip/0,289483,sid21_gci1246926,00.html#
    to understadn how to configure the JDBC Connector Service to perform database lookups
    Let me know if this helps.

Maybe you are looking for

  • Query Help - Embedded Select

    Hi The following Query will show me catalogue IDs and Descriptions of all the hired outfits for each Branch, with the revenue generated in descending order.... SELECT Members_Order.Catalogue_ID, Item.Item_Description, Item.Colour Orders.Branch_ID, It

  • IPod 60Mb on XP

    My hard drive (and iTunes) is getting very full with my gazillion CDs, and I am contemplating replacing the drive with a new one, or adding a "slave" drive, preferably the former solution. Are there any major pitfalls awaiting me, i.e. not being able

  • CS4 to CS3 compatibility?

    I am considering downloading the CS4 beta but wondered whether there are issues with backsaving to Fireworks CS3? Does anybody have any experience/info? Thanks in advance. Tom

  • How can I drop the previous location on maps

    How can I drop the previous locations on maps?

  • Fonts in Captivate

    I'm using Captivate 5 Windows. Do learners need to have the fonts on their computer that are being used in the Captivate SWF? If I use a special font for headings, will learners have problems viewing the font correctly?