*WHEN and STORED PROCEDURES

Hi there!
I have a transformation group in a stored procedure type account transformation that i would like to fire only lets say when TIME.MONTHNUM = 1 2 or 3. (basically 1st quarter).
Here is what the book says:
Stored  procedures  must  be  written  in  their  own  commit  section,
i.e.  they  cannot  coexist  with  a  WHEN/ENDWHEN  structure,
nor  can  be  part  of  any MDX  logic. 
What is the workaround? (i still wanna use the BR)
Thanks for your help
Nic

Conditional logic branching of this sort isn't supported in BPC script logic -- at least in the Microsoft SQL logic syntax. I don't know about NW and ABAP, but hopefully that will give more options for efficient coding.
In SQL, you have no choice but to call the stored proc, passing the MonthNum as a parameter, and then building your condition in the stored proc itself.
The only instruction that can go inside a *when / *is structure is a *REC command -- nothing else like an *INCLUDE or a *RUN_STORED_PROC or a *RUN_ALLOCATION. It'd be nice if that were possible.

Similar Messages

  • DAC task with Informatica mapping and stored procedure (very slow)

    Hello,
    We have a DAC task that launch an Informatica Workflow with a simple query and stored procedure, like this:
    SQL QUERY
    ==========================
    SELECT
    W_ACTIVITY_F.ROW_WID,
    W_AGREE_D.AGREE_NUM,
    W_PRODUCT_D.ATTRIB_51,
    W_SRVREQ_D.ATTRIB_05,
    W_ORG_DH.TOP_LVL_NAME,
    W_ORG_D.ATTRIB_06,
    W_PRODUCT_GROUPS_D.PRODUCT_LINE,
    W_PRODUCT_D.PROD_NAME
    FROM
    W_AGREE_D,
    W_SRVREQ_F,
    W_ACTIVITY_F,
    W_PRODUCT_D LEFT OUTER JOIN W_PRODUCT_GROUPS_D ON W_PRODUCT_D.PR_PROD_LN = W_PRODUCT_GROUPS_D.PRODUCT_LINE,
    W_ORG_D,
    W_SRVREQ_D,
    W_ORG_DH
    WHERE
    W_SRVREQ_F.AGREEMENT_WID = W_AGREE_D.ROW_WID AND
    W_SRVREQ_F.SR_WID = W_ACTIVITY_F.SR_WID AND
    W_SRVREQ_F.PROD_WID = W_PRODUCT_D.ROW_WID AND
    W_SRVREQ_F.ACCNT_WID = W_ORG_D.ROW_WID AND
    W_SRVREQ_F.SR_WID = W_SRVREQ_D.ROW_WID AND
    W_ORG_D.ROW_WID = W_ORG_DH.ROW_WID
    STORED PROCEDURE
    ===========================
    ConvSubProy(W_AGREE_D.AGREE_NUM,
    W_PRODUCT_D.ATTRIB_51,
    W_SRVREQ_D.ATTRIB_05,
    W_ORG_DH.TOP_LVL_NAME,
    W_ORG_D.ATTRIB_06,
    W_PRODUCT_GROUPS_D.PRODUCT_LINE,
    W_PRODUCT_D.PROD_NAME)
    The mapping is very simple:
    Source Qualifier -> Stored procedure -> Update strategy (only two ports: ROW_WID and custom column) -> Target Table
    When I launch the DAC Execution Plan the corresponding task take much time (40 minuts). But when I launch the corresponding Workflow from Informatica PowerCenter Workflow Manager this only take 50 seconds... when I see the log session for the task I can see that much time is spent on the time of the updates. For example, when DAC is running the writer updates 10000 records every 6/7 minuts, but when Workflow Manager is running thw writer updates 10000 records every 8/9 seconds.
    So, what happens (in the DAC) to that so much time difference? Is there a way to reduce the execution time when the task is launched from DAC?
    Thanks
    Best Regards
    Benjamin Tey

    Have you tried using bulk load type?
    In Workflow Manager can you open the associated task, navigate to the mapping tab and seled the target table.
    What is the value for "Target load type" and which of the following boxes are checked: Insert, Update as Update, Update as Insert, Update else Insert, Delete?

  • Approval Procedures and Stored Procedures

    Hi All
    I have a problem with approval procedures and stored procedures.
    I created an approval procedure to check if a value in the udf is selected or not . if not then a messge is produced to ask the user to select the person to approve the PO.
    Biut now the problem is the PO's are linked approval templates to the error messge don't show before the approval template screen.
    Please assist.
    Thanks
    Bongani Dlamini

    Hi Gordon
    The stored procedure is just for validating if the user has selected the udf value.
    It is not for approval*
    I created an approval template for this purpose. So my problem is when I add the Po to the system the SP doesn't kick-in and alert the user to select the person to approve the PO.
    Process Flow.
    User captures PO then select the value on the UDF Field ( Approver) The value selected is linked to a query which is used by the Approval Template
    If this method is still not supported then please let me know .
    Thanks
    Bongani Dlamini

  • Array data sporadically lost when calling stored procedure

    We have weird problem with stored procedures for which I have not been able to find an explanation so far.
    Our app has a bunch of stored procedures which process arrays of integers or strings.
    From time to time (maybe 1 in a 1000) array data gets lost when calling stored procedures. From the logs we know that the data gets sent to the stored procedure, but on the DB side the procedure throws an exception because arrays are empty.
    We are using (modified) OracleConnectionCacheImp (thus PooledConnections, etc.). My latest guess is that maybe somehow ArrayDescriptors on the (pooled)connection used to call the stored procedure are somehow affected when another pooled connection from OracleConnectionCacheImp gets removed by parallel thread. Is that possible? Or are the PooledConnections internally (in pooled connection data source) completely isolated from each other ?

    We have weird problem with stored procedures for which I have not been able to find an explanation so far.
    Our app has a bunch of stored procedures which process arrays of integers or strings.
    From time to time (maybe 1 in a 1000) array data gets lost when calling stored procedures. From the logs we know that the data gets sent to the stored procedure, but on the DB side the procedure throws an exception because arrays are empty.
    We are using (modified) OracleConnectionCacheImp (thus PooledConnections, etc.). My latest guess is that maybe somehow ArrayDescriptors on the (pooled)connection used to call the stored procedure are somehow affected when another pooled connection from OracleConnectionCacheImp gets removed by parallel thread. Is that possible? Or are the PooledConnections internally (in pooled connection data source) completely isolated from each other ?

  • Database updation using XML and stored Procedure?

    Hello,
    I want to perform updation in multiple tables using XML files.Please suggest can I do updation using xml and stored procedure.
    If yes then which is more efficient and takes less time.
    1.Updation using xml files only
    2.Updation using xml files with stored procedure.
    3.Stored procedure alone.
    If direct xml and stored procedure communication is possible.then please write how.
    Thanks in advance for any help.

    Here's a sample. The next code drop of the XSQL Servlet will make the easy-to-do from within XSQL Pages:
    package package1;
    import org.w3c.dom.*;
    import java.sql.*;
    import oracle.jdbc.driver.*;
    import oracle.xml.sql.query.OracleXMLQuery;
    public class Class1 extends Object {
    public static void main( String[] arg ) throws Exception {
    Connection conn = getConnection();
    CallableStatement ocs = conn.prepareCall("begin ? := App.HotItems('PAUL'); end;");
    ocs.registerOutParameter(1,OracleTypes.CURSOR);
    ocs.execute();
    ResultSet rs = ((OracleCallableStatement)ocs).getCursor(1);
    OracleXMLQuery oxq = new OracleXMLQuery(conn,rs);
    System.out.println(oxq.getXMLString());
    oxq.close();
    rs.close();
    ocs.close();
    conn.close();
    public static Connection getConnection() throws Exception {
    String username = "scott";
    String password = "tiger";
    String dburl = "jdbc:oracle:thin:@localhost:1521:xml";
    String driverClass = "oracle.jdbc.driver.OracleDriver";
    Driver d = (Driver)Class.forName(driverClass).newInstance();
    return DriverManager.getConnection(dburl,username,password);
    null

  • Confusion when writing Stored Procedure...

    Iam having confusion when writing Stored Procedure.Plz solve my confusion.
    Can we write Stored Procedure using JDBC like the Code I have given.If So,what is the wrong i had made in the Code?.Iam using MySQL 5.0.27.
    If it can't be done with the code that i had written, Iam telling Some steps that I have learned,suggest, whether it is correct or not?
    Step 1:
    Create Stored Procedure in database separately.We can't create stored procedure in JDBC(Am I Right?).
    Step 2:
    After writing Stored procedure call the procedure inside JDBC using preparecall method of callable statement.
    Code:
    try
                  Class.forName(dbDriver).newInstance();
                  out.println("<b>MySQL Driver Loaded Sucessfully </b>"+"<br>");
                  connection=DriverManager.getConnection ("jdbc:mysql://localhost:3306/exportproc? user=root&password=sachin");
                  statement = connection.createStatement();
                  out.println("<b>Statement Created</b>");
                  sql="create procedure exportproc(in name varchar(15),in password varchar(12))"
                          +"begin"
                          +"insert into exportproc values(name,password)"
                          +"end";
                  out.println("<b>Query assigned to sql</b>"+"<br>");
                  statement.executeUpdate("create database exportproc");
                  statement.executeUpdate("use exportproc");
                  statement.executeUpdate(sql);
                  out.println("Table Created");
              }Message was edited by:
    sachindev

    hi,
    create a stored procedure in mysql , i dont know mysql , any way we take your code
    create procedure exportproc(in name varchar(15),in password varchar(12))
                          begin
                          insert into exportproc values(name,password)
                          endprocedure created ....
    now just call in java by using CallableStatement
    ex:
           CallableStatement cs = con.prepareCall("{call exportproc(?,?)}");
             cs.setString (1, "vijay");
             cs.setString (2, "123");
             cs.executeUpdate ();

  • How to find out date in oracle when the Stored procedure in changed.

    Dear Sir,
    I want to know the list of dates when stored procedure is modified during a given period.
    eg. Procedure created 01/01/2011
    i changed the procedure 4 times say 01/10/2011,01/12/2011,01/01/2012 and 20/12/2012.
    from where i can get these details along with the other details like what will be procedure syntax at different modifications and most important what is ipof machine.
    thanks & regards
    Munish

    user9216770 wrote:
    Dear Sir,
    I want to know the list of dates when stored procedure is modified during a given period.
    eg. Procedure created 01/01/2011
    i changed the procedure 4 times say 01/10/2011,01/12/2011,01/01/2012 and 20/12/2012.
    from where i can get these details along with the other details like what will be procedure syntax at different modifications and most important what is ipof machine.
    thanks & regards
    MunishOracle does NOT retain or contain previous versions.
    You should be able to obtain these from your Source Code Repository; like Subversion.

  • SQL Server 2008 R2 - Report Builder 3.0 - timeout using shared data source and stored procedure

    I select the shared datasource from the data source propeties dialog, test the connection and everything is good.
    I add a dataset by selecting "use a dataset embedded in my report" option within the Dataset properties dialog.
    I select the newly added data source, click the "Stored procedure" query type and drop down the list box and select my intended stored procedure.
    the timeout for the dataset is "0" seconds.
    I click the "OK" button and I'm presented with the parameters to the stored procedure.
    I enter valid data for the parameters and click the "OK" button.
    I then get the following error message after 30 seconds:
    The problem is, all of the timeouts, that I'm aware of, have values of zero (no timeout) or high enough values that 30 seconds isn't even close to the timeout.
    I think the smallest timeout we have is 120 seconds.
    I have searched this site and many others and the solutions all involve altering the stored procedure to get the fields into report builder and then revert the stored procedure back to its original form.
    To me, this is NOT a solution.  
    I have too many stored procedures that need to be brought into Report Builder.
    I need a real solution.
    Thank you for you time, Tim Caldwell.
    Timothy E Caldwell

    I don't mean to be rude, but really, check to see if the stored procedure can return data rows???
    Maybe I'm not being clear enough.
    The stored procedure runs perfectly fine.
    it runs perfectly fine in the production environment and the test environment.
    I can access the stored procedure in several ways and have it return correct data.
    I can even trick report builder into creating a dataset with parameters and run the stored procedure that way.
    What I cannot do, is to get report builder to not timeout after 30 seconds on the initial creation of a dataset with a Query type of stored procedure.
    I have seen this issues posted again and again and again on may different sites and the "solution" is to simplifiy the stored procedure by creating a stored procedure that has a create table and a select in the stored procedure and that's it.  After
    report builder creates the dataset the developer then has to replace the simplified stored procedure with the actual stored procedure and everything works fine after that.
    HOWEVER, having to go through this process for 70 or more stored procedures is ridiculous.
    It would appear that there is something within report builder itself that is causing this issue.
    The SQL Script included is an example of a stored procedure that will not create fields create a dataset with fields and parameters in Report Builder 3.0:
    USE [CRUM_IT]
    GO
    /****** Object: StoredProcedure [dbo].[COGNOS_Level5ScriptSP] Script Date: 11/17/2014 08:02:26 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER procedure [dbo].[COGNOS_Level5ScriptSP]
    @CompanyCode varchar(8) = null,
    @GetSiblings varchar(1) = 'N'
    as
    Begin
    -- get emergency contact info
    select *
    into #tmp_Contacts
    from
    (select
    ConEEID,
    con.connamelast as [Emer Contact Last Name],
    con.connamefirst as [Emer Contact First Name],
    con.connamemiddle as [Emer Contact Middle Initial/Name]--,
    ,ROW_NUMBER() over (Partition by ConEEID order by ConNameLast)as rn
    ,ISNULL(
    case when con.conphonepreferred = 'H'
    then '(' + substring(con.conphonehomenumber, 1, 3) + ')' + substring(con.conphonehomenumber, 4, 3) + '-' + substring(con.conphonehomenumber, 7, 4)
    else '(' + substring(con.conphoneothernumber , 1, 3) + ')' + substring(con.conphoneothernumber , 4, 3) + '-' + substring(con.conphoneothernumber , 7, 4)
    end,
    ) as [Emergency Phone]
    from [ultiprosqlprod1].[ultipro_crum].dbo.Contacts con
    where con.ConIsEmergencyContact='y'
    and con.ConIsActive='y'
    ) A
    where A.rn = 1
    CREATE TABLE #tmp_CompanyCodes (CompanyCode varchar(8))
    If @GetSiblings = 'Y'
    Begin
    INSERT INTO #tmp_CompanyCodes (CompanyCode)
    EXEC [z_GetClientNumbers_For_ParentOrg_By_ClientNumber] @CompanyCode
    End
    INSERT INTO #tmp_CompanyCodes
    values (@CompanyCode)
    select *
    into #tmp_Company
    from [ultiprosqlprod1].[ultipro_crum].dbo.Company
    where cmpcompanycode in (select CompanyCode from #tmp_CompanyCodes)
    select distinct
    cmpcompanycode as [Client ID],
    CmpCompanyDBAName as [Client Name],
    eec.eecEmplStatus AS [Employment Status],
    eec.eecEmpNo AS [Employee Num],
    rtrim(eep.eepNameLast) AS [Last Name],
    rtrim(eep.eepNameFirst) AS [First Name],
    isnull(rtrim(ltrim(eep.eepNameMiddle)), '') AS [Middle Initial/Name],
    rtrim(eep.eepAddressLine1) AS [Address Line 1],
    isnull(rtrim(eep.eepAddressLine2), '') AS [Address Line 2],
    eep.eepAddressCity AS [City],
    eep.eepAddressState AS [State],
    CASE
    WHEN len(eep.eepAddressZipCode) > 5 and charindex(eep.eepAddressZipCode, '-', 1) = 0
    THEN substring(eep.eepAddressZipCode, 1, 5)
    ELSE rtrim(eep.eepAddressZipCode)
    END AS [Zip code],
    CASE
    WHEN len(eep.eepAddressZipCode) > 5 and charindex(eep.eepAddressZipCode, '-', 1) = 0
    THEN substring(eep.eepAddressZipCode, 6, 4)
    WHEN len(eep.eepAddressZipCode) > 5 and charindex(eep.eepAddressZipCode, '-', 1) > 0
    THEN substring(eep.eepAddressZipCode, charindex(eep.eepAddressZipCode, '-', 1) + 1, 4)
    WHEN len(eep.eepAddressZipCode) <= 5
    THEN ''
    END AS [ZIP + 4],
    substring(eep.eepSSN, 1, 3) + '-' + substring(eep.eepSSN, 4, 2) + '-' + substring(eep.eepSSN, 6, 4) AS [SSN],
    isnull(convert(VARCHAR(10), eep.eepDateOfBirth, 101), '') AS [Date Of Birth],
    eetFED.TAXCODE AS [FED Tax Code],
    eetFED.FILINGSTATUS AS [Fed Filing Status],
    eetFED.EXEMPTIONS AS [Fed Exemption Allowance],
    eetFED.ADDITIONAL AS [Additional Fed Withholding],
    eetSIT.TAXCODE AS [SIT Tax Code],
    eetSIT.FILINGSTATUS AS [State Filing Status],
    eetSIT.EXEMPTIONS AS [State Exemption Allowance],
    eetSIT.ADDITIONAL AS [Additional State Withholding],
    isnull('(' + substring(eep.eepPhoneHomeNumber, 1, 3) + ')' + substring(eep.eepPhoneHomeNumber, 4, 3) + '-' + substring(eep.eepPhoneHomeNumber, 7, 4), '') AS [Home Phone],
    isnull((SELECT cod.codDesc
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.Codes cod WITH (NOLOCK)
    WHERE cod.codCode = eep.eepEthnicID
    AND cod.codDosTable = 'ETHNICCODE'), '') AS [Race-Origin], --eep.eepEthnicID AS [Race-Origin],
    eep.eepGender AS [Gender],
    isnull(convert(VARCHAR(10), eec.eecDateOfOriginalHire, 101), '') AS [Original Hire Date],
    isnull(convert(VARCHAR(10), eec.eecDateOfSeniority, 101), '') AS [Seniority Date],
    isnull(convert(VARCHAR(10), eec.eecDateOfTermination, 101), '') AS [Termination Date],
    isnull(eecTermType,'') as [Termination Type],
    isnull(TchDesc, '') as [Termination Reason],
    rtrim(eec.eecJobCode) AS [WC Code],
    isnull(eec.eecJobTitle, '') AS [Job Title],
    pgr.pgrPayFrequency AS [Pay Frequency],
    eec.eecFullTimeOrPartTime AS [Full/Part Time],
    eec.eecSalaryOrHourly AS [Pay Type],
    isnull(convert(MONEY, eec.eecHourlyPayRate), 0.00) AS [Hourly Rate],
    isnull(eec.eecAnnSalary, 0.00) AS [Annual Salary],
    [YTD Hours],
    isnull(eep.eepNameFormer, '') AS [Maiden Name],
    eec.eecLocation AS [Location ID],
    rtrim(eec.eecOrgLvl1) AS [Department ID],
    eec.eecorglvl2 AS [Cost Item],
    eec.eecorglvl3 as [Client Project],
    eec.eecPayGroup as [Pay Group],
    isnull(eepAddressEMail,' ') as [Email Address],
    isNull(BankName1,' ') as PrimaryBank,
    isNull(BankRoute1,' ') as PrimaryRouteNum,
    isNull(Account1,' ') as PrimaryAccount,
    isNull(AcctType1,' ') as PrimaryAcctType,
    isNull(DepositRule1,' ') as PrimaryDepositRule,
    isNull(BankName2,' ') as SecondaryBank,
    isNull(BankRoute2,' ') as SecondaryRouteNum,
    isNull(Account2,' ') as SecondaryAccount,
    isNull(AcctType2,' ') as SecondaryAcctType,
    isNull(DepositRule2,' ') as SecondaryDepositRule,
    isNull(
    CASE
    WHEN DepositRule2 = 'D'
    THEN '$' + convert(varchar, cast(EddAmtOrPct2 AS decimal(10,2)))
    WHEN DepositRule2 = 'P'
    THEN convert(varchar, cast((EddAmtOrPct2*100) AS decimal(10,0))) + '%'
    ELSE null
    END,' ') as SecondaryDepositAmount,
    isNull(BankName3,' ') as ThirdBank,
    isNull(BankRoute3,' ') as ThirdRouteNum,
    isNull(Account3,' ') as ThirdAccount,
    isNull(AcctType3,' ') as ThirdAcctType,
    isNull(DepositRule3,' ') as ThirdDepositRule,
    isNull(
    CASE
    WHEN DepositRule3 = 'D'
    THEN '$' + convert(varchar, cast(EddAmtOrPct3 AS decimal(10,2)))
    WHEN DepositRule3 = 'P'
    THEN convert(varchar, cast((EddAmtOrPct3*100) AS decimal(10,0))) + '%'
    ELSE null
    END,' ') as ThirdDepositAmount,
    Supervisor,
    eec.eecEEID AS [Employee EEID],
    eec.EecJobCode As [Job Code],
    isnull(eec.EecTimeclockID,' ') As [Time Clock ID],
    con.[Emer Contact Last Name],
    con.[Emer Contact First Name],
    con.[Emer Contact Middle Initial/Name],
    con.[Emergency Phone]
    from [ultiprosqlprod1].[ultipro_crum].dbo.empPers eep WITH (NOLOCK)
    inner join [ultiprosqlprod1].[ultipro_crum].dbo.empComp eec WITH (NOLOCK)
    ON eep.eepEEID = eec.eecEEID
    inner join #tmp_Company cmp WITH (NOLOCK)
    ON eec.eecCOID = cmp.cmpCOID
    inner join [ultiprosqlprod1].[ultipro_crum].dbo.PayGroup pgr WITH (NOLOCK)
    ON eec.eecPayGroup = pgr.pgrPayGroup
    left outer join [ultiprosqlprod1].[ultipro_crum].dbo.TrmReasn
    on tchCode = eecTermReason
    left join (select CAST(sum(isnull(eee.eeeYTDHrs,0.00))AS DECIMAL(18,2)) as [YTD Hours],
    eeeEEID,
    eeeCOID
    from [ultiprosqlprod1].[ultipro_crum].dbo.EmpEarn eee with (NOLOCK)
    group by eeeCOID,eeeEEID)eee
    on eec.eecEEID = eee.eeeEEID
    and eec.eecCOID = eee.eeeCOID
    left join (SELECT eetCOID AS COID,
    eetEEID AS EEID,
    eetTaxCode AS TAXCODE,
    eetFilingStatus AS FILINGSTATUS,
    eetExemptions AS EXEMPTIONS,
    eetExtraTaxDollars AS ADDITIONAL
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.empTax WITH (NOLOCK)
    WHERE eetTaxCode = 'USFIT'
    )eetFED
    ON eec.eecCOID = eetFED.COID
    and eec.eecEEID = eetFED.EEID
    left join (SELECT eetCOID AS COID,
    eetEEID AS EEID,
    eetTaxCode AS TAXCODE,
    eetFilingStatus AS FILINGSTATUS,
    eetExemptions AS EXEMPTIONS,
    eetExtraTaxDollars AS ADDITIONAL
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.empTax WITH (NOLOCK)
    WHERE eetTaxCode like '%SIT'
    AND eetIsWorkInTaxCode = 'Y'
    )eetSIT
    ON eec.eecCOID = eetSIT.COID
    and eec.eecEEID = eetSIT.EEID
    left outer join (SELECT eddCOID,
    eddEEID,
    eddEEBankName BankName1,
    eddEEBankRoute BankRoute1,
    eddAcct Account1,
    EddAcctType AcctType1,
    EddDepositRule DepositRule1,
    EddAmtOrPct EddAmtOrPct1
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.EmpDirDp WITH (NOLOCK)
    WHERE eddSequence = '99')edd
    ON eec.eecCOID = edd.eddCOID
    and eec.eecEEID = edd.eddEEID
    left outer join (SELECT eddCOID,
    eddEEID,
    eddEEBankName BankName2,
    eddEEBankRoute BankRoute2,
    eddAcct Account2,
    EddAcctType AcctType2,
    EddDepositRule DepositRule2,
    EddAmtOrPct EddAmtOrPct2
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.EmpDirDp WITH (NOLOCK)
    WHERE eddSequence = '01')edd2
    ON eec.eecCOID = edd2.eddCOID
    and eec.eecEEID = edd2.eddEEID
    left outer join (SELECT eddCOID,
    eddEEID,
    eddEEBankName BankName3,
    eddEEBankRoute BankRoute3,
    eddAcct Account3,
    EddAcctType AcctType3,
    EddDepositRule DepositRule3,
    EddAmtOrPct EddAmtOrPct3
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.EmpDirDp WITH (NOLOCK)
    WHERE eddSequence = '02')edd3
    ON eec.eecCOID = edd3.eddCOID
    and eec.eecEEID = edd3.eddEEID
    left outer join (SELECT eecCOID,
    eecEEID,
    rtrim(eepNameLast) + ', ' +
    rtrim(eepNameFirst) + ' ' +
    isnull(rtrim(ltrim(eepNameMiddle)), '') AS [Supervisor]
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.EmpComp WITH (NOLOCK)
    join [ultiprosqlprod1].[ultipro_crum].dbo.EmpPers with (NoLock)
    on eeceeid = eepeeid)eec2
    ON eec.eecSupervisorID = eec2.eecEEID
    left outer join #tmp_Contacts con
    on eep.eepEEID = con.ConEEID
    order by [Client ID],
    [Last Name],
    [First Name]
    drop table #tmp_Contacts
    END
    Timothy E Caldwell

  • SSRS dataset throws error when another stored procedure is called inside dataset stored procedure

    Hello;
    I am using Report Build 3.0, I have a simple report which gets data using dataset which is created from a Stored Procedure. I have another stored procedure which updates the data in the table which is used for the report. I want to get the live data on report everytime
    the report is run so that I call that stored procedure (sp_updatedata) inside my report dataset stored procedure and here where my report fails as it throws error while creating dataset.
    Here is sample:
    sp_updatedata (this only returns "Command(s) completed successfully"
    Create Proce sp_getReportData
    As
    Begin
    Exec sp_updatedata -- I call it to update the data before it displays on the report
    Select * from customers
    End
    If I remove this line it works.
    Exec sp_updatedata -- I call it to update the data before it displays on the report
    Thanks
    Essa Mughal

    Hi MESSA,
    According to your description, you create a dataset based on a stored procedure. In this procedure, it calls another procedure. Now it throws error when creating dataset. Right?
    In Reporting Services, when creating dataset, all the query or stored procedure will be executed in SSMS. So if the procedure can be executed in SSMS, it supposed to be working in SSRS. However, it has a limitation in SSRS. In a dataset, it can only return
    one result set.
    In this scenario, I don't think it's the issue of calling other procedure inside of procedure. Because we tested in our local environment, it works fine. I guess the sp_updatedata returns a result set, and the "select * from customers" returns
    another result set. This might be the reason cause the error.
    Reference:
    Query Design Tools in Report Designer SQL Server Data Tools (SSRS)
    Reporting Services Query Designers
    If you still have any question, please post the error message and the store procedure (sp_updatedata).
    Best Regards,
    Simon Hou

  • ESB throwing error when invoking Stored Procedure

    Hi there,
    I'm using SOA Suite 10.1.3.4. I have an ESB service which stores orders from a IBM Maximo system(Procurement system) into Oracle database using stored procedure. I can insert the orders through the endpoint URL using the test client provided by SOA Suite ESB console. But when Maximo sends the orders i'm getting errors as below. I can also see that the input is null when called the procedure. But in the instance of the ESB Console i can see the Payload sent by the Maximo system. Not sure where and why the payload disappears before calling the stored procedure.
    I have been battling on this for couple of days. Any help on this is much appreciated.
    <2009-01-09 11:21:12,003> <DEBUG> <default.collaxa.cube.ws> <Database Adapter::Outbound> <oracle.tip.adapter.db.TopLinkLogger log> client acquired
    <2009-01-09 11:21:12,003> <DEBUG> <default.collaxa.cube.ws> <Database Adapter::Outbound> <oracle.tip.adapter.db.TopLinkLogger log> acquire unit of work: 25523441
    <2009-01-09 11:21:12,003> <DEBUG> <default.collaxa.cube.ws> <Database Adapter::Outbound> <oracle.tip.adapter.db.TopLinkLogger log> TX beginTransaction, status=STATUS_ACTIVE
    <2009-01-09 11:21:12,003> <DEBUG> <default.collaxa.cube.ws> <Database Adapter::Outbound> <oracle.tip.adapter.db.sp.AbstractStoredProcedure execute> BEGIN APSEZ.APS_MAXIMO_INTERFACE.APS_RECIEVE_POV(I_PO_IN_OBJ=>?); END;
    <2009-01-09 11:21:12,003> <DEBUG> <default.collaxa.cube.ws> <Database Adapter::Outbound> <oracle.tip.adapter.db.sp.AbstractStoredProcedure execute> Bindings [I_PO_IN_OBJ=>APSEZ.GET_PO_IN_OBJ(null)]
    ORABPEL-11811
    Error while trying to prepare and execute an API.
    An error occurred while preparing and executing the APSEZ.APS_MAXIMO_INTERFACE.APS_RECIEVE_POV API. Cause: java.sql.SQLException: ORA-06531: Reference to uninitialized collection
    ORA-06512: at "APSEZ.APS_MAXIMO_INTERFACE", line 52
    ORA-06512: at line 1
    [Caused by: ORA-06531: Reference to uninitialized collection
    ORA-06512: at "APSEZ.APS_MAXIMO_INTERFACE", line 52
    ORA-06512: at line 1
    Check to ensure that the API is defined in the database and that the parameters match the signature of the API. Contact oracle support if error is not fixable.
         at oracle.tip.adapter.db.exceptions.DBResourceException.createEISException(DBResourceException.java:469)
         at oracle.tip.adapter.db.sp.SPUtil.createResourceException(SPUtil.java:172)
         at oracle.tip.adapter.db.sp.AbstractStoredProcedure.execute(AbstractStoredProcedure.java:116)
         at oracle.tip.adapter.db.sp.SPInteraction.executeStoredProcedure(SPInteraction.java:134)
         at oracle.tip.adapter.db.DBInteraction.executeStoredProcedure(DBInteraction.java:1014)
         at oracle.tip.adapter.db.DBInteraction.execute(DBInteraction.java:232)
         at oracle.tip.adapter.fw.wsif.jca.WSIFOperation_JCA.executeRequestResponseOperation(WSIFOperation_JCA.java:486)
         at oracle.tip.adapter.fw.wsif.jca.WSIFOperation_JCA.executeInputOnlyOperation(WSIFOperation_JCA.java:739)
         at oracle.tip.esb.server.common.wsif.WSIFInvoker.executeOperation(WSIFInvoker.java:894)
         at oracle.tip.esb.server.common.wsif.WSIFInvoker.nextService(WSIFInvoker.java:810)
         at oracle.tip.esb.server.common.wsif.WSIFInvoker.nextService(WSIFInvoker.java:832)
         at oracle.tip.esb.server.service.impl.outadapter.OutboundAdapterService.nextService(OutboundAdapterService.java:223)
         at oracle.tip.esb.server.service.impl.outadapter.OutboundAdapterService.processBusinessEvent(OutboundAdapterService.java:135)
         at oracle.tip.esb.server.dispatch.InitialEventDispatcher.dispatchNonRoutingService(InitialEventDispatcher.java:406)
         at oracle.tip.esb.server.dispatch.InitialEventDispatcher.dispatch(InitialEventDispatcher.java:164)
         at oracle.tip.esb.server.dispatch.BusinessEvent.raise(BusinessEvent.java:1988)
         at oracle.tip.esb.server.dispatch.BusinessEvent.raise(BusinessEvent.java:1467)
         at oracle.tip.esb.utils.EventUtils.raiseBusinessEvent(EventUtils.java:205)
         at oracle.tip.esb.utils.EventUtils.raiseBusinessEvent(EventUtils.java:136)
         at oracle.tip.esb.server.service.EsbRouterSubscription.onBusinessEvent(EsbRouterSubscription.java:309)
         at oracle.tip.esb.server.dispatch.EventDispatcher.executeSubscription(EventDispatcher.java:138)
         at oracle.tip.esb.server.dispatch.InitialEventDispatcher.processSubscription(InitialEventDispatcher.java:545)
         at oracle.tip.esb.server.dispatch.InitialEventDispatcher.processSubscriptions(InitialEventDispatcher.java:527)
         at oracle.tip.esb.server.dispatch.EventDispatcher.dispatchRoutingService(EventDispatcher.java:94)
         at oracle.tip.esb.server.dispatch.InitialEventDispatcher.dispatch(InitialEventDispatcher.java:160)
         at oracle.tip.esb.server.dispatch.BusinessEvent.raise(BusinessEvent.java:1988)
         at oracle.tip.esb.server.dispatch.BusinessEvent.raise(BusinessEvent.java:1467)
         at oracle.tip.esb.server.service.impl.soap.EventOracleSoapProvider.raiseEvent(EventOracleSoapProvider.java:399)
         at oracle.tip.esb.server.service.impl.soap.EventOracleSoapProvider.processMessage(EventOracleSoapProvider.java:225)
         at oracle.j2ee.ws.server.provider.ProviderProcessor.doEndpointProcessing(ProviderProcessor.java:956)
         at oracle.j2ee.ws.server.WebServiceProcessor.invokeEndpointImplementation(WebServiceProcessor.java:349)
         at oracle.j2ee.ws.server.provider.ProviderProcessor.doRequestProcessing(ProviderProcessor.java:466)
         at oracle.j2ee.ws.server.WebServiceProcessor.processRequest(WebServiceProcessor.java:114)
         at oracle.j2ee.ws.server.WebServiceProcessor.doService(WebServiceProcessor.java:96)
         at oracle.j2ee.ws.server.WebServiceServlet.doPost(WebServiceServlet.java:194)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    Thanks
    Dhilip

    I doubt JPublisher has anything to do with this issue as JDeveloper is the tool used for SOA Development. The issue here is with the process that gets invoked by maximo. It is not populating the data correctly, and nulls are being sent to the adapter. When nulls are sent this causes issues in the code because it cannot initilise varrays in the stored procedure.
    Therefore the fix is to sort this issue out is to stop it sending nulls, if nulls are valid form the maximo system then the stored procedure needs to manage these. This can be done by setting defaults for the inputs.
    cheers
    James

  • 64bit OraOLEDB failed when calling stored procedure with Ref Cursor

    Hi everyone,
    I used the ADO VB sample provided with the Oracle 10g provider installation.
    But I compiled it in 64bit Visual Studio 2005 and ran on Windows 2003 x64 server.
    The function call "cmd.Execute" when it is trying to call a stored procedure which has an Out Ref Cursor parameter. The exception is
    "PLS-00306: wrong number or types arguments in call"
    I already set the property "PLSQLRSet" to true. But it doesn't help.
    The same code works if I compiled in 32 bit.
    It also works if the stored procedure does not have Ref Cursor parameter.
    I am guessing this is a bug in the 64bit Oracle provider. Anyone can confirm this please? or am I missing anything?
    Wilson

    It appears to work with 11.1.0.6.20 OLEDB provider but only for ExecuteNonQuery, I'm not able to work with Fill, and yes... in x86 works perfectly, but in x64 we are still having the ORA-06550 and PLS-00306 error.
    Our Connection string is as follows:
    "Provider=OraOLEDB.Oracle.1;OLEDB.NET=true;Password=xxxxx;Persist Security Info=True;User ID=exxxxx;Data Source=ECOR; PLSQLRSet=True"
    We are not using ODP.NET.
    Can you confirm that Fill method works with such update?

  • Different session used when calling stored procedure from form

    after commiting data in a form to a table, a stored procedure is called that inserts the data written to the table into several other tables. Some columns in the original table are updated - no commit is issued in the procedure. On returning from the procedure the form is re-queried but the updated columns don't contain the updates. This seems to imply that the stored procedure is running as a different session to the one of the form.
    Is this the case? Can we make the form and the stored procedure use the same session so that the data is available in both without having to commit in the procedure?

    No. They should be within one session unless you explicitly open a new session.
    The reason why you dont see updates of the data block when you requery is probably the changes on the form never go to the back end. I think first you have to make sure data changes go to db table. You can do a commit_form before calling the stored procedure and open up another session (e.g. sqlplus) to check the data in the table changed or not.

  • Issue when calling Stored procedure from application

    Dear all,
      Oracle DB version: 11.2.0.3
       OS : RHEL 5.9 64-bit version
      We are trying to execute one of the stored procedure (belonging to oracle DB schema) from our Dotnet application(recites in application server) but it takes more than 30 seconds to fetch the records. The stored procedure is called from application. When we try the same procedure from SQL developer or TOAD it completes within a second. Could anyone suggest on the issue?
    Note: we are calling a remote DB view from our DB.
    No. of records in the view : 49484929 rows
    Thanks in advance,
    Imran Khan

    Thanks Billy for the reply. The following is the function of the .net application which calls the procedure:
    public DataSet ResourceMonitor(String Date, String DateTime, String starttime, String endtime, String Assstarttime, String Assendtime)
    try
    cLog.StartMethod(this, System.Reflection.MethodInfo.GetCurrentMethod().Name);
    Database dbResourceMonitor = null;
    DataSet Resourceset = new DataSet();
    dbResourceMonitor = DatabaseFactory.CreateDatabase();
    DbCommand dbCommand = dbResourceMonitor.GetStoredProcCommand("SP_RESOURCEMONITOR1");
    dbResourceMonitor.AddInParameter(dbCommand, "P_Date", DbType.String, Date);
    dbResourceMonitor.AddInParameter(dbCommand, "P_DateTime", DbType.String, DateTime);
    dbResourceMonitor.AddInParameter(dbCommand, "P_Starttime", DbType.String, starttime);
    dbResourceMonitor.AddInParameter(dbCommand, "P_Endtime", DbType.String, endtime);
    dbResourceMonitor.AddInParameter(dbCommand, "P_AssStarttime", DbType.String, Assstarttime);
    dbResourceMonitor.AddInParameter(dbCommand, "P_AssEndtime", DbType.String, Assendtime);
    //dbCommand.Parameters.Add(BuildRefCursorParameter("DEPRECSET"));
    dbCommand.Parameters.Add(BuildRefCursorParameter("RECORDSET1"));
    dbCommand.Parameters.Add(BuildRefCursorParameter("RECORDSET2"));
    dbCommand.Parameters.Add(BuildRefCursorParameter("RECORDSET3"));
    dbCommand.Parameters.Add(BuildRefCursorParameter("RECORDSET4"));
    return Resourceset;
    catch (Exception ex)
    cLog.LogMessages(this, ex.Message, cLog.eWiproMessageTypes.ErrorType);
    throw ex;
    finally
    cLog.EndMethod(this, System.Reflection.MethodInfo.GetCurrentMethod().Name);
       The stored procedure SP_RESOURCEMONITOR1 has the following DDL:
    CREATE OR REPLACE PROCEDURE SP_RESOURCEMONITOR1
    (     P_Date      IN VARCHAR2,     
          P_DateTime      IN VARCHAR2,     
          P_Starttime     IN VARCHAR2,
          P_Endtime     IN VARCHAR2,
          P_AssStarttime     IN VARCHAR2,
          P_AssEndtime     IN VARCHAR2,
           P_Mode     IN NUMBER,
        RECORDSET1 OUT SYS_REFCURSOR,
        RECORDSET2 OUT SYS_REFCURSOR,
        RECORDSET3 OUT SYS_REFCURSOR,
        RECORDSET4 OUT SYS_REFCURSOR
    )AS
    BEGIN
    OPEN RECORDSET1 FOR
    Select ROLEMASTER.ROLEID,ROLEMASTER.ROLENAME as ResourceGroup,departmentmaster.DEPARTMENTNAME,departmentmaster.departmentid from Rolemaster
    INNER JOIN departmentmaster ON Rolemaster.DEPTID=departmentmaster.DEPARTMENTID
    WHERE 1=1 AND sysdate >=Rolemaster.START_DATE AND sysdate<=Rolemaster.END_DATE AND Upper(RoleMaster.Rolename) not like '%HIGHLOADER%' AND displayinlist=1
    ORDER BY ROLENAME;
    OPEN RECORDSET2 FOR
    select ROM.ROLENAME as ResourceGroup, fn_get_resource_status(p_starttime, p_endtime,RM.Resourceid,RM.DeptID) AS Status,upper(RM.Resourceid)as Resourceid,RM.RoleID,RM.DeptID,TRIM(RM.RESOURCENAME) AS RESOURCENAME,'Detail'As Details,'ResChng'As ResChng,'Calender' As Calender FROM ResourceMaster RM
    --INNER JOIN DEPARTMENTMASTER DM ON RM.DEPTID = DM.DEPARTMENTID
    INNER JOIN ROLEMASTER ROM ON RM.ROLEID = ROM.ROLEID
    where --UPPER (DM.DEPARTMENTNAME) IN ('DISPATCH','TRANSPORT','TRANSPORT RAMP')
    RM.DEPTID in (select DEPARTMENTID from DEPARTMENTMASTER where displayinadmin=1 and active=1)  ;
    if (P_Mode =2) THEN
    OPEN RECORDSET3 FOR
    select * from mobility_attendance_info_v where TRANSACTIONDATE >= TO_DATE(Substr(p_starttime,1, 9) ,'dd-MON-rr') - 1  order by staffno,TRANSACTIONDATETIME Desc;
    END IF;
    OPEN RECORDSET4 FOR
    select rsa.*,planning.flightno,'' As StTime,SUBSTR(rsa.depdt,11,5) as EndTime from resourceallocation rsa inner join planning ON rsa.planningid = planning.planningid
    where TO_TIMESTAMP(rsa.DEPDT,'dd-MON-rr HH24:MI')>=TO_TIMESTAMP(P_DateTime,'dd-MON-rr HH24:MI')  ;
    END SP_RESOURCEMONITOR1;
       The view mobility_attendance_info_v  is a called from a remote DB. Hope it's quite clear.
    Regards,
    Imran Khan

  • SSIS - Failure when calling stored procedure using sp_executesql

    Hi
    Newbie here so if it doesn't  make sense I apologise.
    I have an SSIS (Visual Studio 2012) package that basically gets data from tables and inserts them into staging tables.
    There are 2 containers each having 20 Execute SQL Tasks running in parallel inside and the 2nd one is failing when I try to call a stored procedure that is using sp_executesql.
    All the connections are fine as I can change the call of sp_executesql to an insert statement and it works ok.
    Property Settings for the container have TransactionOption = Required. Inside the Execute SQL's have Supported.
    Settings for the Execute SQL Tasks have the isStoredprocedure = TRUE and the procedure name is correct.
    I have tried to change the procedure name to pass in parameters etc but it seems that every time the calls hit the sp_executesql it falls over if more than 3 are called at the same time.
    Anybody got any ideas?
    Thanks in advance

    Thanks for the quick reply the error is
    failed with the following error: "The Microsoft Distributed Transaction Coordinator (MS DTC) has cancelled the distributed transaction.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly,
    or connection not established correctly.
    The parameters getting passed are correct as I'm using them in the Insert statement that I substituted for the sp_executesql. It looks like as soon as there is a lot of connections then it falls over. It works fine with 1 or 2 execute sql tasks but not any
    more than that.

  • SetQueryTimeout when calling stored procedures

    I cannot seem to get a query to timeout when calling a stored procedure in Oracle 8i. I have set the query timeout to 1 (sec.) and the query takes a few minutes to return. I get no exception and the query returns normally. When I use a prepared statement the query times out as expected and I get an exception. Should this work?

    Hi,
    The issue: I want a timeout on database locks, without doing
    a select for update wait x/ or nowait for every row concerned.
    Once the thread called java.net.SocketInputStream.socketread0() (unfortunatelly
    without a timeout), I currently only see 2 ways to get my thread out of there:
    - The lock is resolved (by the blocking instance) resp. the db server
    - By calling System.exit() (which I do not wish to do)
    So I want the Oracle Driver to call socketRead with a timeout, or if
    i can't do so. I'd like to set the timeout to the Socket myself.
    Or if I can't do so either, I plan to give a new SocketImplFactory
    to my client VM, which will implement a Socket with a fixed timeout
    on reads.
    Hint's (what I found out so far):
    - Calling interrupt on the invoking Thread wan't help
    - Calling statement.setQueryTimeout() wan't help, because the SqlException
    will be thrown at the time the statement leaves the socketRead(), which is
    when to lock is resolved, which is too late
    - The timeout used is defined by the used SocketImpl, which
    is by default the java.net.PlainSocketImpl, which is by default 0, which means
    'wait forever'
    - I did not found a way to set a timeout on the db server side, to resolve
    this problem
    Details:
    I am using Oracles JDBC Thin Driver 9i 9.2.0.3
    So far I did not specify any additional properties to the ConnectionFactory
    than user/pwd

Maybe you are looking for