Multithreading and stored procedures

Hi,
Does anyone know of any problems with calling a stored procedure that returns a reference cursor in a multithreading application? In other words, if I have multiple threads calling the same stored procedure is the reference cursor guarenteed to be unique to each thread/thread safe?
Thanks in advance,
Glenn

That should work fine and each call will get a separate ref cursor as long as the app is written properly and is managing it's threads anbd handles properly. Are you seeing some behaviour that suggests this is not the case?
Chris

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?

  • 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

  • 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

  • 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

  • Crystal Report and stored procedure calls

    Hi,
    1.   I am trying to access a Stored Procedure through Crystal Reports 2008. I have 3 Parameters in it and now I need the 2 Parameters from the stored Procedure to be given by User and the 3rd Parameter should be passed from the backend code. Please help me with the setps that would help me do this.
    2.I also have another Stored procedure where I have 3 parameters and in addition to that I should provide two other parameters for user to enter. Now the total number of parameters will be 5 Parameters. Can any one let me know how to implement all these parameters.
    3. In another Storedprocedure I have two Parameters which are discrete and multi select and both of them are cascaded. How do I implement those.
    Thanks
    Pradeep

    Please re-post if this is still an issue or purchase a case and have a dedicated support engineer work with you directly:
    http://store.businessobjects.com/store/bobjamer/DisplayProductByTypePage&parentCategoryID=&categoryID=11522300?resid=-Z5tUwoHAiwAAA8@NLgAAAAS&rests=1254701640551

  • Crystal Reports 9 and Stored Procedures using supplied parameters from user

    Hi,
    I have a Crystal Reports 9 report that prints and works fine.  It requests from the user 2 pieces of data which both are String data and not nulls.  I want to use the same report in a Visual Basic.Net 2003 program.  I can pull the report onto the form and it runs wonderfully.  I want to make it run programatically with out prompting for the user to key in the parameters.  I can supply them from an existing data file.  I have tried many things but have lacked the solution. 
    How can I pass the parameters from VB.Net 2003 to the stored procedure which runs the Crystal Report with in the VB.Net 2003 program.
    I appreciate all help and comments.
    Can this be done or do I need to just re-write the report in VB.Net 2003?
    Thanks,
    Norman

    Hi, Norman;
    It sure is possible to pass parameters to a Stored Procedure via our .NET SDK.
    Have a look at these samples:
    https://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/9043bbbc-ae66-2b10-ce96-b48f9e25a450
    There are samples showing passing parameters.
    Regards,
    Jonathan

  • EJB 3.0 Persistence API and Stored Procedures

    Does the EJB 3.0 Persistence API in any way prescribe or facilitate the use of Stored Procedure calls? Given the recent popularity of using (database) server APIs consisting of Stored Procedures that are addressed by ORM frameworks for performing the DML operations and of course the general usefulness of stored procedures for specific data related operations, there definitely is a need for clarity on using the straightforward Persistence operations in combination with calls to Stored Procedures. Can we use the Native Query for executing CallableStatements? Can we get to a Connection instance from the EntityManager? Can we easily use the results from a Stored Procedure invocation to refresh our Domain Objects - or is that all application logic in which the EntityManager cannot help us?
    If the spec does not help us at this point, do you know how TopLink will deal with this topic?
    Thanks for any help you can give me!
    Best regards,
    Lucas Jellema

    I'm am also interested in a response to this post. I've just upgraded to JDeveloper 10.1.3.1 and am interested in making calls to stored procedures.
    I've found examples of just creating my own session beans but it seems I would have to hard code the datasource name. Does anyone know if I can get around this using the entity manager supplied by the tool?
    thanks,
    Dan

  • Oracle 8i and stored procedures

    Hi I was hoping someone could point me to the right direction here.
    I have been using SQL server before and often use stored procedures. I understand that if you want to use stored procedures you will use the CallableStatement object and the prepareCall method of the Connection object like so:
    let's say my stored proc has 2 number parameters:
    CallableStatement cs = con.prepareCall( " { call <stored_proc_name> (?, ?) } );
    cs.getString(1, 1);
    cs.getString(2, 2);
    ResultSet rs = cs.executeQuery( );
    where con is my connection object that i used to connect to my database. So far am I right with the following code?
    But my problem is I have to use Oracle 8i. So what is the equivalent of SQL server stored procs in Oracle? Is it functions? Procedures? Or Java Stored Procedures? I have been reading all these sites and the forums for ideas but still haev no clue what approach I should take
    I have managed to connect to my db using the thin drivers and have successfully passed SQL statements. Although, I don't want to pass SQL statements, I want to use stored procedures. With SQL server I would create all my stored procedures and use my beans to call these stored procedures. So as a new user of Oracle 8i coming form SQL server, what approach do I use and how?
    Thanks in advance for all the help!

    Alright well looks like I'm stuck now.
    This seems more like a PL\SQL question though. If I want to return 2 or more values do I use function or a procedure? here's the code I made:
    CREATE OR REPLACE FUNCTION sign_in(username VARCHAR(20), userpassword VARCHAR(20))
    RETURN NUMBER IS id_num NUMBER, user_type VARCHAR(1);
    BEGIN
    SELECT * INTO id_num, user_type
    FROM ID_MASTER idm, PERSON prs
    WHERE USERNAME = username
    AND USER_PASSWORD = userpassword
    AND idm.ID_NUM = prs.ID_NUM;
    RETURN id_num, user_type;
    END;
    now according to Oracle this is an invalid function. But the error message doesn't say much. Basically I want to pass 2 parameters to use for a query and return 2 variables from the result of the query. Am I suppose to use a procedure?
    If I pass paramters do which string do I use to prepareCall: "{ ? = CALL sign_in (?, ?) }" or do I use the "{ CALL sign_in (?, ?) }"
    But my problem right now is how to make the proper stored procedure. I'd be very much obliged to anyone who can give a sample. Thank you all for your time!

  • Prepared Statement and Stored Procedure..

    I have about 200 SQL statement in my Java application
    I have two options either to convert into
    Stored procedures
    or to convert into prepared statement ....
    Please guide me which options should be best....
    I need difference
    1)in term of speed.
    2)Memory..
    Regards
    Mahesh
    Senior DBA

    club your statements on the basis of related functionalities and change it to stored procedures as it will redudce no. of calls to the database and will be faster to fetch data in one go and even reduce the memory requirements.

  • Prepared Statement and Stored Procedure difference?

    For SQL in my web applications I use PreparedStatement object alot in my JDBC working with Oracle 9i.
    I also heard the term Stored Procedure. What is the difference between Stored Procedure and Prepared Statement?

    I am new to java programming, can anybody explain
    what exactly precompiled means
    Thank you
    PalspaceWhat does you subject line have to do with your question?
    The difference between a stored proc and a prepared statement is mainly this.
    A stored proc is stored in the database server permanently and can be used and re-used from a different connections.
    A PreparedStatement is not valid across connections.
    Stored procs are almost always precompiled. (I am just hedging a bit here just in case but you can consider it 100%)
    PreparedStatements MAY be precompiled. Hard to say.
    Precompiling means at least one of and perhaps all of the following depending on the database
    - The parsing of the SQL statement
    - The checking of the SQL against the data dictionary to ensure that the tables and columns referenced actually exist
    - The preparation of a query plan
    Last but not least Stored procedures may (and often do) contain more than simple queries but are in fact relatively complex programs written in a DB specific language (an offshoot of SQL of some sort).

  • Collable statement and stored procedure problem

    Hi,
    I am using a collable statement to execute a stored procedure.
    The stored procedure is a bit complex since it uses a function to retrieve sequence nextval (newId),
    than insert a row and returns the newId.
    Anyway, I checked it with sql plus and it works, but when trying to execute it from my Java code, I get the following error message:
    java.sql.SQLException: ORA-06550: line 1, column 33:
    PLS-00103: Encountered the symbol ";" when expecting one of the following:
    . ( ) , * @ % & | = - + < / > at in mod not range rem => ..
    <an exponent (**)> <> or != or ~= >= <= <> and or like
    between is null is not || indicator is dangling
    The symbol ")" was substituted for ";" to continue.
    Anyone can help?
    Thanks,
    Michal

    My PL/SQL code:
    CREATE OR REPLACE FUNCTION getNotifSeq RETURN NUMBER
    IS
    newId NUMBER;
    BEGIN
         SELECT NOTIFICATION_SEQ.NEXTVAL INTO newId FROM DUAL;
    RETURN newId;
    END;
    run
    CREATE OR REPLACE PROCEDURE insertNotifMsg (
    sentBy IN VARCHAR,
    subject IN VARCHAR,
    msg IN VARCHAR,
    newId OUT NUMBER)
    IS
    BEGIN
    newId := getNotifSeq;
    INSERT INTO NOTIFICATIONS(NOTIF_ID,SENT_BY,SUBJECT,MSG)
    VALUES(newId,sentBy,subject,msg);
    END insertNotifMsg;
    run;
    My Java code to call the procedure:
    try
    conn = myDBconn.getConnection();
    CallableStatement callStmt = conn.prepareCall("{call insertNotifMsg(?,?,?,?}");
    callStmt.setString(1,notif.getSentBy());
    callStmt.setString(2,notif.getSubject());
    callStmt.setString(3,notif.getMsg());
    callStmt.registerOutParameter(4, Types.INTEGER);
    ResultSet rs = callStmt.executeQuery();
    if (!rs.next()) {
    throw new SQLException("ERROR: Notification was not inserted into database!");
    long newId = callStmt.getInt(4);
    callStmt.close();
    notif.setNotifId(newId);
    conn.commit();
    callStmt.close();
    finally
    myDBconn.closeConnection(conn);
    Thanks,
    Michal

  • Difference between Function and Stored Procedure

    Hi guys, i don't understand the exact difference between a function and a stored procedure. I did lot of google but still. Can somebody explain in simple words. Thanks.

    Hi,
    Here's an example of a user-defined function:
    CREATE OR REPLACE FUNCTION     factorial
    (      in_num       IN     PLS_INTEGER
    RETURN     PLS_INTEGER
    DETERMINISTIC
    IS
    BEGIN
         IF  in_num IS NULL
         THEN
              RETURN     NULL;
         ELSIF in_num <= 1
         THEN
              RETURN  1;
         ELSE
              RETURN  in_num * factorial (in_num - 1);
         END IF;
    END     factorial;
    SHOW ERRORSThis function retruns an integer. You can use the function (or, more properly, the integer that it returns) anywhere an integer expression is allowed.
    For example
    SELECT     ROWNUM
    ,     factorial (ROWNUM)     AS f
    ,     loc
    ,     SUBSTR ( loc
                , 1
                , factorial (ROWNUM)
                )          AS s
    FROM     scott.dept;Output:
    `   ROWNUM          F LOC           S
             1          1 NEW YORK      N
             2          2 DALLAS        DA
             3          6 CHICAGO       CHICAG
             4         24 BOSTON        BOSTON

  • Where are User Defined Functions and Stored Procedures kept in SQL Server?

    Hi,
    I have a growing list of Stored Procedures and User-Defined Functions in SQL Server, and would like to be able to list all my user SP and UDF easily.
    Is it possible to write a query to list all SP and UDF?
    I saw the following specimen code in an SQL book, but am not sure this is what I need because I could not make it work.
    SELECT *
        FROM INFORMATION_SCHEMA.ROUTINES
    WHERE SPECIFIC_SCHEMA = N'CustomerDetails'
        AND SPECIFIC_NAME = N'apf_CusBalances'
    I tried:
    SELECT *
        FROM INFORMATION_SCHEMA.ROUTINES
    but it does not work.
    Suppose all my SP are named following this pattern:
        dbo.usp_Storeproc1
    How would I modify the above code? or is there a better code?
    Thanks
    Leon Lai

    Hi ,
    try this to get list of all stored procedures:
    SELECT *
    FROM sys.procedures where name like 'dbo.usp%'
    Thanks,
    Neetu

  • "Log on failed" with ODBC and Stored Procedure

    I am in the process of porting our application from CR10 to CR.NET and am having some trouble setting the log on info.
    I have a report that was designed against a stored procedure and a development database.  The connection at design time is ODBC to a SQL Server.  At runtime I want to set the database and logon credentials to that of the production server, set the stored procedure parameters, and then display the report.  No matter what I do always get "Log on failed" error.
    After having considerable trouble with ApplyLogOnInfo on the tables where it seemed to not actually apply my changes, I finally found code which appeared to work elsewhere on this forum.  So this is the code that I have now, but the call to VerifyDatabase on the report always throws the Log on Failed exception:-
    void SomeClass::SetLogOnInfoForReportRecursively(ReportDocument^ ReportObj)
            CrystalDecisions::Shared::TableLogOnInfo^ l_pTableLogOnInfoToSet = gcnew CrystalDecisions::Shared::TableLogOnInfo();
            CrystalDecisions::Shared::ConnectionInfo^ l_pConnectionInfo = l_pTableLogOnInfoToSet->ConnectionInfo;
            l_pConnectionInfo->AllowCustomConnection = true;
            l_pConnectionInfo->ServerName = gcnew String(m_strServerName);
            l_pConnectionInfo->DatabaseName = gcnew String(m_strDatabaseName);
            l_pConnectionInfo->UserID = gcnew String(m_strUserID);
            l_pConnectionInfo->Password = gcnew String(m_strPassword);
            DbConnectionAttributes^ l_pConnectionAttributes = gcnew DbConnectionAttributes();
            l_pConnectionAttributes->Collection->Set("Database DLL", "crdb_odbc.dll");
            l_pConnectionAttributes->Collection->Set("QE_DatabaseName", String::Empty);
            l_pConnectionAttributes->Collection->Set("QE_DatabaseType", "ODBC (RDO)");
            l_pConnectionAttributes->Collection->Set("QE_SQLDB", true);
            l_pConnectionAttributes->Collection->Set("SSO Enabled", false);
            l_pConnectionInfo->Attributes = l_pConnectionAttributes;
            //main connection
            ReportObj->SetDatabaseLogon(l_pConnectionInfo->UserID, l_pConnectionInfo->Password, l_pConnectionInfo->ServerName, l_pConnectionInfo->DatabaseName, false);
            //other connections
            for each(CrystalDecisions::Shared::IConnectionInfo^ pConnection in ReportObj->DataSourceConnections)
                pConnection->SetConnection(l_pConnectionInfo->ServerName, l_pConnectionInfo->DatabaseName, l_pConnectionInfo->UserID, l_pConnectionInfo->Password);
                //pConnection->SetLogon(l_pConnectionInfo->UserID, l_pConnectionInfo->Password);
                pConnection->LogonProperties->Set("Data Source", l_pConnectionInfo->ServerName);
                pConnection->LogonProperties->Set("Initial Catalog", l_pConnectionInfo->DatabaseName);
            // Now we need to set the log on info for any subreports otherwise they will always look for the datasource they were set up with.
            if (!ReportObj->IsSubreport)
            for each (ReportDocument^ l_pSubReport in ReportObj->Subreports)
                 SetLogOnInfoForReportRecursively(l_pSubReport);
            for each (CrystalDecisions::CrystalReports::Engine::Table^ l_pTable in ReportObj->Database->Tables)
                TableLogOnInfo^ l_pCurentTableLogOnInfo = l_pTable->LogOnInfo;
                l_pCurentTableLogOnInfo->ConnectionInfo = l_pTableLogOnInfoToSet->ConnectionInfo;
                l_pTable->ApplyLogOnInfo(l_pCurentTableLogOnInfo);
                if (!l_pTable->TestConnectivity())
                   // handle error situation
    ... then the calling code
    SetLogOnInfoForReportRecursively( pReportObj );
    // l_Parameters contains the stored proc param name/values pairs to set at runtime
    for each (KeyValuePair<String^, String^> param in l_Parameters)
            pReportObj->SetParameterValue(param.Key, param.Value);
    pReportObj->VerifyDatabase();
    which then fails.  Can anyone see what I am doing wrong?
    Thanks

    Hi Paul,
    Are you using CR for VS SP 13? If not you can get it here:
    SAP Crystal Reports, developer version for Microsoft Visual Studio: Updates & Runtime Downloads
    And MS SQL Server does not use a blank database name:
    l_pConnectionAttributes->Collection->Set("QE_DatabaseName", String::Empty);
    Set it to a database used in the report.
    And you don't need to call .Verify, unless the reports are not up to date, which is not recommended, you should be using ReplaceConnection. ( Search for this, KBA's and posts on how to use it )
    So rather that call .Verify try CRTable.TestConnectivity();
    If that fails then you know your log on failed also.
    Curious, if you try to preview the report it should prompt for log on info, if the Server and Database names are grayed out ( not editable ) then CR can't find the client either.
    And MS recommends using the client that matches the version of SQL Server, So if 2005 and less you can use the MDAC SQL Client driver, for MS 2008 then use the SQL Native 10 or above.
    Don

Maybe you are looking for

  • Unlimited data plan gone...please advise!!!

    I have been a VZW customer for two years now, and been using smartphones since July 2010. Therefore I have always had an unlimited data package and have thus been grandfathered in now that these new limited packages are available. Last Saturday, I or

  • Problem in loading Ntriple to Oracle

    Hello, Can some one please point what could be wrong in loading of Data in Ntriple format using the Code provide by Oracle to convert RDF data in N-Triple format to Oracle's RDF storage type, SDO_RDF_TRIPLE_S in Oracle10g R2. called TestNTriple2NDM.j

  • InternalError: The current process uses to much Window Managerobjects!

    Hi, I'm not quite sure in which sub-forum this belongs to. So I posted it here. I'm only having the German error message. The subject is a short translation of the message. "java.lang.InternalError: Der aktuelle Prozess verwendet alle Handles der zul

  • Problem in SSO configuration

    Hi, ISSUE 1 Description    When a user is logged on to the SAP Portal and presses the logoff button he/she is forwarded to the Anonymous/Guest page of the SAP Portal. This is by design and is OK. it was discovered that the first time a person pressed

  • How to avoid purchase req and stock transport order to take part in MRP.

    Please suggest how to avoid purchase req and stock transport order to take part in MRP.