Stored Procedure Universe Issues

Working in version 3.1 SP1 Fix pack 1.8 and created some simple stored procedures to use in the universe and everything worked fine but then due to changing requirements added additional logic to the stored procedures (SQL 2005 database) for the report to include additional prompts and mulitple selects within the code.  With these changes, have encountered multiple errors when trying to insert them in the universe or when we are able to insert them in to the universe then no data ever returns from the new stored procedures even though correct execute statements are being created on the SQL Server and they work on SQL Server and in other BI tools.  Has anyone else encountered this or know of any limitations using stored procedures in universes?

Holy thread-resurrection Batman!
Please open a new dicussion after reading the bi4.0 data access guide: http://help.sap.com/businessobject/product_guides/boexir4/en/xi4sp5_data_acs_en.pdf
Also, please specify which SP and Patch you are using.
Regards,
H

Similar Messages

  • Using Stored Procedure Universe in Reports

    Hi Friends,
    I got some issues using SP's in Universe and WebI Report.
    Case #1:
    Can we execute dynamic SQL using stored procedure universe..?
    I use SQL server as the DB for my reports.I created a SP which will execute on getting a input value from the user.This input value will frame the SQL dynamically in the SP.for executing the dynamic SQL i use sp_executesql inside the SP.The SP wexecutes successfuly in the DB but when i try executing it in the Universe i get a error message as follows: "Exception : DBD,[Microsoft][SQL SErver Native Client 10.0][SQL Server]Incorrect syntax  nesr 'FROM'.State:42000"
    The script i used for creating SP for your reference:
    CREATE PROCEDURE P_S_GetCodeValueList
              @s_table nvarchar(75)
    as
    begin
              declare @s_sqlCommand nvarchar(1000)
              declare @s_tablename nvarchar(75)
              declare @s_code nvarchar(75)
              set @s_tablename=@s_table
              set @s_code = '*'
              set @s_sqlCommand= 'SELECT ' + @s_code + ' FROM ' + @s_tablename
              exec sp_executesql @s_sqlCommand
    end
    Case #2:
    AIl also tried creating reports using the SP Universe which needs to get the parameter when the user refesh the report.
    But every time the report is refreshed the report fetches the data which was produced when the SP is executed in the Universe for the first time.
    I need to get the prompt in the report , to which the user could give a value and the SP gets executed for that value.
    Is there any option in BO to do this?
    It will be very helpful if you could give me some work arounds on this.
    Regards,
    Sugumar

    Hi Sugumar,
    I can answer you for your 2nd question:
    When you create the Stored procedure in the Universe and test it on retreiving data by inserting variable input you can check if the user could insert new value for the SP parameters.
    Hope this helps!
    Regards
    Giuseppe

  • How to use optional prompts with stored procedure universe?

    Hi Experts,
    Iu2019m working on stored procedure universe in BO XI 3.0 SP2 FP2.5 with oracle at back end. My requirement is that I have to pass 5 optional prompts in the report and we have to pass these prompts through open document link. Please tell if this can be worked out on stored procedure universe?
    Thanks in advance.

    Hi,
    Try with OpenDoc syntax as follows.
    http://<servername>:<port>/OpenDocument/opendoc/<plat
    formSpecific>?iDocID=****&sIDType=CUID&sType=wid/rpt&lsM/lsS/lsRPROMPTNAME=[V1],[V2]&sDocName=reportname&sRefresh=Y/N
    where
    server name: cms server name
    port: portno
    <platformspecific>=: for java -> openDocument.jsp
                                      for .net -> opendocument.aspx
    idocid,sDocName & cuid -> we can get report properties ( goto info view -> select report -> right click -> properties i.e. doc id, cuid and report name)
    sType -> type of report i.e webi or deski ...
    lsS -> to pass single prompt value
    lsM -> to pass multiplle values to prompt
    lsR -> range of values ....
    Note: Here prompt name should be same as the one which we used in the report. Use + if there is blank space.
    Cheers,
    Suresh Aluri.

  • Stored Procedure Universe with Webi and Xcelcius

    Business Objects XI 3.0, Xcelcius 2008
    Created a stored procedure Universe on top of SQL Server 2005.  The stored procedure inserts a row into a table, and works fine when calling it from SQL Server server.  When I call it from Webi it wraps a transaction around the call and rolls it back after executing it.
    Are the new Stored Procedure Universes in 3.0 meant to be only "read only" and don't allow inserts/updates/deletes commands in the stored procedures they execute ? Seems a little short sighted if they are.
    Thanks,
    Keith
    Edited by: Keith Johnson on Aug 16, 2008 11:30 PM

    Keith,,
    absolutely with universe designer you can never use such like those procedures, you can not use insert or update statements on those procedure, it will give you errors.
    but in xcelsius, you can do it with another layer
    check this please
    xml data button
    http://resources.businessobjects.com/support/cx/samples/learning/downloads/ttv4-xml_data_button.pdf
    XCELSIUS DYNAMIC DATA SOURCE
    Dynamic datasources for Xcelsius
    good luck

  • Postgresql/EDB Stored Procedure Universe Connection

    I'm trying to define a new connection for a Stored Procedure Universe against our EnterpriseDB Postgresql database, but EnterpriseDB doesn't show up as one of the Middleware options for defining the new Connection.  Anyone know how to enable EnterpriseDB/Postgres to allow Stored Procedure Universe Connections?

    May be you can try creating a ODBC connection and then use the ODBC connection.

  • Unable to create object from stored procedure universe

    Dear All Experts,
    I am facing a problem on unable to create object dimensions on a Stored procedure universe. Fyi, I have successfully insert a stored procedure ('SP_Sales') with input parameter (@date) into universe (Universe_1). But I unable create any object based on the the stored procedured ('SP_Sales') due to it show nothing from the Edit Select Statement of 'Object1', empty for Tables nd columns windows.
    Thefore, i unable to drag data in WEBI when i select univese as "Universe_1", it will not sure any object. Please advise.
    I am using XI4.0, MSSQL2008.

    Hi ,
    You wont be able to edit the object definitions.
    u2022 Designer generates one table per selected stored procedure (or many
    tables if multiple result sets) and one object per column returned by a
    stored procedure.
    u2022 The result set structure is determined when you describe the function.
    Please refer chapter 7(Page 451) of below document for more details.
    [Universe Designer Guide|http://help.sap.com/businessobject/product_guides/boexir31/en/xi3-1_designer_en.pdf]
    Hope this helps.
    Bilahari M

  • Stored Procedure Command issues in CS3

    I've been having a problem using some stored procedures in
    CS3 which had previously worked with no issue in 8.0.2. I'm running
    CS3 on a Mac for ASP & SQL Server 2000.
    The input parameters for the stored procedure are...
    Fieldname: CategoryID (int) length: 4
    Fieldname: Men (bit) length: 1
    Fieldname: Women(bit) length:1
    I have no problem using the Command function to call this
    stored procedure in DW 8.0.2, but in CS3, while I am able to TEST
    the recordset successfully within the Command dialog, when I press
    OK and then attempt to view the field list in the Bindings panel, I
    get this error...
    [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure
    'spCategoryProduct' expects parameter '@Men', which was not
    supplied.
    When I open up the command settings dialog again, Default
    Values and the Runtime Values I entered for the Men and Women bit
    parameter are blank. The only Default Value and Runtime Value
    retained is for the field CategoryID.
    CS3 is able to call other stored procedures which do not
    contain a Bit field type without issue, so I'm curious if this is
    the culprit.
    I have DW8.0.2 still installed on the same system, and have
    been able to call this stored procedure in this older version,
    without any problems.
    Please help!

    Holy thread-resurrection Batman!
    Please open a new dicussion after reading the bi4.0 data access guide: http://help.sap.com/businessobject/product_guides/boexir4/en/xi4sp5_data_acs_en.pdf
    Also, please specify which SP and Patch you are using.
    Regards,
    H

  • Stored Procedure/Variable issue

    Hopefully this is the last issue to work through... but we need to access images stored on another server. We have a stored procedure called 'get_doc' that accesses the image file, and we've successfully tested it with a hardcoded value. A button calls a process that executes the following PL/SQL:
    get_doc (
    p=> 77456);
    However, when I use the same process with a variable on the page (which has the same numeric value of 77456), the procedure says the value of p is Null.
    get_doc (
    p=> :P7_STARTERNUM);
    Any suggestions or advice?
    (Using ApEx 4.0 in IE8)

    CPate  wrote:
    Yes, the connection is correct. And I swapped in the hardcode number, the process does what it is supposed to and returns the image. Swap back in the variable (with to_number as well, just to be sure) and it returns null.
    I tried debugging it and didn't see where P7_STARTERNUM was changed. It just says:
    ..Process "STARTERGET": PLSQL (AFTER_SUBMIT) get_doc (p=&gt; to_number(:P7_STARTERNUM));The trace should look something like:
    0.00275     0.00220     A C C E P T: Request="SAVE"
    0.00484     0.00801     Metadata: Fetch application definition and shortcuts
    0.01291     0.00110     alter session set nls_language="ENGLISH"
    0.01399     0.00069     alter session set nls_territory="UNITED KINGDOM"
    0.01476     0.00084     NLS: CSV charset=WE8MSWIN1252
    0.06085     0.00087     Session State: Save form items and p_arg_values
    0.06173     0.00146     ...Session State: Save "P7_CUSTOMER_ID" - saving same value: "7"
    0.06319     0.00264     ...Session State: Save Item "P7_CUST_FIRST_NAME" newValue="Eugene" "escape_on_input="N"     
    0.33200     0.00090     Processing point: After Submit
    0.33285     0.11813     ...Process "Process Row of DEMO_CUSTOMERS": DML_PROCESS_ROW (AFTER_SUBMIT) #OWNER#:DEMO_CUSTOMERS:P7_CUSTOMER_ID:CUSTOMER_ID|IUD
    {code}
    There should be a session state change like those shown recorded for your <tt>P7_STARTERNUM</tt> item.
    What's the *Display As* type of the <tt>P7_STARTERNUM</tt> item?
    the procedure says the value of p is Null.
    How do you know this?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Stored Procedure creation issue

    Hi All,
    I need a stored procedure's for below Scenario:
    tblProduct is a parameter table that has values list of Products and every product has code (Eg, PEN A, BOOK B , PENCIL C and so on)
    For every value a procedure sp_findIndex will be called 
    sp_findIndex finds the index of the alphabet based on the tblKeyValue a key value table which has two columns key and value, key 1,2,3....
    and values A,B,C..
    Further sp_findIndex calls sp_evenOdd with
    the index as input and provides an output whether index is an even or an odd number 
    which is printed through sp_findIndex procedure 
    Task 1
    List down even and odd for all the products.
    Task 2
    Now warp this logic to stored procedure sp_wrapper which takes input Product names separated by comma.
    Thanks in Advance.........
    Tbl_Product
    Create table Tbl_Product
    Product varchar(50) NULL,
    Code Varchar (50) NULL
    Insert into Tbl_Product values('PEN','A')
    Insert into Tbl_Product values('BOOK','B')
    Insert into Tbl_Product values('PENCIL','C')
    Insert into Tbl_Product values('TV','D')
    Insert into Tbl_Product values('COMPUTER','E')
    Insert into Tbl_Product values('SHOES','F')
    Insert into Tbl_Product values('SHIRT','G')
    Tab_KeyValue
    Create table tbl_KeyValue
    value char(3) NULL,
    keys int NULL
    Insert into tbl_Keyvalue values('A',1)
    Insert into tbl_Keyvalue values('B',2)
    Insert into tbl_Keyvalue values('C',3)
    Insert into tbl_Keyvalue values('D',4)
    Insert into tbl_Keyvalue values('E',5)
    Insert into tbl_Keyvalue values('F',6)
    Insert into tbl_Keyvalue values('G',7)
    Main
    Procedure:
    CREATE PROCEDURE DBO.SP_WRAPPD
    (PRODUCT1 VARCHAR(1000))
    AS
    BEGIN
    DECLARE @COMMA VARCHAR(2)
    SET @COMMA =','
    SELECT CODE FROM TBL_PRODUCT WHERE CHARINDEX(PRODUCT,@PRODUCT) >0
    END
    Second
    procedure:
    Create Procure sp_findIndexes(@value varchar(10))
    as
    begin
    Declare @keys int
    set @Keys =(select A.keys from tbl_keyvalue A where A.value=@value)
    Declare @Evenodd varchar(10)
    Declare @result int
    Exec @result =sp_EvenOdds @keys
    if @result=1
    set @EvenOdd ='Even'
    else
    set @EvenOdd='Odd'
    insert into ##EvenOddResultss select A.keys,B.Product,@evenodd as evenodd from tbl_product B
    inner join
    tbl_KeyValue A
    on A.Value=B.code and A.keys=@keys
    end
    Third
    Procedure:
    Create procedure sp_EvenOdds (@Key int)
    as
    begin
    if(@key%2=0)
    return(1)
    else
    return(0)
    end
    I am calling third procure from second,second from Main Procedure...
    Thanks in Advance...

    Hi,
    1. Again this is a image and not a code!
    Do you want to waste our time on typing while we can help other people?!?
    Isn't it more helpful to use copy/paste and to bring us a code and not stories/images? 
    2. How can we recreate the issue and execute or even just create this SP without having the relevant elements (like the tables) ?!?
    Please post DDL+DML!
    DDL = Data Definition Language. In our case that is, CREATE TABLE statements for your tables and other definitions that are needed to understand your tables structure and there for let us to test and recreate the problem in our server. Without DDL no one
    can execute any query.
    How to get DDL: Right click on the table in Object Explorer and select script table as CREATE. Post these create table scripts here.
    DML = data manipulation language is a family of queries used for manipulating the data it self like: inserting, deleting and updating data. In our case we need some sample data in order to check the query and get result, so we need some indert query for
    sample data.
    If you post a "create query" for the tables and "insert query" with some sample, then we could help you without Assuming/Guessing. There is a reason that DDL is generally asked for and expected when discussing query problems - it helps
    to identify issues, clarify terminology and prevent incorrect assumptions.  Sample data also provides a common point of reference for the discussion. A script that can be used to illustrate or reproduce the issue you have, will encourage others to help.
    [Personal Site] [Blog] [Facebook]
    Hi Pituach,
    Tbl_Product
    Create table Tbl_Product
    Product varchar(50) NULL,
    Code Varchar (50) NULL
    Insert into Tbl_Product values('PEN','A')
    Insert into Tbl_Product values('BOOK','B')
    Insert into Tbl_Product values('PENCIL','C')
    Insert into Tbl_Product values('TV','D')
    Insert into Tbl_Product values('COMPUTER','E')
    Insert into Tbl_Product values('SHOES','F')
    Insert into Tbl_Product values('SHIRT','G')
    Tab_KeyValue
    Create table tbl_KeyValue
    value char(3) NULL,
    keys int NULL
    Insert into tbl_Keyvalue values('A',1)
    Insert into tbl_Keyvalue values('B',2)
    Insert into tbl_Keyvalue values('C',3)
    Insert into tbl_Keyvalue values('D',4)
    Insert into tbl_Keyvalue values('E',5)
    Insert into tbl_Keyvalue values('F',6)
    Insert into tbl_Keyvalue values('G',7)
    Main Procedure:
    CREATE PROCEDURE DBO.SP_WRAPPD
    (PRODUCT1 VARCHAR(1000))
    AS
    BEGIN
    DECLARE @COMMA VARCHAR(2)
    SET @COMMA =','
    SELECT CODE FROM TBL_PRODUCT WHERE CHARINDEX(PRODUCT,@PRODUCT) >0
    END
    Second procedure:
    Create Procure sp_findIndexes(@value varchar(10))
    as
    begin
    Declare @keys int
    set @Keys =(select A.keys from tbl_keyvalue A where A.value=@value)
    Declare @Evenodd varchar(10)
    Declare @result int
    Exec @result =sp_EvenOdds @keys
    if @result=1
    set @EvenOdd ='Even'
    else
    set @EvenOdd='Odd'
    insert into ##EvenOddResultss select A.keys,B.Product,@evenodd as evenodd from tbl_product B
    inner join
    tbl_KeyValue A
    on A.Value=B.code and A.keys=@keys
    end
    Third Procedure:
    Create procedure sp_EvenOdds (@Key int)
    as
    begin
    if(@key%2=0)
    return(1)
    else
    return(0)
    end
    I am calling third procure from second,second from Main Procedure

  • Can someone help me diagnose a strange stored procedure performance issue please?

    I have a stored procedure (posted below) that returns message recommendations based upon the Yammer Networks you have selected. If I choose one network this query takes less than one second. If I choose another this query takes 9 - 12 seconds.
    /****** Object: StoredProcedure [dbo].[MessageView_GetOutOfContextRecommendations_LargeSet] Script Date: 2/18/2015 3:10:35 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE [dbo].[MessageView_GetOutOfContextRecommendations_LargeSet]
    -- Parameters
    @UserID int,
    @SourceMessageID int = 0
    AS
    BEGIN
    -- variable for @HomeNeworkUserID
    Declare @HomeNeworkUserID int
    -- Set the HomeNetworkID
    Set @HomeNeworkUserID = (Select HomeNetworkUserID From NetworkUser Where UserID = @UserID)
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON
    -- Begin Select Statement
    Select Top 40 [CreatedDate],[FileDownloadUrl],[HasLinkOrAttachment],[ImagePreviewUrl],[LikesCount],[LinkFileName],[LinkType],[MessageID],[MessageSource],[MessageText],[MessageWebUrl],[NetworkID],[NetworkName],[PosterEmailAddress],[PosterFirstName],[PosterImageUrl],[PosterName],[PosterUserName],[PosterWebUrl],[RepliesCount],[Score],[SmallIconUrl],[Subjects],[SubjectsCount],[UserID]
    -- From View
    From [MessageView]
    -- Do Not Return Any Messages That Have Been Recommended To This User Already
    Where [MessageID] Not In (Select MessageID From MessageRecommendationHistory Where UserID = @UserID)
    -- Do Not Return Any Messages Created By This User
    And [UserID] != @UserID
    -- Do Not Return The MessageID
    And [MessageID] != @SourceMessageID
    -- Only return messages for the Networks the user has selected
    And [NetworkID] In (Select NetworkID From NetworkUser Where [HomeNetworkUserID] = @HomeNeworkUserID And [AllowRecommendations] = 1)
    -- Order By [MessageScore] and [MessageCreatedDate] in reverse order
    Order By [Score] desc, [CreatedDate] desc
    ENDThe Actual Execution Plan Shows up the same; there are more messages on the Network that is slow, 2800 versus 1,500 but the difference is ten times longer on the slow network.Is the fact I am doing a Top 40 what makes it slow? My first guess was to take the Order By Off and that didn't seem to make any difference.The execution plan is below, it takes 62% of the query to look up theIX_Message.Score which is the clustered index, so I thought this would be fast. Also the Clustered Index Seek for the User.UserID take 26%which seems high for what it is doing.
    I have indexes on every field that is queried on so I am kind of at a loss as to where to go next.
    It just seems strange because it is the same view being queried in both cases.
    I tried to run the SQL Server Tuning Wizard but it doesn't run on Azure SQL, and my problem doesn't occur on the data in my local database.
    Thanks for any guidance, I know a lot of the slowness is due to the lower tier Azure SQL we are using, many of the performance issues weren't noticed when were on the full SQL Server, but the other networks work extremely fast so it has to be something to
    with having more rows.
    In case you need the SQL for the View that I am querying it is:
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE VIEW [dbo].[MessageView]
    AS
    SELECT M.UserID, M.MessageID, M.NetworkID, N.Name AS NetworkName, M.Subjects, M.SubjectsCount, M.RepliesCount, M.LikesCount, M.CreatedDate, M.MessageText, M.HasLinkOrAttachment, M.Score, M.WebUrl AS MessageWebUrl, U.UserName AS PosterUserName,
    U.Name AS PosterName, U.FirstName AS PosterFirstName, U.ImageUrl AS PosterImageUrl, U.EmailAddress AS PosterEmailAddress, U.WebUrl AS PosterWebUrl, M.MessageSource, M.ImagePreviewUrl, M.LinkFileName, M.FileDownloadUrl, M.LinkType, M.SmallIconUrl
    FROM dbo.Message AS M INNER JOIN
    dbo.Network AS N ON M.NetworkID = N.NetworkID INNER JOIN
    dbo.[User] AS U ON M.UserID = U.UserID
    GO
    The Network Table has an Index on Network ID, but it non clustered but I don't think that is the culprit.
    Corby

    I marked your response as answer because you gave me information I didn't have about the sort. I ended up rewriting the query to be a join instead of the In's and it improved dramatically, about one second on a very minimal Azure SQL database, and before
    it was 12 seconds on one network. We didn't notice the problem at all before we moved to Azure SQL, it was about one - three seconds at most.
    Here is the updated way that was much more efficient:
    CREATE PROCEDURE [dbo].[Procedure Name]
    -- Parameters
    @UserID int,
    @SourceMessageID int = 0
    AS
    BEGIN
    -- variable for @HomeNeworkUserID
    Declare @HomeNeworkUserID int
    -- Set the HomeNetworkID
    Set @HomeNeworkUserID = (Select HomeNetworkUserID From NetworkUser Where UserID = @UserID)
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON
    ;With cteMessages As
    -- Begin Select Statement
    Select (Fields List)
    -- Join to Network Table
    From MessageView mv Inner Join NetworkUser nu on MV.NetworkID = nu.NetworKID -- Only Return Networks This User Has Selected
    Where nu.HomeNetworkUserID = @HomeNeworkUserID And AllowRecommendations = 1
    -- Do Not Return Any Messages Created By This User
    And mv.[UserID] != @UserID
    -- Do Not Return The MessageID
    And mv.[MessageID] != @SourceMessageID
    ), cteHistoryForThisUser As
    Select MessageID From MessageRecommendationHistory Where UserID = @UserID
    -- Begin Select Statement
    Select Top 40 (Fields List)
    -- Join to Network Table
    From cteMessages m Left Outer Join cteHistoryForThisUser h on m.MessageID = h.MessageID
    -- Do Not Return Any Items Where User Has Already been shown this Message
    Where h.MessageID Is Null
    -- An Order By Is Needed To Get The Best Content First
    Order By Score Desc
    END
    GO
    The Left Outer Join to test for null was the biggest improvement, but it also helped to join to the NetworkUser table instead of do the In sub query.

  • Stored procedure Performance issue in SQLserver 2005

    Hi All,
    i am inserting the data to Database by using of Stored procedure in target DB.
    My source structure and target structures are looking below
    I have the source structure having lot of rows and look like my structure is below:
    <?xml version="1.0" encoding="utf-8" ?>
    <ns0:POCA0013_KANLOG_REQUEST_MT_response xmlns:ns0="urn:com:POCA0013:sample">
    <SCMDB_response>
    -  <row>
          <PROJK>O-USA</PROJK>
          <KOLLO>123</KOLLO>
       </row>
    -  <row>
          <PROJK>O-Denmark</PROJK>
          <KOLLO>256</KOLLO>
       </row>
        n  number of rows
    </SCMDB_KANLOGVIEW_response>
    </ns0:POCA0013_KANLOG_REQUEST_MT_response>
    and after mapping my target structure is coming to like this.
    <?xml version="1.0" encoding="UTF-8" ?>
    <ns0:POCA0013_DB_MT xmlns:ns0="urn:pg-com POCA0013:sample">
    <StatmentName>
       <XI_SP_DATA action="EXECUTE">
         <PROJEK isInput="TRUE" type="CHAR">O-USA</PROJEK>
         <KOLLO isInput="TRUE" type="CHAR" >123</KOLLO>
       </XI_SP_DATA>
    </StatmentName>
    <StatmentName>
       <XI_SP_DATA action="EXECUTE">
         <PROJEK isInput="TRUE" type="CHAR">O-Denmark</PROJEK>
         <KOLLO isInput="TRUE" type="CHAR" />256</KOLLO>
       </XI_SP_DATA>
    </StatmentName>
      N number of times
    </ns0:POCA0013_DB_MT>
    this is working perfectly to insert the records into the database by using stored procedure. each record  it call the stored procedure for insert the records, for example we had 100 records and it call 100 times stored procedure.
    But in case of huge data, for example 10000 records, it call the 10000 times to stored procedure.in that case we had a problem for database side.
    we have  one reason to use the stored procedure here, because once insert the data into table, if successful log table is created with successful status , if not log table is created with error status. for that purpose i am using stored procedure here.
    Our customer wants to call the stored procedure for one time for all records.How i can manage this situation.
    Can you give me your valuble ideas about this problem.
    Thank you very much.,
    Sateesh
    Edited by: sateesh kumar .N on Apr 23, 2010 6:53 AM
    Edited by: sateesh kumar .N on Apr 23, 2010 6:54 AM
    Edited by: sateesh kumar .N on Apr 23, 2010 7:54 AM

    Hi Sateesh,
    how about a different approach.
    Add 2 more tables to your solution. The first table is used as a staging table, where PI inserts all the data without making any checks, whatsoever. The second table is used as a control table. If the insertion is finished, a log entry is inserted into this second table, containing the information about success or failure or how many rows had been inserted. Put an insert trigger on this table, which in term starts a stored procedure. This stored procedure can read all the data from the staging table and put it into the desired target tables. Additionally you can perform plausiblitiy checks inside this SP.
    Okay I know, this is a complete new solution in comparison to what you did before. But in my experience, this will be much more performant than 10000 calls to one stored procedure who only does inserts as you described.
    Regards
    Sven

  • Stored Procedure Output Issue in Query Template

    Hi,
    We have written a stored procedure which returns 3 outputs which are of type CLOB. Whenever we call the procedure from query template it gives an error Wrong number or type of parameters. It seems that we need to pass some variables which are of type clob to the procedure while calling which we cannot do as per my knowledge in query template.
    Even if we are able to get the output we will not be getting complete output since the out put values are of type CLOB.
    Can you guide me how to achive this
    Thanks,
    Shalaka

    Hi,
    Sometime back i faced the similar problem. But I used oracle pipelined functions to achieve this....
    The basic thing is it will break the chunk into records of length of 4000 chars and it will return in a table. And from other end you can loop and concatenate. Hope this helps....
    create or replace FUNCTION FN_GEN_XML RETURN dashb_xml pipelined IS v_xml CLOB := NULL;
    v_temp VARCHAR2(4000) := NULL;
    v_counter NUMBER := 1;
    BEGIN
      SELECT somefunction(0)
      INTO v_xml
      FROM dual;--v_xml here is clob type. here you might need to call your proc and get it into this variable.
      dbms_output.put_line ('length of v_xml is:' || length(v_xml));
      DBMS_OUTPUT.PUT_LINE('start of this function');
      LOOP
        v_temp := SUBSTR(v_xml,   v_counter,   4000);
        EXIT
      WHEN v_temp IS NULL;
      DBMS_OUTPUT.PUT_LINE(to_char(v_temp));
      pipe ROW(v_temp);
      v_counter := v_counter + 4000;
    END LOOP;
    RETURN;
    END;
    Regards,
    Ravi Kumar

  • Stored Procedure Performance Issue in Sharepoint Report

    We have a report stored procedure that runs in about 1 minute in production; however, when executed from the Sharepoint it populates, it runs for over 20 minutes, with exactly the same parameters. We've done everything to avoid parameter sniffing problems:
    used WITH RECOMPILE on the procedure declaration; added OPTION OPTIMIZE FOR UNKNOWN on the parameters within queries; even created local variables and assigned the parameter values to them and used them throughout the procedure. None of these has had any effect.
    I know that the 1-base minute run time is a big red flag, and we're working on pre-aggregating this data into our BI platform, but that's months down the liine and this is needed for month-end close every month.
    Other relevant information:
    Sharepoint 2013 on SQL Server 2012
    Data Source is a SQL Server 2008 R2 database
    Report definition created in Visual Studio 2008

    I'm trying to figure out why it's taking so long.  When I query on ExecutionLog3 I see the following (converted to seconds):
    Total Seconds
    Retrieval Seconds
    Processing Seconds
    Rendering Seconds
    ByteCount
    RowCount
    653.966
    653.933
    0.018
    0.015
    15037
    1
    Yet running in SSMS, it completes (consistently) in 62 seconds.

  • Bulk Insert Through Stored Procedure performance issue

    Hello,
    i am new to oracle. i am writing a stored procedure through which i want to insert 1 billion record in a table. but it takes days to insert it . please tell me how can i improve performance of my stored procedure. because same stored procedure when i convert it into sql server in take 24 - 30 min to insert 1 billion record.
    Code of my stored procedure are as follows :
    create or replace PROCEDURE bspGenerateHSCode(
    mLoc_id IN INT,
    HSCodeStart IN VARCHAR2,
    HSCodeEnd IN VARCHAR2,
    mRqstId IN INT,
    total_count IN INT,
    Status OUT INT)
    AS
    ExitFlag INT;
    row_count INT;
    mBatchStart NUMBER;
    mBatchEnd NUMBER;
    mStartSqnc NUMBER;
    mEndSqnc NUMBER;
    mHSCode VARCHAR2(500);
    HSStartStr VARCHAR2(500);
    BEGIN
    SELECT COUNT(*) INTO row_count FROM goap_eal_allocation
                   WHERE hs_code_start = HSCodeStart
    AND hs_code_end = HSCodeEnd
    AND loc_id = mLoc_id
    AND processed = 0;
    IF row_count > 0 THEN
    SELECT CAST ( REVERSE(substr(REVERSE(HSCodeStart), 1, instr(REVERSE(HSCodeStart), ',') -1)) AS NUMBER) INTO mStartSqnc FROM DUAL;
    SELECT CAST ( REVERSE(substr(REVERSE(HSCodeEnd), 1, instr(REVERSE(HSCodeEnd), ',') -1)) AS NUMBER) INTO mEndSqnc FROM DUAL;
    SELECT CAST( REVERSE(substr( REVERSE(HSCodeStart), instr(REVERSE(HSCodeStart), ','))) AS VARCHAR2(500) ) INTO HSStartStr FROM DUAL;
    mBatchStart := mStartSqnc;
    DBMS_OUTPUT.PUT_LINE('start batch ' || mBatchStart);
    LOOP
    mBatchEnd := mBatchStart + 5000;
    IF mBatchEnd > mEndSqnc THEN
    mBatchEnd := mEndSqnc + 1;
    END IF;
    DBMS_OUTPUT.PUT_LINE('End batch ' || mBatchEnd);
    LOOP
    mHSCode := HSStartStr || mBatchStart;
    mBatchStart := mBatchStart + 1;
    INSERT INTO goap_eal_register(id, hs_code, loc_id, status_id, synced)
    SELECT CASE WHEN MAX(id) > 0 THEN (MAX(id) + 1) ELSE 1 END AS id ,
    mHSCode, mLoc_id, 6, 1 FROM goap_eal_register;
    EXIT WHEN mBatchStart = mBatchEnd;
    END LOOP;
    COMMIT;
    EXIT WHEN mBatchStart = mEndSqnc +1;
    END LOOP;
    UPDATE goap_eal_allocation SET processed = 1
    WHERE hs_code_start = HSCodeStart
    AND hs_code_end = HSCodeEnd
    AND loc_id = mLoc_id;
    COMMIT;
    Status := 1;
    ELSE
    Status := 0;
    END IF;
    END;
    Thanks

    Please edit your post and add \ on the line before and the line after the code to preserve formattingsee how this looks?
    Also, when you basically just want to RETURN without doing any work then your first test should just RETURN if you don't want to do any work.
    Instead of what your code does:IF row_count > 0 THEN
    . . . a whole lot of code that is hard to read or understand
    COMMIT;
    Status := 1;
    ELSE
    Status := 0;
    END IF;
    Test the condition to determine when you do NOT want proceed and just return.IF row_count = 0 THEN
    Status := 0;
    RETURN;
    END IF;
    -- now NONE of the following code needs to be indented - you won't get here unless you really want to execute it.
    . . . break the code into separate steps and add a one line comment before each step that says what that step does.
    COMMIT;
    Status := 1;

  • Error while creating universe on Stored Procedure

    Hi All,
    I am trying to create an Universe on stored Procedure, Ended up with the error message as in snapshot,Your help is Appreciated.

    Hi
    You cannot directly insert object in Stored Procedure universe,Whatever object you are using to define your derived table,you have to include all those objects into the universe first.
    From the below image you can see that i have 3 derived tables ,but whatever objects i am trying to use all those i have inserted into the universe.
    Try to build like this save and export.
    Let me know if you face nay error

Maybe you are looking for