Calling pl/sql function in controller

HI all
i have a problem in calling a pl/sql function in a controller..
the question is can we call a pl/sql function in a controller if so
will the code below works???
String invoice_id=getInvoiceId().toString();
Number Invoice_amount=getAmount();
DBTransaction txn = getDBTransaction();
String Filesql="BEGIN SELECT sum(AMOUNT_REMAINING) into :1 FROM ap_payment_schedules_all where invoice_id=:2;END;";
OracleCallableStatement Filecs=(OracleCallableStatement)txn.createCallableStatement(Filesql,1);
String AmountRemaining = "";
try{
Filecs.registerOutParameter(1, OracleTypes.VARCHAR, 0, 100);
Filecs.setString(2,invoice_id);
Filecs.execute();
AmountRemaining=Filecs.getString(1);
Filecs.close();
catch(SQLException sqle){
try { Filecs.close(); } catch (Exception e) {;}
throw OAException.wrapperException(sqle);
when i write the above code in a controller ..it is saying getDBTransaction not defined....
can u help me out in this...

String RuleName=pageContext.getParameter("CashRule");
String OrgId=pageContext.getParameter("OrgId");
String TransType=pageContext.getParameter("TransactionType");
OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
OADBTransaction txn = am.getOADBTransaction();
String Filesql="BEGIN select cle_f246_return_anal_mod_pkg.ret_anal_module(:2,:3,:4) into :1 from dual;END;";
OracleCallableStatement Filecs=(OracleCallableStatement)txn.createCallableStatement(Filesql,1);
String AnalyticalModule = "";
try{
Filecs.registerOutParameter(1, OracleTypes.VARCHAR, 0, 100);
Filecs.setString(2,TransType);
Filecs.setString(3,RuleName);
Filecs.setString(4,OrgId);
Filecs.execute();
AnalyticalModule=Filecs.getString(1);
Filecs.close();
catch(SQLException sqle){
try { Filecs.close(); } catch (Exception e) {;}
throw OAException.wrapperException(sqle);
this is the code i wrote in controller processformRequest...all the parameters are showiing correct values...but i am getting following error at Filecs.close();
org_id is of type Number but i am passing that as a string as setString accepts only strings...will that cause ne problem???
the error is:
oracle.apps.fnd.framework.OAException: java.sql.SQLException: ORA-01722: invalid number ORA-06512: at line 1 at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:896) at oracle.apps.cle.f246.webui.CashReportDetailsCO.processFormRequest(CashReportDetailsCO.java:88) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:813) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1178) at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1025) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:991) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:846) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1025) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:991) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:846) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363) at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2840) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1834) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:532) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:420) at OA.jspService(_OA.java:75) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:453) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:591) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:515) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368) at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448) at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:117) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:110) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239) at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34) at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880) at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303) at java.lang.Thread.run(Thread.java:595) ## Detail 0 ## java.sql.SQLException: ORA-01722: invalid number ORA-06512: at line 1 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288) at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743) at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:215) at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:967) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3327) at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3433) at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4394) at oracle.apps.cle.f246.webui.CashReportDetailsCO.processFormRequest(CashReportDetailsCO.java:82) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:813) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1178) at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1025) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:991) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:846) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1025) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:991) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:846) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363) at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2840) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1834) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:532) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:420) at OA.jspService(_OA.java:75) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:453) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:591) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:515) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368) at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448) at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:117) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:110) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239) at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34) at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880) at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303) at java.lang.Thread.run(Thread.java:595) java.sql.SQLException: ORA-01722: invalid number ORA-06512: at line 1 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288) at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743) at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:215) at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:967) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3327) at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3433) at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4394) at oracle.apps.cle.f246.webui.CashReportDetailsCO.processFormRequest(CashReportDetailsCO.java:82) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:813) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1178) at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1025) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:991) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:846) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1025) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:991) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:846) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363) at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2840) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1834) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:532) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:420) at OA.jspService(_OA.java:75) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:453) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:591) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:515) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368) at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448) at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:117) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:110) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239) at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34) at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880) at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303) at java.lang.Thread.run(Thread.java:595)

Similar Messages

  • How to call a SQL function from an XSL expression

    Hi
    In R12, in Payroll Deposit adivce/Check writer, We need to sort the earnings tag <AC_Earnings> in to two different categories as regular and other earnings. In the DB and form level of element defintiion we have a DFF which differentiates between the two kinds of earnings. But the seeded XML that is gerneated by the check writer does not have this field.
    The seeded template displays all the earnings in one column. How can we achieve this in the template without modifying the seeded XML.
    The one approach i have is to write a function and based on the return value sort the data. For this I need to know :
    1) How to call a SQL function from an XSL expression that is allowed in BI template.
    If anyone ahs faced similar requirements please share your approach.
    Thanks
    Srimathi

    Thank u..
    but i'd seen that link wen i searched in google..
    Is it possible without using any 3rd party JARs and all?
    and more importantly plz tell me what should be preferred way to call a javascript function?
    Do it using addLoadEvent() or Windows.Load etc
    OR
    Call it thru Xsl? (I donno how to do dis)
    Thanks in Advance..
    Edited by: ranjjose on Jun 3, 2008 8:21 AM

  • How to call PL/SQL function and pass parameter to ODI variable?

    Can I call PL/SQL function and assign a return value to an ODI variable? Also can I assign ODI variable to IN paramter and assign OUT parameter to ODI variable? What ODI doc has that information?
    Thanks

    Hi,
    Refer this http://odiexperts.com/how-to-use-plsql-procedures-and-functions-in-odi
    Thanks,
    Sutirtha

  • How to call pl/sql function from element values

    EBS 11.5.10.2
    XMLP 5.6.3
    Hello,
    I noticed that the output of the rdf-to-data template conversion process makes use of an undocumented feature of data templates, and I would like to get input from experts as to which situations this feature is usable.
    The closest thing I can find in the documentation is a sample in the user guide. There is a "General Ledger Journals Data Template Example" that has a <dataStructure> section that contains <element> nodes which are NOT children of a <group> node. I can't find any explanation of this in the user guide.
    I've noticed from converted templates that in these un-grouped elements you can make calls to PL/SQL functions in the "value" attribute, like this:
    <dataStructure>
      <group name="G_LINES" source="Q_MAIN">
        <element name="Line_Num"           value="Line_Num"/>
      </group>
      <element name="C_CALCULATED_VALUE" dataType="number" value="XX_CUSTOMPROCS.SOME_FUNCTION"/>
    </dataStructure>Has anyone had any success being able to call PL/SQL functions from grouped elements? Whenever I try, it doesn't seem to work.
    When I try something like this:
    <dataStructure>
      <group name="G_LINES" source="Q_MAIN">
        <element name="Line_Num"           value="Line_Num"/>
        <element name="some_calculation"   value="XX_CUSTOMPROCS.SOME_FUNCTION"/>
        <element name="some_calculation_b" value="XX_CUSTOMPROCS.SOME_FUNCTION_B(:Line_Num)"/>
      </group>
      <element name="C_CALCULATED_VALUE" dataType="number" value="XX_CUSTOMPROCS.SOME_FUNCTION"/>
    </dataStructure>The <SOME_CALCULATION/> and <SOME_CALCULATION_B/> nodes come out empty in the output data xml file, but <C_CALCULATED_VALUE> would have a value as desired.

    ah - perfect. That makes sense. Thank you for the response!
    But what about when we need to pass parameters to those functions whos values are the results of aggregate element values?
    This happens a lot in the converted data templates, where pl/sql package functions are meant to replace formula columns from the original Oracle Report. Take this example from the conversion of ARXAGMW.rdf (Aging Report, 7 Buckets):
    (note the function call in the value of "Set_Percent_Inv_Inv" is using aggregate results from subgroups)
      <group name="G_INV_INV" dataType="varchar2" source="Q_Invoice">
        <element name="Total_Inv_Inv_Amt" function="sum" dataType="number" value="G_Invoice.C_Amt_Due_Rem_Inv"/>
        <element name="Total_Inv_Inv_B0" function="sum" dataType="number" value="G_Invoice.C_Inv_B0"/>
        <element name="Total_Inv_Inv_B1" function="sum" dataType="number" value="G_Invoice.C_Inv_B1"/>
        <element name="Total_Inv_Inv_B2" function="sum" dataType="number" value="G_Invoice.C_Inv_B2"/>
        <element name="Total_Inv_Inv_B3" function="sum" dataType="number" value="G_Invoice.C_Inv_B3"/>
        <element name="Total_Inv_Inv_B4" function="sum" dataType="number" value="G_Invoice.C_Inv_B4"/>
        <element name="Total_Inv_Inv_B5" function="sum" dataType="number" value="G_Invoice.C_Inv_B5"/>
        <element name="Total_Inv_Inv_B6" function="sum" dataType="number" value="G_Invoice.C_Inv_B6"/>
        <element name="Set_Percent_Inv_Inv"  dataType="number"  value="XX_CUSTOMPROCS.XXC_ARXAGMW.set_percent_inv_invformula(:Total_Inv_Inv_Amt, :Total_Inv_Inv_B0, :Total_Inv_Inv_B1, :Total_Inv_Inv_B2, :Total_Inv_Inv_B3, :Total_Inv_Inv_B4, :Total_Inv_Inv_B5, :Total_Inv_Inv_B6)"/>
        <element name="Sum_Percent_B0_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B0_Inv_p"/>
        <element name="Sum_Percent_B1_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B1_Inv_p"/>
        <element name="Sum_Percent_B2_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B2_Inv_p"/>
        <element name="Sum_Percent_B3_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B3_Inv_p"/>
        <element name="Sum_Percent_B4_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B4_Inv_p"/>
        <element name="Sum_Percent_B5_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B5_Inv_p"/>
        <element name="Sum_Percent_B6_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B6_Inv_p"/>
        <group name="G_Cust_Inv" dataType="varchar2" source="Q_Invoice">
          <group name="G_Site_Inv" dataType="varchar2" source="Q_Invoice">
            <group name="G_1" dataType="varchar2" source="Q_Invoice">
              <group name="G_Invoice" dataType="varchar2" source="Q_Invoice">
                <element name="C_Amt_Due_Rem_Inv" dataType="number" value="C_Amt_Due_Rem_Inv"/>
                <element name="C_Inv_B0" dataType="number" value="C_Inv_B0"/>
                <element name="C_Inv_B1" dataType="number" value="C_Inv_B1"/>
                <element name="C_Inv_B2" dataType="number" value="C_Inv_B2"/>
                <element name="C_Inv_B3" dataType="number" value="C_Inv_B3"/>
                <element name="C_Inv_B4" dataType="number" value="C_Inv_B4"/>
                <element name="C_Inv_B5" dataType="number" value="C_Inv_B5"/>
                <element name="C_Inv_B6" dataType="number" value="C_Inv_B6"/>
              </group>
            </group>
          </group>
        </group>
      </group>
      ...All of these groups and sub-groups are based on one single query, so I am not sure how I would move the function call into the query without changing the results of the function.
    In the example above, elements Sum_Percent_B0_Inv through Sum_Percent_B6_Inv grab the results of the calculation done in set_percent_inv_invformula. Here is the essence of that function:
      sum_percent_b0_inv := ROUND ((total_inv_inv_b0 / total_inv_inv_amt) * 100, 2);
      sum_percent_b1_inv := ROUND ((total_inv_inv_b1 / total_inv_inv_amt) * 100, 2);
      sum_percent_b2_inv := ROUND ((total_inv_inv_b2 / total_inv_inv_amt) * 100, 2);
      sum_percent_b3_inv := ROUND ((total_inv_inv_b3 / total_inv_inv_amt) * 100, 2);
      sum_percent_b4_inv := ROUND ((total_inv_inv_b4 / total_inv_inv_amt) * 100, 2);
      sum_percent_b5_inv := ROUND ((total_inv_inv_b5 / total_inv_inv_amt) * 100, 2);
      sum_percent_b6_inv := ROUND ((total_inv_inv_b6 / total_inv_inv_amt) * 100, 2);The only solution I can think of is to have separate queries, one for each subgroup, that do the "sum" in sql; but that seems terribly inefficient.

  • Calling PL/SQL Functions And Open Oracle Reports From ADF Application

    Hi all,
    My company will convert some projects from Oracle forms to Oracle ADF so, we need to call the PL/SQL functions and open the Oracle Reports (which are already exist) from ADF Application.
    Thank You..
    Jack.N

    Hi Jack.N,
    calling PL/SQL Functions -----> http://sameh-nassar.blogspot.com/2010/01/create-plsql-function-and-call-it-from.html
    Open Oracle Reports ---------> http://radio-weblogs.com/0137094/2008/06/15.html
    You will find The Integration between ADF and other systems in ---> http://wiki.oracle.com/page/ADF+Integration
    Sameh Nassar

  • Calling PL/SQL functions in SQL

    Hi,
    I had a question on the behaviour of PL/SQL function when they are embedded in SQL queries.
    I have simple PL/SQl function:
    function get_city_id
    (vCUSTOMER_GROUP_ID IN NUMBER)
    RETURN VARCHAR2 AS
    vIDs VARCHAR2(1000);
    begin
    vIDs := '2,3';
    RETURN vIDs;
    end;
    I use an SQL query call this PL SQL function;
    select equipment_id from equipment where equipment_type_id in (get_city_id(0));
    When I run this query I get this error:
    ERROR at line 1:
    ORA-01722: invalid number
    I understand that the SQL compiler is complaining that get_city_id() function is not returning a number. but isn't the PL/SQL suppose to be replace with whatever string is returned from the function.
    This brings me to the second question: How can we return multiple values from a function to the SQL query, when the function is called in a SQL query. In my above explame, can the get_city_id() function return more than one city id and if yes, the how?
    Thanks for the help in advance
    regards
    Alankar

    How can we return multiple values from a function to the SQL query,Have it return a collection, e.g.
    CREATE OR REPLACE TYPE VARCHAR2_TT AS TABLE OF VARCHAR2(4000)
    CREATE OR REPLACE FUNCTION test_collection
        RETURN VARCHAR2_TT
    AS
    BEGIN
        RETURN VARCHAR2_TT(1,2,3);
    END;
    SELECT *
    FROM   employees
    WHERE  emp_id IN
           ( SELECT column_value
             FROM   TABLE(test_collection) );

  • Calling pl/sql function in CKM...pls help

    Hi,
    I have made a call to PL/SQL function in CKM customization. The code is :
    declare
    L_PMG_VALUE VARCHAR(3);
    begin
    L_PMG_VALUE:='PMG';
    VALIDATE_PMG_VALUE(L_PMG_VALUE);
    end;
    When i run it, it throws error which says:
    6550 : 65000 : java.sql.SQLException: ORA-06550: line 1, column 64:
    PLS-00221: 'VALIDATE_PMG_VALUE' is not a procedure or is undefined
    ORA-06550: line 1, column 64:
    PL/SQL: Statement ignored
    Function is compiled in the database and its working. I have selected the Technology as Oracle and correct Schema Name.
    Please help

    Hi,
    try the following way. i have not tried ....i think it helps you.
    In which schema you have created that procedure.
    Does the ODI user mantioned in topology have execute permissions on the procedure? if the ODI user have execute previlage on the procedure then in CKM customisation call the procedure like <schema>.<procedure>.
    Please let me know any issues.
    Thanks,

  • Call PL/SQL Function in ABAP over XI

    Hi all,
    is it possible to call a PL/SQL function in a BW-ABAP over XI and to get back the return value of the function. What proxy do i need and how should the coding look like if it is possible.
    I am thankful for every little help.
    Peter

    You can do a client proxy to JDBC scnario in XI. If you have a stored procedure on the Database side you can call it using SQL XML message type.
    Search for the JDBC receiver adapter documentation on help.sap.com
    VJ

  • How do I call pl/sql function from Toplink

    I can easily call a stored procedure from Toplink
    ====================================================
    public Collection executeSelectingStoredProcedure(StoredProcedureCall storedProcedureCall) throws DAOException
    Collection returnValue = null;
    Session session = null;
    session = this.getSession();
    returnValue = session.executeSelectingCall(storedProcedureCall);
    session.release();
    return returnValue;
    ====================================================
    The same does not work for pl/sql functions. Doesnt Toplink treat function calls as a callable statement as in JDBC?
    "select <function_name>(<arguments>) from dual" seems to be a work around. If this or using expressions is the only solution can someone please tell me the reasoning behind this shift.
    Regards
    Aamir Dehlavi

    I have the same problem.
    I have a PL/SQL function that returns a number. This function receives 2 parameters. I use StoredProcedureCall plus ValueReadQuery.
    Session aSession = SessionManager.getManager().getDefaultSession();
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("CIO_UTILS.COUNT_USER_ROLES_IN_MODULE");
    call.addNamedArgument("p_persid");
    call.addNamedArgument("p_module");
    call.addUnamedOutputArgument("rolesnum", Integer.class);
    ValueReadQuery query = new ValueReadQuery();
    //query.bindAllParameters();
    query.setCall(call);
    query.addArgument("p_persid");
    query.addArgument("p_module");
    Vector parameters = new Vector();
    parameters.addElement(persid);
    parameters.addElement(theModule);
    Integer rolesnum = (Integer) aSession.executeQuery(query,parameters);
    aSession.release();
    if(rolesnum.intValue()<=0)return false; else return true;
    However, I receive the following error:
    Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 96:
    PLS-00312: a positional parameter association may not follow a named association
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Error Code: 6550
    Call:BEGIN CIO_UTILS.COUNT_USER_ROLES_IN_MODULE(p_persid=>'SANCRA2791', p_module=>'PSL_MONITORING', ?); END;
         bind => [=> rolesnum]
    If comment the line
    "call.addUnamedOutputArgument("rolesnum", Integer.class);"
    Toplink is trating it as a procedure, and I also receive an error from PL/SQL.
    There should have to be a way of make it to receive the resoult somehow, but I do not know what.
    Thanks in advance.

  • How to call PL/SQL function from ODBC

    Greetings (and thanks for reading),
    I am using Oracle 9i (9.2.0.4) database, running on SUN [sparc] Solaris 9. I have created the following types:
    create or replace type NAME_VAL_TYP is object
    (NAME   varchar2(30)
    ,VALUE  varchar2(30))
    create or replace type PARMS_VARRAY_TYP is varray(10) of
    NAME_VAL_TYP
    /and the following PL/SQL function:
    function F0 (P_PARAMS  PARMS_VARRAY_TYP) return numberHow do I call this function from ODBC?
    Thanks (in advance),
    Avi.

    Sorry, this is not mapped in the ODBC driver--none of the object types are. The spec doesn't really account for them.

  • Error PLS-00306 during calling PL/SQL function from Java

    Hi all,
    I am facing a problem during call of oracle PL/SQL function from java using CallableStatement.
    I receive following error message.
    java.sql.SQLException: ORA-06550: line 1, column 13:
    PLS-00306: wrong number or types of arguments in call to 'EXPORT_HIST_ALARMS_FUNC'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    As per above error EXPORT_HIST_ALARMS_FUNC in oracle has this signature.
    CREATE OR REPLACE FUNCTION EXPORT_HIST_ALARMS_FUNC(startDateTime VARCHAR2, endDateTime VARCHAR2, meType VARCHAR2) RETURN VARCHAR2 IS
    END EXPORT_HIST_ALARMS_FUNC;
    Above function I have called following way in java.
    String sql = "begin ?:= EXPORT_HIST_ALARMS_FUNC(?, ?, ?); end;" ;
    CallableStatement cStatement = null;
    cStatement = connection.prepareCall(sql);
    cStatement.registerOutParameter(1,Types.VARCHAR);
    cStatement.setString(2,startDateTime);
    cStatement.setString(3,endDateTime);
    cStatement.setString(4,meType);
    cStatement.execute();
    msg = cStatement.getString(1);
    Actually above function requires three input parameters and one return parameter.
    During execution of above java code it throws SQLException and shows PLS-00306: wrong number or types of arguments in call to 'EXPORT_HIST_ALARMS_FUNC' error.
    I have run this function directly from oracle with three parameters and run successfully and finally it returns string.
    But I am unable to figure out why it doesn't run from above java code.
    Please help regarding this.
    Thanks.
    Regards,
    Shardul Banker

    Try this:
    String sql = "begin ?:= EXPORT_HIST_ALARMS_FUNC(?, ?, ?); end;" ;
    CallableStatement cStatement = null;
    cStatement = connection.prepareCall(sql);
    cStatement.registerOutParameter(1,Types.VARCHAR);
    cStatement.setString(1,startDateTime);
    cStatement.setString(2,endDateTime);
    cStatement.setString(3,meType);
    cStatement.execute();
    msg = cStatement.getString(1);Regards,
    Martijn Teigeler
    Edited by: mTeigeler on Oct 13, 2007 10:22 AM

  • Error on calling PL/SQL function

    Hi All,
    I have a code to call an existing PL/SQL function as following:
    PL/SQL function:
    FUNCTION pub_pkg.get_acc_rule_id (
    i_pub_id IN NUMBER,
    i_issue_id IN NUMBER,
    i_item_type IN VARCHAR,
    i_start_date IN DATE,
    i_end_date IN DATE
    RETURN NUMBER;
    Java Code:
    public Number getAccountingRuleId(Number pubId, Number issueId, String itemType,
    Date startDate, Date endDate)
    Number ruleId = new Number(-1);
    String sqlstatement =
    "BEGIN " + "\n"
    +" :1 := pub_pkg.get_acc_rule_id " + "\n"
    +" (p_param1 => :2" + "\n"
    +" ,p_param2 => :3" + "\n"
    +" ,p_param3 => :4" + "\n"
    +" ,p_param4 => :5" + "\n"
    +" ,p_param5 => :6" + "\n"
    +" );" + "\n"
    +"END; " + "\n";
    OADBTransaction trans = this.getOADBTransaction();
    OracleCallableStatement cStmt =
    (OracleCallableStatement) trans.createCallableStatement(sqlstatement,1);
    try
    cStmt.setNUMBER(2,pubId);
    cStmt.setNUMBER(3,issueId);
    cStmt.setString(4,itemType);
    cStmt.setDATE(5,startDate);
    cStmt.setDATE(6,endDate);
    cStmt.registerOutParameter(1, Types.INTEGER, 0, 10);
    cStmt.execute();
    ruleId = new Number(cStmt.getNUMBER(1));
    cStmt.close();
    catch (Exception ex)
    throw OAException.wrapperException(ex);
    finally
    try
    cStmt.close();;
    catch(Exception e)
    throw OAException.wrapperException(e);
    return ruleId;
    But I got error as following:
    java.sql.SQLException: ORA-06550: line 2, column 8:
    PLS-00306: wrong number or types of arguments in call to 'GET_ACC_RULE_ID'
    ORA-06550: line 2, column 2:
    PL/SQL: Statement ignored
    Can anyone help me to point out where is wrong with my code?
    Thanks & Regards,
    KJ

    That's a nice summary of this thread discussion, KJ. I hope other guys also start doing the same when their issue gets fixed.
    To add to above summary, if you want to call a procedure instead of a function, then you need to modify the line
    String sql = "begin :1 := package.function(:2,:3,:4); end;";
    to
    String sql = "begin package.procedure(:1,:2,:3); end;";
    In and out parameters can be as per the actual procedure.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • ADF 11g : Calling PL Sql Function

    Hi there..
    I am trying to call a PL/SQL Function from my application module in ADF 11g.
    The code looks something like this
        public void getName(int relationNumber) {
            DBTransaction tc = getDBTransaction();
            StringBuffer statement = new StringBuffer("begin ");
            statement.append("? := COMP_RLE.RLE_GET_NAME(?);");
            statement.append("end;");
            OracleCallableStatement cs = (OracleCallableStatement)tc.createCallableStatement(statement.toString(), 0);
            try {
                cs.registerOutParameter(1, Types.VARCHAR);
                cs.setInt(2, relationNumber);
                cs.execute();
                String retValue = cs.getString(1);
                System.out.println(retValue);
            } catch (SQLException e) {
                System.err.println("Something went wrong: " + e.getMessage());
        }When I run this in TOAD I get a result back in the form of a String.
    However when I run the code above in a Unit Test I get back "null".
    Does anybody know what I am doing wrong here?
    Hope someone can help me out here.
    Thanks in advance,
    Gideon

    I think it will probably work that way.. but the thing is.. I have been going over examples.. and they work with the CallableStatement.
    I just want to know how come this isn't working the way it should.
    Did I miss something?
    Examples that I was looking at are:
    <li>http://www.experts-exchange.com/Programming/Languages/Java/Q_24106340.html
    <li>http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/varray/index.html
    <li>Re: Returning a value from PL/SQL Function in ADF BC
    and
    <li>http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/bcadvgen.htm#sm0457
    They all work with the (Oracle)CallableStatement
    Edited by: Gideon Liem on Dec 4, 2009 12:27 AM

  • Calling pl/sql function from JSP to get data

    Hi,
    Ideally I want to pass the results of a PL/SQL function or procedure to my JSP page as a resultset or an array.
    I've manage to pass all the data as a string like this:
    // this works for a function that returns a string
    String str;
         CallableStatement cstmt = conn.prepareCall("begin ?:= temp_package.pass_string(); end;");
         cstmt.registerOutParameter(1,Types.VARCHAR);
         cstmt.execute();
         str = cstmt.getString(1);
    but if I try to pass a collection or Varray or Ref Cursor like this:
    // LETS TRY A PROCEDURE THAT ALTERS THE CONTENTS OF AN ARRAY
         CallableStatement cstmt = conn.prepareCall(" begin ?:= temp_package.pass_varray(); end;");
         cstmt.registerOutParameter(1,Types.ARRAY);
         cstmt.execute();
    or this:
    CallableStatement cstmt = conn.prepareCall(" begin ?:= temp_package.pass_cursor(); end;");
         cstmt.registerOutParameter(1,Types.CURSOR);
         cstmt.execute();
    or this:
    CallableStatement cstmt = conn.prepareCall(" begin ?:= temp_package.pass_cursor(); end;");
         cstmt.registerOutParameter(1,OracleTypes.CURSOR);
         cstmt.execute();
    I get an error saying that the type can�t be translated or something similar. It seems happy with VARCHAR but not with ARRAY,VARRAY or CURSOR.
    Can anyone help please as this has driven me crazy for hours surfing google and various forums. Thanks.

    Ok, I made the changes, but I'm now getting the following error:
    Error code = 1403
    Error message = ORA-01403: no data found
    ORA-06512: at "IOBOARD.GETSTATUS", line 6
    ORA-06512: at line 1
    The ora-01403 I don't understand because there is data for the name Kelly.Brace.
    ora-06512 error: at string line string.
    Here's what the code looks like after I made the changes:
    String sql = "{?=call ioboard.GetStatus(?)}";
          // create a Statement object
          myStatement = myConnection.prepareCall( sql );
          myStatement.setString( 1, "Kelly.Brace" );
          myStatement.registerOutParameter(2, java.sql.Types.LONGVARCHAR );
          // create a ResultSet object, and populate it with the
          // result of a SELECT statement
          ResultSet myResultSet = myStatement.executeQuery();
          // retrieve the row from the ResultSet using the
          // next() method
          myResultSet.next();
          // retrieve the user from the row in the ResultSet using the
          // getString() method
          String status = myResultSet.getString(1);
          System.out.println("Hello Kelly, your status is: " + status);
          // close this ResultSet object using the close() method
          myResultSet.close();Here's what the function looks like:
    CREATE OR REPLACE FUNCTION GetStatus( user_name in varchar2)
    RETURN VARCHAR2
    is
    v_status varchar2(10);
    BEGIN
    select iob_location into v_status
    from ioboard.iob_user
    where iob_username = user_name;
      RETURN( v_status);
    END;This works perfectly in the SQL Window:
    select iob_location
    from ioboard.iob_user
    where iob_username = 'Kelly.Brace';

  • Calling PL/SQL function from external Java class

    I was wondering if I was able to call a pl/sql function from an external java class? If so, would you be able to tell me briefly on how to go about it. I know I can call java methods that are internally stored in the db from pl/sql, but I was hoping I could call pl/sql from external java. Thanks,
    Kelly

    Ok, I made the changes, but I'm now getting the following error:
    Error code = 1403
    Error message = ORA-01403: no data found
    ORA-06512: at "IOBOARD.GETSTATUS", line 6
    ORA-06512: at line 1
    The ora-01403 I don't understand because there is data for the name Kelly.Brace.
    ora-06512 error: at string line string.
    Here's what the code looks like after I made the changes:
    String sql = "{?=call ioboard.GetStatus(?)}";
          // create a Statement object
          myStatement = myConnection.prepareCall( sql );
          myStatement.setString( 1, "Kelly.Brace" );
          myStatement.registerOutParameter(2, java.sql.Types.LONGVARCHAR );
          // create a ResultSet object, and populate it with the
          // result of a SELECT statement
          ResultSet myResultSet = myStatement.executeQuery();
          // retrieve the row from the ResultSet using the
          // next() method
          myResultSet.next();
          // retrieve the user from the row in the ResultSet using the
          // getString() method
          String status = myResultSet.getString(1);
          System.out.println("Hello Kelly, your status is: " + status);
          // close this ResultSet object using the close() method
          myResultSet.close();Here's what the function looks like:
    CREATE OR REPLACE FUNCTION GetStatus( user_name in varchar2)
    RETURN VARCHAR2
    is
    v_status varchar2(10);
    BEGIN
    select iob_location into v_status
    from ioboard.iob_user
    where iob_username = user_name;
      RETURN( v_status);
    END;This works perfectly in the SQL Window:
    select iob_location
    from ioboard.iob_user
    where iob_username = 'Kelly.Brace';

Maybe you are looking for

  • Phone states 'OTHER' storage is taking up most of the space on her iphone 4, how do i find it to make more space?

    Ok this may be a simple fix but I cant figure it out.  I am trying to give my wife more room on her phone to take photos of our new baby, so I synced her phone to iTunes it shows the bar of whats taking up space on it, and 3/4ths of the phone space i

  • Report on Linux

    I've just installed Oracle Oracle Developer Suite 10g (9.0.4) over RedHat and i'm doing this, 1) i run the script, $ORACLE_HOME/j2ee/DevSuit/startinst.sh 2) i created a report through the report builder wizard, when i use "run paper layout" the repor

  • Problem not able to start my MacBook Pro 15 again

    Recently i have updated my Mac OSX Leopard to Mac OSX Snow Leopard.Also i have changed the battery and i have format the hard drive completely when i install Mac OSX Snow Leopard. after the update i have start the mac two time and worked with office-

  • Are there any Beta users who didn't need to create a new library in 1.0?

    I know that I had to. A whole lot of flakiness disappeared when I did. I did the usual thing of exporting the Beta 4.1 XMP metadata and then re-importing all my files to a brand new native 1.0 library. Since then, I've had _no_ sorting problems and n

  • ACE: 4710 Policy-Map NAT

    Greets. I have a scenario where the rservers are located on two different VLAN's in One Arm Mode. My question is, am I able to assign two different NAT commands in my policy map (as written below)? Will the NAT command only kick off for the selected