SQL Query in JDBC Sender

Hi friends,
Can u plz tell me when exactly we can use "Query SQL Stmt" and "Update SQL Stmt"?

If you have a scenario that uses the JDBC adapter to connect to the "sending" system and pull data out of it, you will use these options. 
You formulate a SQL statement that queries the database and gets certain information, the JDBC adapter then uses that information to populate the message type that you built in the integration repository. 
You then create an update statement with SQL to tell the database what to do after it has grabbed the data it needs and populated the message type for mapping.
Say for example you wanted to get all the data from the usr01 table in your SAP database (bad example, but bare with me) you could do something like this:
<b>SQL QUERY STATEMENT:</b>  SELECT * FROM USR01
And then following that you wanted to change the MANDT table (once again, don't actually run this command)
<b>UPDATE SQL STATEMENT:</b>  UPDATE USR01 SET MANDT='100' WHERE MANDT='100'
Message was edited by:
        Ethan West

Similar Messages

  • How to use sql variables in jdbc send adapter??

    Hi,
    i wanna use a variable in the sql statement in the jdbc send adapter.
    i know i can key sql statement in the "Query SQL Statement" in the jdbc send adapter.but i dont know how to use variables in the sql statement.
    i mean, for example, the sql statement is "SELECT * FROM t_student WHERE READFLAG = 0", but now i wanna instead of "0"(the value of the READFLAG) using a variable.
    and if i can use a variable to replace the "0"(the value of the READFLAG above sql statement), then how can i send a value to the variable??
    request help in the regard.
    thx in advance.
    Brian

    Hi,
    Use the place holders to pass the data at runtime. Check the below structure for more details.
    Hope this helps.
    Thanks and Regards,
    Kalpesh
    <root>
      <stmt>
        <Student action="SQL_QUERY">
          <access> SELECT * FROM t_student WHERE READFLAG = '$FLAG$ </access>
          <key>
            <FLAG>0</FLAG>
          </key>
        </Student>
      </stmt>
    </root>

  • Update SQL statement in JDBC sender (system fields)

    All,
      Is it possible to update more than 1 field via the update sql statement ?
      Also, is it possible to use system fields ? 
      Something like this
      UPDATE database.table SET processed='Y', date = sy-datum
    Regards, Michel

    Hi
    use sysdate as suggested above
    Check your  generated SQL query format is correct
    At runtime you can find the genereated sql statements by doing configuraitons in Receiver JDBC adapter.
    In the JDBC Receiver adapter you have the Advanced Properties .
    Over there enter the following
    left column logSQLStatement
    right column true
    To see the query created ..
    Login to adapter monitoring ..select the relevant jdbc adapter.
    Now when any message is processed by the jdbc adapter in adapter monitoring at that time you will see a message link. When you click on that link a new window will open. In that window if you click on page down you will get to see the sql statement generated by the jdbc adapter.

  • SQL-Query with JDBC returns error ORA-00600

    Hi,
    I try to execute a SQL-Query using JDeveloper 3.2.3 and the Oracle JDBC-Library 8.1.7
    The following statement
    'ResultSet rset=stmt.executeQuery(SQL-String);'
    where stmt is Statement returns a Database-Error
    ORA-00600 with the Arguments [ttcgcshnd-1], [0] [], [], [], [], [], []
    when the SQL-String queries Varchar2 or CHAR-Columns.
    The Query returns correct values for numeric fields.
    The Database-Server is running on Oracle 9i
    Does anybody know, what could be the reason?
    Thanks, Harold

    I found many forums about it also, but I still haven't got solution yet.
    They talk about the cause, and report to oracle group and so on,
    but I still don't know how to solve my problem and how to enable my oracle 9i jdbc driver working.
    Need help please

  • SQL Query in JDBC

    Can somebody guide me on this Q i have:
    1. can we write 2 separate SQL statements when we configure a JDBC adapter?

    Hi ,
    <i>so can we read from two different tables at the same time when we configure a receiver adapter?</i>
    In receiver JDBC Adapter you can do the insert/update/delete the data and you can execute the stored procedures.
    If you want to retrieve the data from the table, then use Sender JDBC adapter. In this case you can use 2 SQL queries but it is something like update the table etc.. and it is not like selecting the data from 2 tables.Go thru given help link in my earlier post.
    To read the data  from 2 different table you need to use <b>Sender JDBC adapter</b>, not receiver JDBC Adapter.
    Option1 ) ideal way is to use Join conditions so that you will get one message with data from 2 different tables.
    Option2) Use Stored Procedures ..
    More-
    configuring jdbc adapter with multiple tables
    Hope this helps,
    Regards,
    Moorthy

  • SQL query for JDBC adapter

    Hello Everyone,
    I am using a simple SELECT to fetch data from sql DB. The only SELECT it seems to fetch data is when it is getting data from sys tables. It does not work for fetching data from application tables created in the sql DB. Could this be a authorization issue? Listed below are the different SELECT  statements used in PI and that works in SQL too.
    1. SELECT Query :  SELECT * from sys.tables
         UPDATE : <TEST>
    The above SELECT works and I can see all the xml messages in SXMB_MONI.
    2. SELECT Query : SELECT * from  sql_ztable
         UPDATE : <TEST>
    The above SELECT does not show any xml messages. There are records in the sql_ztable.  When checking the CC monitoring I get the following message below.
    Polling interval started. Length: 60.0 seconds
      Processing finished successfully
    Any suggestions?
    Thanks,
    Teresa

    Hi Teresa,
    You have to maintain the select and update statements like below.
    Select statement should be like
    Select * from TableName where fieldname = ''
    The field name should be either status field or date field or anything. You will be having some unique field in the table. This field name will ignore the unneccesary fetching records those are already fetched.
    Update statement should be like
    Update TableName set fieldname = '' where filedname = ''
    Here the field name should be same as the select statement filed name. What ever you have used in the filed name in the select statement you have to use same fieldname in the update fieldname.
    Let me know if you have any doubts. If your issue has resolved close this thread.
    Thanks,
    Raju

  • In JDBC Sender Adapter , the server is Microsoft SQL .I need to pass current date as the input column while Executing stored procedure, which will get me 10 Output Columns. Kindly suggest me the SQL Query String

    In JDBC Sender Adapter , the server is Microsoft SQL .I need to pass current date as the input column while Executing stored procedure, which will get me 10 Output Columns. Kindly suggest me the SQL Query String , for executing the Stored Procedure with Current date as the input .

    Hi Srinath,
    The below blog might be useful
    http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/03/06/executing-stored-procedure-from-sender-adapter-in-sap-pi-71
    PI/XI: Sender JDBC adapter for Oracle stored procedures in 5 days
    regards,
    Harish

  • How to notify in case SQL query(JDBC sender adapter) does not fetch records

    hi,
    How can we notify(by alerts or something) in case SQL query(JDBC sender adapter) does not fetch records? In channels logs it only says processing started & finished(no message is created for same).
    Thanks,
    Mayank

    Hi,
    1 ) What is exact audit log message ?
    2) Try fetching the count in SQL statement  if there are any valid records it will give the count.
        May for testing you can use <TEST> in update statement.
    3) Have you used taskTimeout parameter ?
    4) Are multiple channels polling on same table ?
    regards
    Ganga

  • Proxy to JDBC scenario need dynamic sql query for sender .

    Hi Experts,
    I am developing proxy to jdbc scenario. in this i need to pass dynamic sql query  whre we are passing classical method like below.
    while we are passing select stmt in constant and mapped with access field  and key field mapped with key field.
    MY requirement is like instead of passing select stmt in constant where i can generate dynamically and passed in one field and mapped with access field.

    Hi Ravinder,
    A simple UDF or use of graphical mapping functions in most cases should provide you everything you need to construct a dynamic SQL statement for your requirement.
    Regards,
    Ryan Crosby

  • Update query not working in the JDBC sender Communication channel

    Hi,
    We are working on JDBC to File scenario. As per the configuration, XI should pick the data from SQL database every 20 secs and should update the corresponding flag. We are using subquery in the select and update statement as both header and detail tables are involved.
    Now the issue is, select query is working fine but update statement is not working as expected. It is somehow updating some other records rather than doing for the ones selected by the adapter.
    Moreover logSQLstatement is also not working. Hence we are unable to identify the records which are getting updated.
    Please advise.

    Hi Rumi,
    See Question 8. Transaction Handling (Sender) in [SAP Note 831162 - FAQ: XI 3.0 / PI 7.0 / PI 7.1 JDBC Adapter|https://websmp130.sap-ag.de/sap(bD1wdCZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=831162].
    8.  Transaction Handling (Sender)
    Q: If I have the following configured in a JDBC Sender:
    Select Query:
    SELECT column FROM TABLENAME WHERE FLAG = "TRUE"
    Update Query:
    UPDATE TABLENAME SET FLAG = "FALSE" WHERE FLAG = "TRUE"
    How do I know that the JDBC adapter will not update newly added rows (rows that were
    added between the time that the SELECT and UPDATE queries were executed) that were
    not read in the initial SELECT query?
    A: The SELECT and the UPDATE are run in the same DB transaction, i.e. both statements
    have the same view on the database.
    Make sure that both statements use the same WHERE clause. An additional
    requirement for the correct operation of this scenario is the configuration of
    an appropriate transaction isolation level on the database
    (i.e., repeatable_read or serializable). You might also consider using a
    "SELECT FOR UPDATE" statement instead of a plain SELECT statement to
    ensure proper locking on the database. "SELECT FOR UPDATE"
    is not supported in MS SQL database. In this case please make use of an
    appropriate transaction isolation level on the database. For more details
    please contact your DB vendors.
    After, see Transaction Handling Issues in [SAP Note 1039779 - JDBC Adapter issues(Escape character,Transaction handling)|https://websmp130.sap-ag.de/sap(bD1wdCZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1039779].
    Best Regards.
    Pedro Baroni

  • Parametric SQL in JDBC sender

    Hi All,
    Is there a way to submit SQL statement with dynamic parametr to the JDBC sender?
    I need to get the current date of the PI machine and use it in the  "where" cluase of the "Query SQL Statement" dynamically in the "Proccessing" tab of the JDBC sender
    Thanks,
    Ranny

    What I can do is , Suggest you a way for your reqt.
    Create a Synchronous  Scenario ....
    Sender   ->    XI    ->    Receiver(JDBC) will Give Response on the basis of your query
    On Receiver (JDBC) Side , create `your query like your reqt with Date parameter in mapping Tranformation.
    Regards
    Prabhat Sharma

  • JDBC Sender adapter - can VIEW be used in Query statement

    Hi,
    In JDBC Sender adapter, can we use a VIEW sql query in the "Query SQL Statement" placeholder?
    For eg:
    CREATE VIEW <view name> as SELECT * from <table name> WHERE <condition>
    instead of the usual:
    SELECT * from <table name> WHERE <condition>
    Thanks,
    Vishak

    Hi
    What exactly is your use of creating a view, if you are going to fetch data from different tables, then you can use the view through stored procedures.
    Hope this clears your doubts
    Thanks
    Saiyog

  • JDBC Sender update SQL Statement Question.

    I was wondering if there is a way to have the update SQL statement line in the JDBC sender update by time stamp, this would be very helpful.  Does anyone know a method of doing this?

    In the SAP documentation of the adapter it has this example for using the update SQL statement after the query statement:
    SQL statement for query: SELECT * FROM table WHERE processed = 0;
    SQL statement for update: UPDATE table SET processed = 1 WHERE processed = 0;
    What I want is to be able to put processed = (the current date) instead of processed =1 in the update statement, like this example:
    SQL statement for query: SELECT * FROM table WHERE processed = 0;
    SQL statement for update: UPDATE table SET processed = (the current date) WHERE processed = ' ';
    I seems like you can only use a fixed value for the update statements in the JDBC Sender though, I would like to know if you can use a time stamp or variable there.

  • JDBC sender adapter, ...Processing parameters, Update SQL statement

    in JDBC sender adapter, ...Processing parameters, there is an Update SQL statement field, can u tell me ...why this is required,,,,,and in one of the example scenario...it was given as <TEST>..

    Sudheep,
    In the sender JDBC adapter you have the select query to select data from the database.
    Let us summer 2 cases,
    1. You have <test> in  the UPDATE . In this case, during every polling interval the JDBC adapter will end up selecting the same data from the Database. This would not be needed in most f the cases. Why would you want to select the same data over an over again?
    2. If you have an update Statement in the Update field you can make sure that the data selected in the selected statement is updated so that the same rows are not selected again.
    Take a look at this blog,
    /people/yining.mao/blog/2006/09/13/tips-and-tutorial-for-sender-jdbc-adapter
    Regards
    Bhavesh

  • JDBC Sender Adapter - SQL-Statement

    Hi,
    I'm using the JDBC-Sender-Adapter and need to use a SQL-Statement like this:
    SELECT * FROM myTable WHERE myDate = <current_date>
    Is such a dynamic-sql possible, or can I only use static sql-statements. And if yes how can I solve this problem.
    many thx

    Hi Werner,
    inside the <b>Query SQL Statement</b> you can use <b>SQL EXECUTE</b>
    which can execute a stored procedure
    in which you can do
    SELECT * FROM myTable WHERE myDate = <current_date>
    http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions">XI FAQ - Frequently Asked Questions</a>

Maybe you are looking for

  • Can I use my time capsule with a bad hard drive as a wireless router if I remove the hard drive?

    I have a 500 GB time capsule with a failed HD (i've repalced the whole machine with a new time capsule).  I cannot get past the start up when I plug it in and the light glows a solid amber.  If I remove the hard drive can I use it as just a wireless

  • Export all data of selected line in search help to fields in table control

    I've created a search help which will export 4 fields. These 4 fields should be populated to the corresponding fields in TABLE CONTROL. However, in my program, only the first column is populated and the others are blank. How to solve this problem? Do

  • Sql Server Express 2008 Replication Issue

    There is a POS M/c where Sql Server2008 Express is installed. The Database log has grown upto 94 GB. I am trying to shrink the log file, but the log_reuse_wait_desc  shows in Replication mode. Because it is a expresss edition i am not able to impleme

  • How to by-pass a recorded screen in lsmw, if the field in it is initial?

    Hi I am doing recording for AS02 ttransaction. In this (AS02) transaction,we have Time dependent tab.And I am  recording all fields in that tab .And then go to other screen by pressing  'Add interval ' button and will update the only field date(ANLZ-

  • Actionscript Advice in need!

    Quite hard to explain but here i go, I have several movie clips which are aligned over each other. All of them contain a button to play the 'mc'. I have use the swapdepths script to make the mc arrange to the front when that mc's button is rolled ove