Doubt in query statement in receiver jdbc

HI
Again a doubt in XML format for receiver jdbc.
I want to execute a query
select sum(col1) sum(col2) from tablename where startdate <= tdate.
My payload message looks like this
<AggregateFn action="SQL_QUERY">
  <access>SELECT sum(Weight) FROM KmFuelTrace WHERE resourceno = '$resno$' AND startdate = '$sdate1$'</access>
- <key>
  <resno compareOperation="EQ">CHILLED_02</resno>
  <sdate1 compareOperation="LT">06/08/2007</sdate1>
   </key>
  </AggregateFn>
I am getting a error "Data type mismatch in criteria expression" .
I have defined the datatypes correctly with DateTrans function . I think its the problem with access statement.
How to give the selection criteria for non-text fields. (can i use same quotes and dollar combination for date field too) . Or is there any other mistake in the xml structure

Aarthi,
Try the following
<AggregateFn action="SQL_QUERY">
<access>SELECT sum(Weight) FROM KmFuelTrace WHERE resourceno = '$resno$' AND startdate = $sdate1$</access>
- <key>
<resno compareOperation="EQ">CHILLED_02</resno>
<sdate1 compareOperation="LT">06/08/2007</sdate1>
</key>
</AggregateFn>
Also check what us the date format that database uses and give the similar format.
Regards,
Sudharshan N A
Message was edited by:
        Sudharshan Aravamudan

Similar Messages

  • 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

  • How to examine the generated SQL statement in Receiver JDBC Adapter

    I have been searching this forum how to display te generated sql statement (by the jdbc receiver adapter).
    The only suggestion is to use RWB, but I was unable to find any details about how to do so.
    Any help is appreciated

    Hi,
    To add, u can see the SQL Statements in Audit log of RWB.
    Select Message Monitoring-> Adapter Engine. choose ur entry and click on Details option button, u can see the SQL Statements in Audit Log.
    Regards,
    Sudharshan
    Message was edited by:
            Sudharshan Aravamudan

  • Select Query in the receiver JDBC

    Hello all,
    Is it Possible to use the select query in eceiver JDBC.
    Thanks,
    Srinivasa

    Hi Srinivas,
    You can either create the structure or can directly write the SQL_QUERY or| SQL_DML  statement where you will specifty the action SQL_QUERY | SQL_DML .
    So you can use either XML SQL Format or Native SQL Format. Please see this help srini:
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    Regards,
    ---Satish

  • QUESTION abt "SQL_DML" of the Receiver JDBC Adapter

    HI ALL,
    i hav a doubt abt "SQL_DML" of the Receiver JDBC Adapter.
    i wanna use two SQL Statements in the "SQL_DML" structure to manipulate two tables.
    i.e.
    <root>
      <stmt>
        <Customers action="SQL_DML">
          <access>
                          INSERT INTO Customers VALUES (u2019$NAME$u2019, u2019$ADDRESS$', '$KEYFIELD$u2019);
                          INSERT INTO Companys VALUES('$NAME$')    
          </access>
          <key>
            <NAME>Company</NAME>
            <ADDRESS>Street 3 </ADDRESS>
            <KEYFIELD>CO</KEYFIELD>
          </key>
        </Customers>
      </stmt>
    </root>
    BUT i cant ascertain if it permit like this writting above ??
    Requset help in this regards.
    Thx in advance.
    brian

    Hi,
    You need to have two different statements. Each for one insert query. Your query will come under access tag and palceholders under kay tag. Action will remain same as you have given, but under both statements.
    Ex:
    <root>
    <stmt1>
    <Customers action="SQL_DML">
    <access>
    INSERT INTO Customers VALUES (u2019$NAME$u2019, u2019$ADDRESS$', '$KEYFIELD$u2019);
    </access>
    <key>
    <NAME>Company</NAME>
    <ADDRESS>Street 3 </ADDRESS>
    <KEYFIELD>CO</KEYFIELD>
    </key>
    </Customers>
    </stmt1>
    <stmt2>
    <Customers action="SQL_DML">
    <access>
    INSERT INTO Companys VALUES('$NAME$')
    </access>
    <key>
    <NAME>Company</NAME>
    </key>
    </Customers>
    </stmt2>
    </root>
    Hope this helps.
    Regards,
    Siddhesh S.Tawate
    Edited by: siddhesh tawate on Apr 24, 2009 8:10 AM

  • 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

  • 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.

  • Receiver JDBC

    Hi
    the receiver JDBC structure
                                                                       occurence
    <statement1>   ----------------------------->                   1..unbound    or    1..1                               (1)
    <Table>            ----------------------------->                1..1 per statement always                             (2)
    <access>         ----------------------------->                  1..1 per statement always                             (3)
       <fld1></fld1>                                         
       <fld2></fld2>
    </access>
    <key> --------------------------------------->                   1..unbound    or  1..1                                       (4)                          
      <val1>
    </key>
    </statement1>
    <statement_response>  --------------->                        should be 1..unbound <b>if</b> statement request is 1..unbound (here statement1)
                                                                                    should be 1..1 <b>if</b> statement request is 1..1 (here statement1)                        (5)
    <row>                                       
    <row>
    </statement_response>
    -&gt; In which case we go for occurrence of statement (here statement1) = 1..unbound ??
    -&gt; if i need to select from one table do i need to use this as 1..unbound ?? Yes/No
    --&gt;each statement response (means all rows of that query) will come under row node with multiple occurrence Yes/No??
    --&gt;if i want to delete the rows from table where col= (value array) in this case i have to give key occurence as 1..unbound??Yes/NO
    --&gt;if i want to select all the data from one table..i no need any key..but as per sap help doc..if we dont specify the key the adapter will not accept and shows some error message...so i should some dummy key value..and need to compare with NEQ to NULL or space???
    --> If i want to select the data from JDBC using the receiver structure...can i declare all the field types as string in request and response structure..or it should match the data types of fields in data base..?? if so how it should be in select request and response structure??
    (1) (2) (3) (4) (5) are right or wrong..if wrong correct me..
    Thanks
    krish
    Edited by: murali krishna on Mar 24, 2010 5:30 PM

    Krish,
    Please see the below response
    Answer-1
    If you are selecting data from Different tables then you need to define Statement as 1.. Unbounded
    Answer- 2
    No. Since you are selecting data from one table - you can define it as 1..1
    Answer -3
    There will be only one Statement_Response per Statement. In other words if you have Multiple Statement in the Request , then you will have Multiple Statement(x)_Response
    So Under Statement_Response you will have Multiple Rows(for each record in the database) . YES - Row has to be 0.. Unbounded
    Answer- 4
    YES - You are correct
    Answer-5
    YES - you can define them all as a STRING. It shouldn't be a problem
    Hope it helps!
    Thanks!

  • When would you write a stored procedure in sender/receiver jdbc adapter

    Hi Everybody
    Can you tell any situation where you would need to write a stored procedure in the query sql statement of sender/ receiver jdbc adapter instead of writing SELECT statement there
    why do we need to write stored procedures
    thanks and regards,
    Anitha

    Hi Anitha,
    why do we need to write stored procedures
    Some times a single SQL statement will not suffice for ur transactions....
    Say u want to access from 2 tables and update based on some condition..
    or nested select statement...
    or u want to update a 2 nd table based on the values from 1st table... etc..
    In those places it's preferable for going for a Stored Procedure.
    The Stored Procedure can be used in both Sender and Receiver JDBC Adapter.
    Still nt clarified do post..
    Babu

  • Using Stored procedure in sender or receiver jdbc adapter

    Hi All,
    Please let me know simple blogs for Stored procedure used in sender or receiver jdbc adapter to get data from 2-3 tables
    Thanks

    Hi
    To work with Store proceudres (SP) you have to create the SP's in database like Oracle, Mssql or Msaccess.
    Ususally the SP creations are done by database experts. For more info about "SP" try Googling!
    The below blog is about SP but not the one you expect!
    /people/itisha.alok/blog/2009/03/23/jdbc-stored-procedure-returning-multiple-resultsets
    Executing an Oracle Stored Procedure from Sender JDBC adapter
    Sender Adapter - -
    SP will contain the select Query alone or with it will contain insert, delete statement too.
    Receiver:
    SP will have insert or delete satement.
    Adapter
    http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/frameset.htm
    The below details are required  to configure the adapters
    Driver details
    database name
    Procedure name
    user name
    password,
    Regards
    Ramg

  • Specify Keys in Data Type for receiver JDBC adapter

    Hi guys,
    I have the following issue:
    In a proxy to JDBC scenario, I want to specify somehow the key values for the SQL statement in the data type that I define for the receiver JDBC adapter. Thus, I am using the following structure in data type:
    root
        Statement
               dbTable
               action
               table
               access
                      CustomerID
                      Name
                      HouseNo
               Key
                      CustomerID
    But in the SQL statement that is produced (I can see that in RWB, CC Monitoring, Audit Log), the "Key" segment is translated into "OR". E.g. UPDATE_INSERT ("A100" "Evaggelos Gkatzios" "El Alamein 19") OR ("A100")
    Do you have any ideas ?

    Hi,
    Its clear from the statement in RWB (in CC monitoring's auditlog) you are using UPDATE_INSERT as the action.
    Please correct me if this is OK. Now the interpretation of input xml file will be like this,
    If the input XML is in the following format
    <root>
    <Statement>
    <dbTable action=UPDATE_INSERT>
    <table>EXAMPLE</table>
    <access>
      <CustomerID>ABC</CustomerID>
      <Name>xyz</Name>
      <HouseNo>123</HouseNo>
    </access>
    <key>
      <CustomerID>DEF</CustomerID>
    </key>
    </dbTable>
    </Statement>
    </root>
    Resultant SQL after parsing the XML file will be,
    1. It will first check with the condition WHERE CustomerID = DEF. If it finds the record with this condition then it will update the record with CustomerID=ABC, Name =xyz & HouseNo=123.
    2. If it doesn't find any record with that CustomerID then, it will insert a new record with the same details.
    In auditlog, you will find two SQL statements like,
    1.UPDATE EXAMPLE SET CustomerID=ABC, Name =xyz & HouseNo=123 WHERE CustomerId=DEF
    2.INSERT INTO EXAMPLE VALUES(ABC,xyz,123)
    hope this has given clear information about your query,
    Regards,
    Soorya

  • Joins implementation receiver Jdbc Adapter

    Hi All
    I need  some suggestions on the following scenario
    Updation of a flag in a table where the column names in the WHERE clause are from two different tables in the same database.
    i.e
    UPDATE T1
    Set T1.flag =1
    where T1.columnA=value1 and T2.columnB=value2
    where T1 and T2 are two different tables in the same database,
    I want to accomplish this directly using UPDATE in JDBC receiver by using JOIN query in the structure.
    kindly reply
    thanks
    sd

    Hi Sd,
    You can execute an SQL statement directly in your Receiver JDBC adapter.
    Check this link for that,
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    Check the part for STATEMENTNAME6 and also the example for that in the same link,
    Regards,
    Bhavesh

  • Exactly-Once Handling in Receiver JDBC Adapter

    Hi,
    I have doubt abt Exactly-Once Handling in Receiver JDBC Adapter.
    For Conflict Resolution as Database.
    Why there is need to define table as below ?
    In the database where the write-to tables are located you must create an additional table with two columns for this purpose. To define the table, specify the following:
    Database Table Name
    Enter the name of the table.
    Key Column Name
    Enter the name of the column in which the key is entered.
    Value Column Name
    Enter the name of the column in which the key value is entered.
    Please explain in simple language.

    Hi Abhishake,
    Thanks for your reply.
    I understant that the tables needs to be created in DB.
    But if you read the SAP Docs for conflict resolution. My undestanding is "During Database commit if AS Java is terminated then the message will be in unknown state, for this type of messgaes when the AS Java restarted the behaviour is defined by this parameters. If the message doesn't have primary key, then there is probablity when AS Java will try second time it may get the message in DB so a message can be duplicated. To avoid this condition it is mentioned that you must create additional table with three column".
    Please correct my understanding if I am wrong.
    My additional table needs to create & how it will resolve the problem.
    Thanks in advance.

  • SELECT COUNT(*) WHERE Receiver JDBC?

    How can I do a SELECT COUNT(*) WHERE SQL statement with a Receiver JDBC?

    Hi,
    Refer this document - but if you have select query
    "All return values are returned in an XML structure."
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    Hope this helps,
    Regards,
    Moorthy

  • Receiver JDBC: Error while doing the Deleting and Inserting new records

    Hi All,
              I am doing Idoc to JDBC scenario. In this I am collecting & bundling different type of Idocs and then sending to the JDBC receiver. My requirement is to delete the existing records in the database and insert the new records. I have configures as mentioned in the link
    Re: Combining DELETE and INSERT statements in JDBC receiver
    In the above link its shows for single mapping. In my scenario I am using multi mapping for collecting idocs in BPM. If I configured for normal mapping then it is working fine(Deleting existing records and Inserting new record). Whenever I am using multi mapping then I am getting following error in the receiver JDBC communication channel u201CError while parsing or executing XML-SQL document: Error processing request in sax parser: No 'action' attribute found in XML document (attribute "action" missing or wrong XML structure)u201D . Can you please tell me what might be the problem.
    Thanks & Regards,
    T.Purushotham

    Hi !
    check this out:
    JDBC - No 'action' attribute found in XML document - error
    JDBC receiver adapter: No 'action' attribute found in XML document
    It appears that the inbound payload (the one that is going from XI to the JDBC adapter) does not have the requiered tag to specify which SQL action to execute in the receiver system. Maybe the multimapping is not creating the desired output message format.
    Regards,
    Matias.

Maybe you are looking for

  • System Image Restore in Window 8.1

    I have not been able to find a data migration application that works at cloning a Windows 8.1 hard drive to a new SSD.  With that in mind I want to go about moving the contents, data and operating system from my working C: to a new SSD.  I want to go

  • Xml encoding on web service request in flex 3

    The encoding of xml on the <mx:request> tag has changed as of flex 3 build 185179. In prior builds I could bind a variable that contained an XML fragment and it was left untouched. As of build 185179 the "<" and">" characters are encoded as < and > r

  • Adding checkmarks in Acrobat X Pro

    I am creating a 'fillable form' in Adobe Acrobat X Pro and was curious if anyone knew how to insert a 'check box' with the only option of selecting ONE box, instead of the option to select ALL?

  • Partner interface process (pip) in BPM

    can you give an idea abt partner interface process (pip) in BPM???

  • Airport Extreme and Verizon Hub

    I recently purchased the Verizon Hub and I am currently using the airport extreme to communicate with it wirelessly. It is working great just one little set back, sometimes when trying to make a phone call i can not hear the phone ringing but in fact