JDBC Sender MSSQL Stored Procedure - Multiple Select Statements

Hello all,
I will proceed to tell you my problem, for which solution I request your kind advice:
Im working in a project for a retailer, which consists in sending the information from erp and sql server to pos thru XI interfaces.
One of the interfaces is about sending items from sql server to a file so the pos can load it into the system. For doing so I have devloped an stored procedure which function is to return several select statements as many stores the retailer might have, so they can have a different file per store along with its corresponding items in it. 
The thing is that XI just gets the first select statement and creates the corresponding file, but it seems to ignore the remaining responses as I'm neither getting any file nor an error afterwards.
So, my question is: is XI capable of handling multiple select responses from an Stored Procedure in graphical mapping??? Or am I just wasting my time trying?
Thanks in advice for your help.
Regards.

Hello Ramkumar,
After 5 days trying, I finally made it work out applying your advice. Below the short explanation of what I did:
My Source structure is: Main Node->Row->Records (Material Number, StoreNum, Price, Status)
My Target structure is: Main Node->File Node->Record Node->Records ( Material Number, Price, Status)
The key was to make all the occurrences happen against StoreNum node. So, based on what you adviced these two where the key mappings:
1) The Mapping that will create a new file for each different store that comes in the query (In my case, query was already sort by store using an sql "order by" function, if not you can also use xi node function "sort" as Ramkumar suggested)
StoreNum->RemoveContext->SplitbyValue (Value Changed)->Collapse Contexts->File Node
2) The Mapping that will create each record in its corresponding store file:
StoreNum->RemoveContext->SplitbyValue (Value Changed)->Record Node
And Voilá !!! It worked.
Thanks very much Ramkumar.
Regards.

Similar Messages

  • JDBC Sender With Stored Procedure & Context Handeling

    Hi All,
    In my scenario i am using stored Procedure in JDBC sender adapter for Fetching data,
    I am fetching data from 3 tables kepping a one key element Exampkle  <matnr> for each value in this <matnt> in table 1 i will fetch the corresponding records in table 2 and 3 ...
    how can i use context in mapping such a sender structure to hendle the emplty value ...give me some idea...
    if any one has come across such situation plz help me ....it very urgent .
    thanks
    Shakif

    Hi,
    Follow this
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    JDBC adapter
    /people/saravanakumar.kuppusamy2/blog/2005/01/19/rdbms-system-integration-using-xi-30-jdbc-senderreceiver-adapter
    stored procedure
    /people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
    Helpful link
    http://help.sap.com/saphelp_nw04/helpdata/en/45/023c41325fa831e10000000a1550b0/frameset.htm
    Might help you..
    vasanth.

  • JDBC Sender - Oracle Stored procedures

    hi all
    i am working on JDBC sender - File receiver
    I am fetching data from Oracle database
    if i write select query directly in sender adapter the scenario is working properly but when try to write stored procedure in oracle and use execute statement in JDBC, adapter is throwing error.
    As in oracle to fetch multiple rows i have to use cursors .
    i read lot of articles in forum but still not clear on following issues :can any one solve them?
    1 . To get multiple rows can i write SP without cursors?
    2 . If SP is using cursor do my XI accept it or it only accepts  resultset? in that     case how to write sp.
    thanks & regards
    sheetal

    Sheetal,
    Adding to Jai Shankar's reply, Like pointed out, Oracle Stored Procedures return Cursors and XI sender JDBC adapter expects resultsets and so it is not possible to call Oracle SP's from Sender JDBC adapters.
    But, I have also come across a few recent threads where there have been discussions that this is possible  from SP 16 onwards. I have not been able to check and confirm on this, but, maybe you can check your SP level and see if you are below SP 16 . If yes, definetly not possible. If SP 16, or above, a Quick OSS to SAP should surely give the answer if it is possible or not!
    Do let us know your findings.
    Regards
    Bhavesh

  • Executing a stored procedure containing multiple Select statements

    Post Author: Beverly
    CA Forum: General
    I am using Crystal  10.0 against a MS SQL 2000 server.
    I am trying to create a report based on a stored procedure that contains multiple select statements.  The sp requires a single parameter (Claim number) and contains 17 Select statements that produce results.
    I am able to use the Add command and execute the sp with the parameter, but I am only getting the results of the first select statement in the sp back in my data set.  Is there a way to have the data from each Select statement returned to my report?
    I have used Crystal for a while, but pretty much for straight-forward reporting.  I am familiar with the basics of SQL.
    I would appreciate any help anyone can offer.
    Thanks.

    Post Author: BISoftware
    CA Forum: General
    I believe Crystal Reports can only handle one recordset at a time, which means it can only handle a single select statement.  The only way I can see around this would be to break up your stored procedure into multiple stored procedures, so that each only contains a single select statement.  Then, use subreports to report on each individual sp. Hope this helps. - Davewww.BusinessSoftwareResource.com

  • Sender JDBC support the stored procedure in SQL Server 2005

    Dear All,
    My question here is , Sender is JDBC adpter support to call the Stored procedure in Microsoft SQL Server 2005?
    I followed the below thread before posting this question
    Sender JDBC Adapter Supports Stored Procedures????
    In the thread Suraj response has mentioned SAP note: 941317, I checked the note, Note says it supported only ORACLE DBMS versions.
    Could you please clarify about this to possibility to call the stored procedure in Microsoft SQL server 2005?
    Thank you in Advance
    Sateesh

    Hi Sateesh,
    To answer your query, Yes it does. SP call works with SQL Server 2005 as well, the SP call should be "execute SPNAME <paramas>". In the place of update statement put any junk value as mentioned in the earlier comment.
    But just one thing to be noted, the select or any other query returning the desired resultset must be the first statement in youre SP returning value to the calling app. Means if there are any update, deletion or intermediate select queries to be used with in your SP, those all should be placed after the Main Select query that returns the desired resultset. Variable declarions and assignments are allowed.
    But if the seq of statements in your SP are like:
    @var1 Varchar
    Update <tablename>....
    Select * from <tablename>
    Then the output of the SP is :
    1 row updated
    <the resultset from select>
    In such cases, PI can recognise the first value returned only, that is "1 row updated" and hence the returned resultset wouldn't be seen by PI or not be passed to integration engine. Hence the update should come after the main Select.
    One more interesting piece of information, even if you copy and paste the entire SP code in place of the query string of Sender JDBC adapter, that too will work with all your variable declarations, multiple queries and updates and everything. Just have to follow the above rule.
    Let us know what you find.
    Regards,
    Suddhasatta

  • How to return the result set of multiple select statements as one result set?

    Hi All,
    I have multiple select statements in my stored procedure that I want to return as one result set 
    for instance 
    select id from tableA
    union 
    select name from table b 
    but union will not work because the result sets datatypes are not identical so how to go about this ?
    Thanks

    You have to CAST or CONVERT (or implicitly convert) the columns to the same datatype.  You must find a datatype that both columns can be converted to without error.  In your example I'm guessing id is an int and name is a varchar or nvarchar. 
    Since you didn't convert the datatypes, SQL will use its data precedence rules and attempt to convert name to an int.  If any row contains a row that has a value in name that cannot be converted to an int, you will get an error.  The solution is
    to force SQL to convert the int to varchar.  So you want something like
    select cast(id as varchar(12)) from tableA
    union
    select name from tableb
    If the datatypes are something other that int or varchar, you must find a compatable datatype and then convert one (or both) of the columns to that datatype.
    Tom

  • How to call MSSQL stored procedure from oracle database

    MSSQL and Oracle databases are linked thru ODBC link using Oracle HSODBC.
    I can query MSSQL table or view from Oracle Database using standard notation for acessing remote objects schema.object@dblink_name...
    Can anybody give me syntax for calling MSSQL stored procedure thru ODBC database link?
    I tried syntax exec schema.stored_procedure@dblink_name but it doesn't work...i'm getting schema.stored_procedure must be declared error...
    Tnx,in advance!
    Dejan Botica

    Oracle database 10gR2.
    MSSQL2000 database.
    For example query:
    select * from dbo.Tbl_Test@kron@dw_jamnica; works fine...
    ...while for example exec dbo.Test@kron@dw_jamnica;
    reports error:
    ORA-06550: line 1, column 7:
    PLS-00201: identifier 'DBO.TEST@KRON@DW_JAMNICA' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Table Tbl_Test and procedure Test exists in MSSQL instance.
    Regards,
    Dejan

  • Performance of Stored procedures against Prepared Statements

    What will be the exact difference in the performance between implementing stored procedures and prepared statements ?

    Short answer: it depends.
    There will probobaly be very little difference in performance difference for a sipmle insert / update etc.
    Multiple inserts / updates etc you will probobaly find faster with a stored procedure rather than n prepared statments as you only have to contact the database once vs n times.
    Hope this helps!

  • MSSQL Stored procedure : only one command executed

    For a MSSQL Stored Procedure, We have used this
    Solution1:
    Just put SET NOCOUNT OFF in the end of the stored procedure. After that run the stored procedure in the Desktop Intelligence report.
    Or
    If the above doesnu2019t works then please try the following solution.
    Solution2:
    You have to add the given parameter in .sbo file -> save the file and run the stored Procedure.
    This file should be located under <drive>\Business Objects\BusinessObjects Enterprise 11.5\dataAccess\RDBMS\connectionServer\odbc\odbc.sbo
    <Defaults>
    <Parameter Name="Force SQLExecute">Always</Parameter>
    but it still does not work
    What others?

    Hello
    thank you for your answer but indicated procedure to test does not work too
    the message is the same : u201CNo column and no data to fetchu201D
    I return with more details :
    to create a new report DesKi, I use this stored procedure
    CREATE PROCEDURE dbo.test1 @matricule integer
    AS
    BEGIN
    SET NOCOUNT OFF
    delete from Temp_matr_boucle
    execute absences_matricules_per_matr @matricule /* it is ok */
    select MATRICULE ,NOM ,PRENOM ,CDDEP, NBR_PERIODE, NBR_JOURS , UNITE ,
           DATE_MIN,  DATE_MAX ,TYPE_ABSENCE, MATRICULE_CAR, NBR_JOURS_SERVICES
    from Temp_matr_boucle as result  /* not execute */
    return
    END
    Launched directly from the database it work verry well.
    Launched in Deski rapport, we get the same message
    u201CNo column and no data to fatchu201D
    The exec command works because the table "Temp_matr_boucle" is filled but is no longer running the select commande.
    You have advisor to use one a two solutions (see replay from DWinkel)
    1) SET NOCOUNT OFF
    or
    2) add the parameter:
    <Defaults>
    <Parameter Name="Force SQLExecute">Always</Parameter> in odbc.sbo file
    Note that we use the OLEDB driver and not the odbc
    We all tried both but the result is the same
    thank you for your help
    regards
    Mariana

  • How to convert MSSQL stored procedure to PostgreSQL

    Hi,
    Anyone can help me...?
    How to convert MSSQL stored procedure to PostgreSQL function?
    Is there any tool available to convert T-SQL from MSSQL to PostgreSQL?
    Thanks in advance

    Hello
    Here, I write one sample stored procedure of SQL Server which I need to convert into PostgreSQL. Please help me in this with PostgreSQL.
    Thanks in advance.
    Below is sample SQL Server stored procedure: require to convert into PostgreSQL stored procedure
    CREATE PROCEDURE [dbo].[usp_GetData_ByTableName]
    @TableName NVARCHAR(MAX)
    ,@IncludeKeepAlive BIT
    ,@RowsAffected BIGINT=0 OUTPUT
    ) AS
    BEGIN
    SET NOCOUNT ON
    DECLARE @SQL VARCHAR(MAX)
    Select data base on parameter.
    SET @SQL =
    SELECT *FROM '+@TableName+'
    WHERE 1=1
    +
    CASE WHEN (@IncludeKeepAlive = 0)
    THEN
    AND [MessageTransactionID] <> 152
    ELSE
    END
    EXECUTE SP_EXECUTESQL @SQL
    RETURN 0

  • MSSQL stored procedures to Oracle migration

    I am working on a migration from MSSQL2K to Oracle 10g. I have used the Oracle Migration Workbench to do the initial conversion, and I am having to do a ton of by hand conversion. There are some stored procedures that the OMWB did not bring over at all, however.
    Does anybody know of a utility that can take a single MSSQL stored procedure and convert it to a Oracle PL/SQL procedure or function? I am somewhat tired of doing entire procedures by hand. It is very tedious.
    wally

    Wally, there is a process to this kind of migration. In a lot of instances the OMWB will not map some of your stored procedures and hence, at the end of the migration you will see them as missing. Go back to the Source model view and using the log window, filter so you just see the errrors. Comment out the offending statements and right click on the object to parse it again. If it is correct it will appear in the Oracle Model. Once it has appeared there it will be generated into your Oracle database. However, you may still need to verifiy that you have got equivilence by testing the procedure.

  • Can we call a procedure in select statement?

    Can we call a procedure in select statement?

    Hi,
    Raghu_appsdba wrote:
    Can we call a procedure in select statement?No. You can call functions, but not procedures.
    If the procedure does not change the database state (for example, it doesn't update any tables), then you can wrap it in a function, or re-write it as a function.
    Here's an example of wrapping.
    CREATE OR REPLACE FUNCTION fun_x (in_txt IN VARCHAR2)
    RETURN  VARCHAR2
    IS
    BEGIN
            proc_y (in_txt);
            RETURN  in_txt
    END     fun_x;

  • Error by using database procedure in select statement

    hi ,
    I have built a database procedure having one parameter with in out varchar type. that return value with some addition.
    i am using it with some column in select statement only for display purpuses but i am facing error by doing that in select statement. that procedure is working well with bind variable but not with select statement.
    plz help me how i can use a procedure in select statement. or can i do it or not.

    plz help me how i can use a procedure in select statement. or can i do it or not.A workaround could be to create a wrapper function for your procedure. One that only passes the input parameters and returns the output parameter.
    The simply call this function in your select which internally calls the procedure.

  • Why I Can't use procedure in select statement

    Why I Can't use procedure in select statement

    We can use function in select statement but we couldn't use procedure with one out parameters in select statement... You can use Function because they are designed for this but procedure are not. Functions can return value (without OUT parameter) which can be used in SELECT whereas procedures do not have such concept. As you can see in the above post you can not call even functions also if it has any out parameter.
    I have just trying to use procedure in select statement ..for this I require technical answer..The technical answer is because conceptually procedure is for doing set of operation, performning DMLs on the tables , whereas functions are for processing and producing a single result. Functions are basically for not using INSERT/UPDATE/DELETE in it. That is the reason they are allowed to be used in SELECT because conceptually they are not supposed to do any data changes.
    Regards,
    Avinash

  • ALDSP 3.0 -- schema owner for stored procedure or SQL Statement

    Using ALDSP, I have a need to create a physical service based on a stored procedure or a SQL statement. I am wondering what will happen when I move to another deployment environment where the schema owner changes. In our QA and Prod environments, we have a different schema owner for all tables in the application (the DBAs believe this prevents unwanted updates to a prod environment). DSP elegantly supports this for normal table- and view-based physical services by mapping schemas through the DSP console after deployment. Will I get the same type of mapping capability for stored procedures and SQL statements? I noticed that I can add a SQL-based function to a physical service...is there a way to pass in the physical table name from that data service to the procedure or SQL statement?
    Thanks,
    Jeff

    Schema name substitution should work for stored procedures just like it does for tables. If it doesn't - report a bug.
    You don't get any help for sql-statement based data services - dsp doesn't parse the sql provided. One thing you could do is use the default schema (following the user of your connection pool), and not specify the schema in your sql-statement.

Maybe you are looking for