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=> 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?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • 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 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 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 name inside string [EXEC]

    Hi everyone
    I'm looking for a solution for this problem:
    I've created a stored procedure, in which i need to insert a record in a table.
    The point is i don't know the exact column to put my values and which values to save: it depends from the input data.
    I've created a function wich creates (concats) my query.
    The result is similar to:
    SET @myquery = 'INSERT INTO MyTable (columnABC, columnDEF) VALUES (@valueABC, @valueDEF)'
    This query is the value of a varchar.
    I want to execute this query, so I thought to use: EXEC(@myquery)
    The problem is that SQL can't find the variables @valueABC or @valueDEF if thery're inside a nvarchar.
    Is there some particular syntax in order to replace the value of variables?
    I hope it's clear!!
    Thank you in advance!!!!!
    Federica

    You need to create an entire SQL string without the variables.
    SET @myquery = 'INSERT INTO MyTable (columnABC, columnDEF) VALUES (''' + @valueABC + ''', ''' + @valueDEF + ''')'
    Please, please don't post such bad solutions!
    If you use dynamic SQL, you should use a parameterised statement:
    SET @myquery = 'INSERT INTO MyTable (columnABC, columnDEF) VALUES (@valueABC, @valueDEF)'
    EXEC sp_executesql @myquery, N'@valueABC int, @valueDEF int',
         @valueABC, @valueDEF
    However, I would prefer not to use dynamic SQL at all, but do:
    INSERT tbl(keycol, col1, col2, col3, ....)
       VALUES (@keyval,
               CASE @coltoinsert WHEN 'col1' THEN @val END,
               CASE @coltoinsert WHEN 'col2' THEN @val END,
    Although the entire idea of not knowing the columns before sounds spooky to me. A column in a table is supposed to model a unique attribute.
    Erland Sommarskog, SQL Server MVP, [email protected]
    sp_Executesql worked for me, than you very much!!!

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

  • 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

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

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

  • Setting a Stored Procedure Variable within a CASE Statement

    I am attempting to build a Merge/Purge Key of our Members and am trying to use this syntax...
    /* The First Part of the Merge/Purge Key is built on the first 4 consonants of [member].[NAME_LAST] */
    SELECT
    CASE
    WHEN SUBSTRING([@NameLast],@Counter,1) <> 'A'
    AND SUBSTRING([@NameLast],@Counter,1) <> 'E'
    AND SUBSTRING([@NameLast],@Counter,1) <> 'I'
    AND SUBSTRING([@NameLast],@Counter,1) <> 'O'
    AND SUBSTRING([@NameLast],@Counter,1) <> 'U'
    THEN CASE
    WHEN @Counter = 1
    THEN @MergePurgeKeyLastNamePos1 = SUBSTRING([@NameLast],@Counter,1)
    I cannot seem to set my Storage Variable @MergePurgeKeyLastNamePos1 with the non-consonant value that it finds.
    Do I need to over simplify this first by setting some CHAR(1) Storage Variable and then building the 4-character Merge/Purge Key of Last Name?
    Thanks for your review and am hopeful for a reply?

    >THEN @MergePurgeKeyLastNamePos1
    =SUBSTRING([@NameLast],@Counter,1)
    Assignment cannot be done in a case THEN. Only a scalar value can be returned.
    You can do assignment like SELECT @variable = CASE.....
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Database Design
    New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014

  • Stored Procedure row limit in MII

    Hi,
    We've a transaction that reads data from an Excel sheet and inserts those records in DB by calling a procedure. The application works fine if the rows in Excel is limited to 49. However, if the no. of rows exceed 49, then it doesn't work. On calling the procedure in MII with more than 49 rows of data, MII only returns the first 49 rows.
    We have set the row count in MII to 10000.
    Any inputs?
    Regards
    Rajeev

    Artificially increasing RowCount isn't the answer, especially if aspects in the code need to preallocate memory for resultsets, etc.  In a sense this is why all queries contain the RowCount parameter - to not have unbounded requests (if I'm not mistaken there is also a safety cap override in the code).  Once you've issued an infinite/unbound query to a database, closing the browser will not stop this from continuing to process.
    If you are using something like an SQL stored procedure, then issuing SET ROWCOUNT 0 at the beginning of the procedure will allow sub selects and joins to not fall subject to the RowCount of the query, which like was mentioned, is there more appropriately for the returned resultset.  Of course - this should be used with discretion.

  • Oracle Stored Procedure Not Accepting Comma delimited values in database

    I have a stored procedure which does the following, declares variables and assigns values retrieved from a parameter temp_table database to each variable, then it reads column headings from a master table. Using the variables assigned to each parameter from the temp_table as a filter, the rows from the MASTER TABLE are finally output by the procedure. The stored procedure works fine when dealing with single value string values passed from the parameter temp_table.
    The problem comes in when multiple values are selected and stored in the database parameter field as a comma separated string, eg. A045, A012
    So, the strored procedure has been modified to use a function to split the string into separate values: 'A045' and 'A012'. So that: A045, A012 from the database will be returned to the stored procedure variable as *('A045', 'A012')* . When testing the stored procedure using the static values *('A045', 'A012')* , data is returned.
    eg. EMPLOYEE_MASTER.CODE IN ('*A045*', '*A012*') will return results
    However, when *('A045', 'A012')* is dynamically concatenated from the function and assigned to variable:
    paramCode := split_str(paramCode) with paramCode eventually being passed: *('A045', 'A012')*
    to become:
    EMPLOYEE_MASTER.CODE IN (paramCode)
    then NO DATA is returned.
    I am stuck and don't know what the problem is. If anyone has any ideas, please feel free to help. I have included the Actual Stored Procedure below for a better understanding.
    --------------------------------------------- STORED PROCEDURE-------------------------------------------------------
    create or replace
    PROCEDURE GETEMPLOYEEDATA
    ( sesId IN VARCHAR2,
    l_cursor in out sys_refcursor
    ) is
    compCode varchar(200);
    businessUnit varchar(200);
    locCode varchar(200);
    hrDeptID varchar(200);
    glDept varchar(200);     plat varchar(200);
    deptFunc varchar(200);     empType varchar(200);
    unionCode varchar(200);     jobCode varchar(200);     
    careerLvl varchar(200);     
    empStatus varchar(200);
    zid varchar(200);
    superID varchar(200);
    counter varchar(200) ;
    token_index number;
    --v_errm VARCHAR2(256);
    BEGIN
    dbms_output.put_line('Start of BEGIN');
    /* Counter to get number of Unique Employee ID based on valid Session ID */
    select count(*) into counter from XXCCHRWEB.hr_web_sessionid_tmp where parameter_20=sesId;
    open l_cursor for SELECT counter EMPLOYEE_ID, '' LAST_NAME,
    '' FIRST_NAME from dual;
    dbms_output.put_line('OPENING FIRST CURSOR');
    /* If no valid session ID returned then error gently */
    if counter=0 then
    open l_cursor for SELECT '' EMPLOYEE_ID, '' LAST_NAME,
    '' FIRST_NAME,'' MIDDLE_NAME,'' NAME,
    '' EMPLOYEE_TYPE, '' COMPANY, '' COMPANY_DESCRIPTION,
    '' BUSINESS_UNIT, '' BUSINESS_UNIT_DESCRIPTION, '' LOCATION,
    '' LOCATION_NAME, '' HR_DEPARTMENT_ID,'' DEPARTMENT_NAME,
    '' DEPARTMENT_FUNCTION, '' PLATFORM, '' JOB_CODE,
    '' JOB_TITLE, '' BUSINESS_TITLE, '' MANAGER_LEVEL,
    '' JOB_FUNCTION, '' GL_DEPARTMENT_ID, '' GL_OP_UNIT,
    '' GL_RESPONSIBILITY_CENTER, '' HR_CHANNEL,'' FULL_OR_PART_TIME,
    '' REGULAR_OR_TEMP, '' GRADE,'' UNION_CODE,
    '' BARGAINING_UNIT, '' ANNUAL_RATE,'' HOURLY_RATE,
    '' HIRE_DATE, '' BIRTH_DATE, '' REHIRE_DATE,
    '' SERVICE_DATE, '' POSITION_NUMBER, '' REPORTS_TO,
    '' REPORTS_TO_TITLE, '' SUPERVISOR_ID, '' SUPERVISOR_NAME,
    '' LAN_ID from dual;
    dbms_output.put_line('End of counter=0');
    -- return;
    end if;
    /* read from hr_web_sessionid_tmp */
    select
    parameter_1,parameter_2, parameter_3, parameter_4,
    parameter_5,parameter_6, parameter_7, parameter_8,
    parameter_9,parameter_10, parameter_11, parameter_12,
    parameter_13, parameter_14
    into
    compCode,     businessUnit,     locCode, hrDeptID,
    glDept,     plat,     deptFunc,     empType,
    unionCode, jobCode,     careerLvl, empStatus,
    zid, superID
    from
    XXCCHRWEB.hr_web_sessionid_tmp
    where
    parameter_20= sesId;
    /*Assigning All Value to NULL superID*/
    IF superid is null then
    superID:= 'All';
    END IF;
    jobCode:='('''|| get_token(jobCode, 1)||''')'||','||'('''|| get_token(jobCode, 2)||''')';
    dbms_output.put_line('SELECTING PARAMETERS FROM TEMP TABLE WITH ROW COUNT : '||l_cursor%ROWCOUNT);
    /* read from Employee Master */
    open l_cursor for SELECT DISTINCT * FROM ( SELECT HR_EMPLOYEE_MASTER.EMPLOYEE_ID, HR_EMPLOYEE_MASTER.LAST_NAME,
    HR_EMPLOYEE_MASTER.FIRST_NAME, HR_EMPLOYEE_MASTER.MIDDLE_NAME, HR_EMPLOYEE_MASTER.NAME,
    HR_EMPLOYEE_MASTER.EMPLOYEE_TYPE, HR_EMPLOYEE_MASTER.COMPANY, HR_EMPLOYEE_MASTER.COMPANY_DESCRIPTION,
    HR_EMPLOYEE_MASTER.BUSINESS_UNIT, HR_EMPLOYEE_MASTER.BUSINESS_UNIT_DESCRIPTION, HR_EMPLOYEE_MASTER.LOCATION,
    HR_EMPLOYEE_MASTER.LOCATION_NAME, HR_EMPLOYEE_MASTER.HR_DEPARTMENT_ID, HR_EMPLOYEE_MASTER.DEPARTMENT_NAME,
    HR_EMPLOYEE_MASTER.DEPARTMENT_FUNCTION, HR_EMPLOYEE_MASTER.PLATFORM, HR_EMPLOYEE_MASTER.JOB_CODE,
    HR_EMPLOYEE_MASTER.JOB_TITLE, HR_EMPLOYEE_MASTER.BUSINESS_TITLE, HR_EMPLOYEE_MASTER.MANAGER_LEVEL,
    HR_EMPLOYEE_MASTER.JOB_FUNCTION, HR_EMPLOYEE_MASTER.GL_DEPARTMENT_ID, HR_EMPLOYEE_MASTER.GL_OP_UNIT,
    HR_EMPLOYEE_MASTER.GL_RESPONSIBILITY_CENTER, HR_EMPLOYEE_MASTER.HR_CHANNEL, HR_EMPLOYEE_MASTER.FULL_OR_PART_TIME,
    HR_EMPLOYEE_MASTER.REGULAR_OR_TEMP, HR_EMPLOYEE_MASTER.GRADE, HR_EMPLOYEE_MASTER.UNION_CODE,
    HR_EMPLOYEE_MASTER.BARGAINING_UNIT, HR_EMPLOYEE_MASTER.ANNUAL_RATE, HR_EMPLOYEE_MASTER.HOURLY_RATE,
    HR_EMPLOYEE_MASTER.HIRE_DATE, HR_EMPLOYEE_MASTER .BIRTH_DATE, HR_EMPLOYEE_MASTER.REHIRE_DATE,
    HR_EMPLOYEE_MASTER.SERVICE_DATE, HR_EMPLOYEE_MASTER.POSITION_NUMBER, HR_EMPLOYEE_MASTER.REPORTS_TO,
    HR_EMPLOYEE_MASTER.REPORTS_TO_TITLE, HR_EMPLOYEE_MASTER.SUPERVISOR_ID, HR_EMPLOYEE_MASTER.SUPERVISOR_NAME, HR_EMPLOYEE_MASTER.GENDER,
    HR_EMPLOYEE_MASTER_1.LAN_ID
    FROM
    (XXCCHR.HR_EMPLOYEE_MASTER HR_EMPLOYEE_MASTER_1
    LEFT OUTER JOIN
    XXCCHR.HR_DEPARTMENT_SECURITY HR_DEPARTMENT_SECURITY
    ON
    HR_EMPLOYEE_MASTER_1.EMPLOYEE_ID=HR_DEPARTMENT_SECURITY.EMPLOYEE_ID)
    LEFT OUTER JOIN
    XXCCHR.HR_EMPLOYEE_MASTER HR_EMPLOYEE_MASTER
    ON
    -- HR_DEPARTMENT_SECURITY.DEPARTMENT_SECURITY=HR_EMPLOYEE_MASTER.HR_DEPARTMENT_ID
    (HR_DEPARTMENT_SECURITY.DEPARTMENT_SECURITY=HR_EMPLOYEE_MASTER.HR_DEPARTMENT_ID
    or
    HR_DEPARTMENT_SECURITY.DEPARTMENT_SECURITY in ('DPALL','DPCAG009'))
    WHERE
    HR_EMPLOYEE_MASTER_1.LAN_ID=upper(zid) and
    (compCode = 'All' or HR_EMPLOYEE_MASTER.COMPANY IN compCode)
    (jobCode = 'All' or HR_EMPLOYEE_MASTER.JOB_CODE IN (jobCode) ) ) ;
    dbms_output.put_line('END OF SELECT for counter number : ' || counter ||' Cursor row count : '|| l_cursor%ROWCOUNT || ' with Job Code : ' || (jobCode));
    dbms_output.put_line('Company Code is:' || compCode);
    COMMIT;
    dbms_output.put_line('Data has been Output with session id:' || sesId);
    --delete from XXCCHRWEB.hr_web_sessionid_tmp where parameter_20= sesId;
    dbms_output.put_line('Data should have been DELETED, please check the session temp table');
    commit;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line('AN EXCEPTION HAS BEEN CAUGHT for counter number : ' || counter ||' Cursor row count : '|| l_cursor%ROWCOUNT || ' from session id : ' || sesId);
    dbms_output.put_line('The error code is ' || SQLERRM);
    END GETEMPLOYEEDATA;
    Edited by: user10384134 on Nov 4, 2009 8:37 AM

    This seems to work for me:
    define param="'ABC','XYZ'"; --- Set up a test in clause
    --- Test data
    with test as
    (select 'ABC' fld from dual union all
    select 'DEF' from dual union all
    select 'PQR' from dual union all
    select 'XYZ' from dual)
    --- Query starts here.
    select fld
    from test,
           table (sys.ODCIVarchar2List (&param)) p
    where fld = p.column_valueOr Using an actual "IN" clause:
    define param="'ABC','XYZ'";
    with test as
    (select 'ABC' fld from dual union all
    select 'DEF' from dual union all
    select 'PQR' from dual union all
    select 'XYZ' from dual
    p as
    (select column_value from table (sys.ODCIVarchar2List (&param))
    select fld
    from test
    where fld in (select column_value from p)Edited by: AlanWms on Nov 4, 2009 9:08 AM

  • Data committed by Stored Procedure can rollback ?

    Hi all !
    I have an application which uses SLSB marked as tx-Required CMT.
    However some business logic is inside Oracle Stored Procedures which issue Commit / Rollback at the end of their job.
    I wonder what happens if, in the end, the EJB rolls back the Container tx ? the data committed by the stored procedure will Rollback ?
    Thanks
    Francesco

    Francesco Marchioni wrote:
    Hi all !
    I have an application which uses SLSB marked as tx-Required CMT.
    However some business logic is inside Oracle Stored Procedures which issue Commit / Rollback at the end of their job.
    I wonder what happens if, in the end, the EJB rolls back the Container tx ? the data committed by the stored procedure will Rollback ?
    Thanks
    FrancescoHi, no. It is an unmanageable situation if WebLogic thinks it's running a
    transaction but some of the procedures being called contain transaction
    control calls. If a procedure calls a commit or rollback, everything in
    the current transaction is affected, and nothing in the future.
    For sanity's sake you must remove all transaction calls from procedures
    if they are to be called from WebLogic transactions.
    Joe

  • Pass BPC SSIS variable to stored procedure

      Dear All
    We have a ssis package in which there is data flow task. There
    is a OLEDB source which uses “Data access mode” as sql command. We used OLEDB data source instead of execute sql task as the outuput is table format generated in Stored proc which is used in following task
    This task calls a stored procedure with a input parameter which will be appset name.   [EXEC ProcName '@BPCAPPSET']
    The stored procedure is executing fine without any issues.But when I pass variable containing appset name to that stored  procedure its not taking properly and package ending successful.
    The variable is “BPCAPPSET” it contains appset name which
    will be taken front end.
       However to test if this value is taken by stored procedure
    or not, I tried to hardcode and pass appset name to stored procedure. i.e exec
    ProcName Appset1.
      Appset1 is existing appset. It worked fine. But we want to
    put this package in all land scapes, such that whenever it is triggered it will
    take the appset as parameter and does the calculation in stored procedure.
       Please advice how to pass this variable to stored
    procedure.
    regards
    Prasad

      Hi Roberto
    Thanks for your mail.
    I have tried, but I am getting error that @BPCAPPSET scalar
    variable must be defined.
    I believe that @BPCAPPSET is system defined variable which
    will be passed from Data manager package. May be this is the reason it is not
    recognizing this variable?
    If so, should I define a variable in SSIS. How can we
    assign value of @BPCAPPSET to the newly defined variable?
    Please advise. Attached screenshot.

Maybe you are looking for

  • Comments in OLAP Query

    I have tried unsuccessfully to use the traditional comment indicators (--, // or /../) in the MII OLAP Query Template.  Can any one offer any insight ?  We are running xMII 11.5 Thanks Edited by: Gary Wilson on Mar 18, 2010 4:17 PM

  • Service PO Closure

    Hi all, How to close (Recieve) the Service PO ? (I have created the Line type as Value Basis - Rate & Purchase basis - Temp labor) Thanks in advance Sathish

  • Multiple queries happeing in adf query component using LOV

    Hi, I am using a programmatic view object in adf query component and have created List of values for one attribute by adding another programmatic ViewObject as ViewAccessor. To populate the lov ViewObject, i have overwritten the method executeQueryFo

  • Cannot see how to uninstall VISA for LV 7.1

    I need to reinstall LV 7.1 on Linux. I do an uninstall and re-install and it says that VISA is already installed. How do I uninstall VISA 3.1-1?

  • Acrobat XI can't see my Brother MFC-6490-CW scanner since installing Windows 8.1

    The scanner works fine with Windows Scanner/Fax and other apps but Acrobat can't even see the scanner.  The issues seems to be just with Acrobat.  I have uninstalled and reinstalled the Brother drivers multiple times but the result is the same.  I in