Sender JDBC query

Hello experts,
Please help me in finalizing the query for the below requirement:-
I want to select 1000 records at a time, based on message id. Only the un-processed records should be picked and the minimum of message id should be picked.
Please help. Thanks,
-- Abhi

Abhi,
Your question is not too clear, but whatever I understood, based on that I am writing this query statement.
SELECT <field_name> FROM <table_name> WHERE IS_PROCESSED = 0 and  message_id >= (select min(message_id) from <table_name> where IS_PROCESSED = 0) and   message_id <= (select min(message_id)+ 999 from <table_name> where IS_PROCESSED = 0)
IS_PROCESSED is the flag, which you will update in the UPDATE query.
Hope this helps.
Regards,
Neetesh

Similar Messages

  • Dynamic query configuration in sender jdbc adapter

    Hi,
    According my undertsnading in XI.3.0 dynamic query in sender JDBC adapter is not possible.
    could any one confirms the possibility of this feature in XI 7.0 .
    Thanks,
    venu

    Hi VJ,
    sorry for late responding to your answer.
    One of our requirements is the query statement that we write in sender communication channel should be changed dynamically, for example in where condition the condition parameters values required to change.
    Thanks,
    venu

  • Sender jdbc adapter - no update query

    hi ,
    i am using pi 731 single stack.
    the scenario is - PI has to pick data from view of a hana database. i am using jdbc sender for it.
    pi will not have access to update the table,only pi can read the view of database.So,PI can't use UPDATE query.
    If in jdbc sender channel ,I use SELECT query only and no UPDATE query - will it work ? what will happen if there are 100 records in the view and PI failed after fetching 43 records..will it pick from 44th record next time OR it will start from 0 again ?
    rgds

    Hi SAP PI,
    It has no sense to use the sender JDBC without update query because then always will be taken the same records.
    If you cant update the source DB you only have the choice to talk with the DB administrators that they develop for you a stored procedure that it has to do the work to get different records in every PI access.
    If the PI record process fail with impossible source database update update, the only way (afaik) is to do a PI alert and to communicate it to db sender administrators. There are another option like to store the data in a intermediate table, and so on but all possibilities that i can think now are not to enough good.
    Regards.

  • Two select query in sender JDBC adaptor

    Hi
    We are doing JDFC-RFC scenario, in which i need to fetch the data from two tables (header  and item table) whch correspondes to the 2 table parameter of RFC .
    Any clues how to configure sender jdbc CC having  2 select query ??????
    Regards
    Vijay

    Swatantra,
    You can have a look at the below URL for more info on JOIN.
    http://www.w3schools.com/sql/sql_join.asp
    Best regards,
    raj.

  • Upto how many characters will accept in SELECT query  SENDER JDBC (PI 7.1)

    Hi Friends,
    I have to use Sender JDBC adapter in SAP PI 7.1, I need to use SELECT query only.
    I have a SELECT query is around 2 pages. Is this will accepet in SENDER JDBC in PI 7.1
    Thanks in advance.

    Hi Challarapu,
    You can check it out and if it is not accepted by the same then you need to check the maximal length @ DB settings or JDBC Settings whether it is limited. If not then you are allowed.
    Hope this helps.
    Regards
    Pothana

  • JDBC Sender Update Query

    Does anyone know, in case of Sender JDBC adapter, how is the below handled:
    Say we have the Select Query as below:
    SELECT date FROM TABNAME where FLAG = "TRUE"
    and the update query as below:
    UPDATE TABNAME SET FLAG = "FALSE" where FLAG = "TRUE"
    How do we know whether the adapter will not update the newly added rows (between the times the Select and Update queries were executed) that were not read in the corresponding Select Query.

    Hi,
    We had a similar situation and following description tells you how we handled it:
    1.DB Job was created and scheduled to run at regular intervals which changes the status of the records from FLAG = "TRUE" to an intermediate status, say for e.g. FLAG = "INTM".
    2.Select and update statements were written as follows:
    For e.g.
    SELECT date FROM TABNAME where FLAG = "INTM"
    UPDATE TABNAME SET FLAG = "FALSE" where FLAG = "INTM"
    This solution is running in our Production environment smoothly.
    Question of maintenance of these DB jobs comes into play.But its upto you to decide !!
    Hope it helps !
    Regards,
    Sridhar

  • Join query in sender JDBC

    How to write a join sql commend in SAP PI sender JDBC, please give me example.

    >> how can I divide this rows in XI in my Integration Process????,
    I m not really sure about your actual scenario but if you are looking to club together values based upon some key,you can easily do that in message mapping by using formatByExample standard function.
    Please have a look at the below blog to see its functionality.
    New functions in the Graphical Mapping Tool XI 3.0 SP13

  • Sender JDBC channel stop send messages

    Hi,
    We have  a sender JDBC scenario which is working correctly time ago.
    However, sometimes this channel   stop sending messages although the Adapter Monitor shows that they regularly execute the polling interval.
    We have confirmed that there isn't any connection from XI to target BD.
    In other ocasions, we  are required to restart XI and, after that, this scenario works without any problem.
    What could be the cause?
    How to solve it?
    thanks, in advance
    Carme

    This is rather strange.
    A few of my observations -
    1. When the sender jdbc adapter polls , and there is no data matching the select query, you will still see a message id in Comm Channel Monitoring but with no hyper link.
    2. The actual message id / message is created only if there is data in the database and also the hyper link is enabled.
    3. If you are confident that the data is being commited on the database and that it is XI not pulling the right data, one issue might be - driver issues. Can you check if you have the right compatible drivers for your database on XI server - is there a new'er driver available?
    We hit a similar issue with JMS adapters and we learnt that the JMS server had been updated as a result of which a new driver had to be installed which we did not until we hit intermittent problems like these.
    Hope this helps
    Regards
    Bhavesh

  • Stored procedure in Sender JDBC Adapter

    Hi All,
    My Scenrio goes like this ...
    Stored Procedure(SQL Server) --- PI  -
    File
    I need to write the results of  stored procedure to File.Here I don't need any mapping.So how many DT , MT and MI need to be created?
    The interface need to run by 6AM from Monday to Thrusday, how can i achieve this ?
    Stored Procedure has only select statement and no Update statement , but it takes Date as Input parameter , so what i need to provide in sender JDBC adapter.
    Thanks,
    Monish

    Hi Monish,
    As per your requirement it is JDBC to File. Please be careful with the structure to be created for sender JDBC. I am unable to understand why you donot require a mapping for this. How XI will send the data to a file then.As per my knowledge if it's file to file and just pick and drop then we can neglect IR and go for ID.But here you are working with JDBC and File so you will be in need of it.
    IR:
    DT: 2
    JDBC_Sender_DT
    File_Output_DT(Optional)
    You can use the JDBC sender data type structure for File output also.
    MT as per your DT
    MI:2
    Outbound MI: JDBC structure
    Inbound MI : File structure
    MM: 1
    IM: 1
    ID as similar to other scenarios.All 1 objects for RD,ID,Sender Agreement and Receiver Agreement.
    Sender JDBC channel:
    Query: Select * from table where date
    But I have a query how are you providing date in input paramerter.It will be dynamically entered into the query right.
    You can mention the Avalibility planning for your interface to work in RWB.
    Go to RWB>Component Monitoring>Adapter Engine->Communication Channel Monitoring>Avaliablity Planning
    Please explain.
    Regards,
    Nutan

  • Problem in sender JDBC adapter

    hello,
    I am facing one typical problem in sender JDBC adapter.
    Here is the issue,
    JDBC API method getString threw an exception: java.sql.SQLException: Cursor state not valid.
    Can anyone please help me out in solving this problem?
    Actually after a retry of 3 times the message has been successfully sent. Till then i am getting these error
    On 1st attempt ,
    Error during conversion of query result  to XML java.sql.SQLException: Cursor state not valid
    On 2nd attempt,
    Error during conversion of query result  to XML java.sql.SQLException: Internal driver error                                                                               
    (class.java.lang.InterruptedException)
    On 3rd attempt,
    Processing finished successfully.
    This is the scenario that i can see in the audit log.
    Can you please help me out in solving this issue.
    Thanks,
    Soorya

    Hi gaurav,
    It was a good response from your side.
    I have gone through the FAQ but could not able to find anything.
    Can you please help me out in this regard ?
    Also i am using select query of this kind,
    SELECT
    SEFVHRC.VHRBRCD,SEFVHRC.VHRCUCD,SEFVHRC.VHRVIN,SEFVHRC.VHRMOCD,SEFVHRC.VHRCHAS,
    SEFVHRC.VHRSLOR,SEFVHRC.VHRDIVI,SEFVHRC.VHRMGCD,SEFVHRC.VHRMOCH,SEFVHRC.VHRVHTY,
    SEFVHRC.VHRBDTY,SEFVHRC.VHRMFYR,SEFVHRC.VHRMOYR,SEFVHRC.VHRMODS,
    SEFVHRC.VHRMDTL,SEFVHRC.VHRCLBR,SEFVHRC.VHRRCID,SEFVHRC.VHRARDT,
    SEFVHRC.VHRLUTM,SEFVHRC.VHRLUDT,SEFVHRC.VHRKEYN,SEFVHRC.VHRCTORN,
    SEFVHRC.VHRCTIMP,SEFVHRC.VHRPRDT,SEFVHRC.VHRPRDT,SEFVHRC.VHRRCDT,
    SEFVHFT.VHFCLCD,SEFVHFT.VHFCAT,SEFVHFT.VHFCADSC,SEFVHFT.VHFKEY,SEFVHFT.VHFTEXT1,
    SEFVHFT.VHFTEXT2,SEFVHFT.VHFTEXT3,SEFVHFT.VHFTEXT4
    FROM
    SAPTESTLIB.SEFVHRC,SAPTESTLIB.SEFVHFT
    WHERE
    SEFVHRC.VHRVIN = SEFVHFT.VHFVIN AND SEFVHRC.VHRSTTS = ' '
    and update query of this kind,
    Update SEFVHRC SET VHRSTTS = 'R' WHERE VHRSTTS = ' '
    I am using prity big select query. is there any option to optimize it?
    Can you please help me out in solving this problem
    urs,
    Soorya

  • Problem with Sender JDBC adapter using StoredProcedures

    Hi All,
    I am facing some prblem when i am using StoredProcedure. Please look at the error which i observe in the traces when i try to execute a stored procedure using Sender JDBC channel.
    SQLException during query 'execute MAG_C0210.dbo.biz_mag_ubicaciones  @data="MAG_C0210" , @idciclovida=" ", @idmaestro=" ", @idtiporeplicacion=" "':com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set
    Please help me in this regard ASAP.
    Cheers,
    Soorya

    Hi Praveen,
    It is working fine when i executed the same in the SQL editor but when I use with XI it is failing with error
    mentioned earlier. Please check this and help in solving this asap.
    Regards,
    Soorya

  • Error in sender JDBC Adapater

    I have a select query as
    SELECT * FROM ULIDTA2.F5631505 where QSINTF ='Y'
    update query is
    Update ULIDTA2.F5631505 set QSINTF='Y' where QSINTF ='N'
    i get the following error in my Adapater .
    Sender Adapter v2108 for Party '', Service 'BS_Database_to_RFC_BPM':
    Configured at 2006-03-10 12:31:18 GMT+08:00
    History:
    - 2006-03-10 12:33:06 GMT+08:00: Retry interval started. Length: 60.000 s
    - 2006-03-10 12:33:05 GMT+08:00: Error: SQLException during update 'Update ULIDTA2.F5631505 set QSINTF='Y' where QSINTF ='N'': SQLException: [SQL7008] F5631505 in ULIDTA2 not valid for operation.
    - 2006-03-10 12:33:00 GMT+08:00: Processing started
    - 2006-03-10 12:32:05 GMT+08:00: Error: SQLException during update 'Update ULIDTA2.F5631505 set QSINTF='Y' where QSINTF ='N'': SQLException: [SQL7008] F5631505 in ULIDTA2 not valid for operation.
    - 2006-03-10 12:32:00 GMT+08:00: Processing started

    Hi Amit,
    A JDBC sender adapter has 2 essential fields,
    1. SQL Statement
    2. Update Statement
    Your SQL statement will contain your SELECT statement and once your SQL statement is executed, UPDATE statement is executed. This is done so that records that have been selected by the SQL statement should not be selected again as the JDBC sender adapter will poll over the database for every poll interval.
    If you want to SELECT something from your Database, then you will have to go for a JDBC sender adapter.
    But, if you want to insert/update your Database, then you can go for a JDBC receiver adapter.
    Multiple insertions are possible for a JDBC receiver, but multiple Selection queries (different select queries) are not possible for a single JDBC sender adapter.
    Just check these links to understand how JDBC adapters work,
    If you wanna do update/insert you will have to follow the
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm">Document Formats for the Receiver JDBC Adapter</a>
    For Configuring the Receiver JDBC Adapter refer:
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/content.htm">Configuring the Receiver JDBC Adapter</a>
    For Configuring the Sender JDBC Adapter refer:
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm">Configuring the Sender JDBC Adapter</a>
    Regards,
    Abhy

  • Stored procedure : how to call SP in sender JDBC adapter for mysql

    HI friends ,
    we have JDBC---->XI--
    >SAP  scenario. For some business requirement, we have to call STORED PROCEDURE , please let me know how to call  SP in sender JDBC adapter for mysql .
    Thanks
    mojib

    Hi Mojib,
    Please create a sample stored procedure like this which contains select statement and in communication channel give
    wite stored procedure name only to sql query statment and in update statement write <test>.
    I am executing this stored procedure successfully.
    Create Proc GetResultX As
    Begin
    Select * From TESTX
    End
    Execute statement for stored procedure is :
    Exec GetResultX
    Regards
    Laxmi Bhushan Jha
    Rewards point if found usful
    I have given same answer to one of the same  thread

  • Calling Stored Procedure from Oracle DataBase using Sender JDBC (JDBC-JMS)

    Hi All,
    We have requirement to move the data from Database to Queue (Interface Flow: JDBC -> JMS).
    Database is Oracle.
    *Based on Event, data will be triggered into two tables: XX & YY. This event occurs twice daily.
    Take one field: 'aa' in XX and compare it with the field: 'pp' in YY.
    If both are equal, then
         if the field: 'qq' in YY table equals to "Add" then take the data from the view table: 'Add_View'.
         else  if the field: 'qq' in YY table equals to "Modify"  then take the data from the view table: 'Modify_View'.
    Finally, We need to archive the selected data from the respective view table.*
    From each table, data will come differently, means with different field names.
    I thought of call Stored Procedure from Sender JDBC Adapter for the above requirement.
    But I heard that, we cannot call stored procedure in Oracle through Sender JDBC as it returns Cursor instead of ResultSet.
    Is there any way other than Stored Procedure?
    How to handle Data Types as data is coming from two different tables?
    Can we create one data type for two tables?
    Is BPM required for this to collect data from two different tables?
    Can somebody guide me on how to handle this?
    Waiting eagerly for help which will be rewarded.
    Thanks and Regards,
    Jyothirmayi.

    Hi Gopal,
    Thank you for your reply.
    >Is there any way other than Stored Procedure?
    Can you try configuring sender adapter to poll the data in intervals. You can configure Automatic TIme planning (ATP) in the sender jdbc channel.
    I need to select the data from different tables based on some conditions. Let me simplify that.
    Suppose Table1 contains 'n' no of rows. For each row, I need to test two conditions where only one condition will be satisfied. If 1st condition is satisfied, then data needs to be taken from Table2 else data needs to be taken from Table3.
    How can we meet this by configuring sender adapter with ATP?
    ================================================================================================
    >How to handle Data Types as data is coming from two different tables?
    If you use join query in the select statement field of the channel then whatever you need select fields will be returned. This might be fields of two tables. your datatype fields are combination of two diff table.
    we need to take data only from one table at a time. It is not join of two tables.
    ================================================================================================
    Thanks,
    Jyothirmayi.

  • Stored Procedure in sender JDBC

    Hey all,
    I am trying to call a stored procudure in my sender JDBC adapter to send to an Idoc adapter. In the query statement, do I need to give just EXECUTE <stored proc name> or do I need to set up any special setting in the sender adapter?
    -Teresa

    Teresa,
    Which DB are you trying to access?
    If it is an oracle DB, then unfortunately, Sender JDBC adapter does not support stored procedures for an Oracle DB.
    Reason is that JDBC adapter  expects a RESULTSET while Oracle Stored Procedure returns a Cursor.
    For any other DB, EXECUTE <STOREDPROCNAME> will suffice.
    Regards,
    Bhavesh

Maybe you are looking for