How to call PL/SQL procedure from Jdeveloper

hai
i am using JDeveloper 10g version 10.1.3. i am working on Web Application[JSF,ADF BC]. i had commit button in one form. when i click that button a PL/SQL procedure can be invoked.( the procedure is to check for primary key)
how to do this
thanks in advance
C.R

There are already some threads about calling PL/SQL from Java. E.g.: adf bc jsf application and database stored procedure
Ronald

Similar Messages

  • Call PL/SQL procedure from JDeveloper

    Is that possible to call PL/SQL procedure from JDeveloper?
    What's the setup and coding requirements?
    Thanks for any input.

    This is the Code:_
    package oracle.e1.bssv.J594101;
    import java.util.Hashtable;
    import javax.naming.NamingException;
    import java.sql.Connection;
    import java.sql.SQLException;
    import javax.naming.InitialContext;
    import javax.naming.Context;
    import javax.naming.NamingEnumeration;
    import javax.sql.*;
    public class CallSQLProcedure3 {
    public CallSQLProcedure3() {
    public static void main(String[] args) {
    // try {
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "com.evermind.server.rmi.RMIInitialContextFactory");
    // env.put(Context.PROVIDER_URL,
    "ormi\\://localhost\\:23891/current-workspace-app");
    // env.put(Context.PROVIDER_URL,
    "ormi://localhost:23791/E1Services-LOCALDEV");
    env.put(Context.PROVIDER_URL, "ormi://localhost:23791");
    // env.put(Context.PROVIDER_URL,
    "ormi://localhost\\:23791/current-workspace-app");
    env.put(Context.SECURITY_PRINCIPAL, "oc4jadmin");
    env.put(Context.SECURITY_CREDENTIALS, "welcome");
    Context ctx3 = null;
    try {
    ctx3 = new InitialContext(env);
    } catch (NamingException e) {
    // TODO
    // Context ctx = null;
    try {
    // NamingEnumeration n= ctx3.list("ormi://localhost:23791");
    // System.out.println(n.hasMore());
    Hashtable h = ctx3.getEnvironment();
    // while(h.elements().hasMoreElements())
    System.out.println(" name " +
    h.elements().nextElement().toString());
    // InitialContext initialContext = new InitialContext();
    // javax.sql.DataSource ds =
    (javax.sql.DataSource)initialContext.lookup("jdbc/DBConnection1DS");
    // javax.sql.DataSource ds =
    (javax.sql.DataSource)ctx3.lookup("jdbc/DBConnection1DS");
    // javax.sql.DataSource ds =
    (javax.sql.DataSource)ctx3.lookup("jdbc/OracleDS");
    javax.sql.DataSource ds =
    (javax.sql.DataSource)ctx3.lookup("jdbc/DBConnection1DS");
    java.sql.Connection conn;
    try {
    conn = ds.getConnection();
    } catch (SQLException e) {
    // TODO
    // ctx = new InitialContext();
    Context initCtx = new InitialContext();
    Context envCtx = (Context)initCtx.lookup("java:comp/env");
    // Hashtable h = envCtx.getEnvironment();
    // while(h.elements().hasMoreElements())
    // System.out.println(" name " + h.elements().nextElement().toString());
    DataSource ds2 = (DataSource)envCtx.lookup("DBConnection1DS");
    // Connection conn;
    // try {
    // conn = ds.getConnection();
    // } catch (SQLException e) {
    // TODO
    // } catch (NamingException e) {
    // // TODO
    // DataSource dataSource = null;
    // } catch (NamingException ne) {
    // try {
    // dataSource = (DataSource)ctx.lookup("jdbc/DBConnection1DS");
    // } catch (NamingException e) {
    // e.printStackTrace();
    // String myError1="Error occured with Initial Context";
    Connection conn2;
    try {
    conn2 = ds2.getConnection();
    // conn = ds.getConnection();
    } catch (SQLException e) {
    // TODO
    } catch (NamingException e) {
    // TODO
    e.printStackTrace();
    System.out.println("Error looking up " +e);
    This is the Error:_
    error message from executing a code ds.getConnection();
    D:\oracle\jdevstudio10133\jdk\bin\javaw.exe -client -classpath
    D:\e812\ETDV812\Java\classes;D:\oracle\jdevstudio10133\webservices\lib\jaxrpc-api.jar;D:\oracle\jdevstudio10133\webservices\lib\wsclient.jar;D:\oracle\jdevstudio10133\webservices\lib\wsserver.jar;D:\oracle\jdevstudio10133\webservices\lib\wssecurity.jar;D:\oracle\jdevstudio10133\webservices\lib\wsdl.jar;D:\oracle\jdevstudio10133\webservices\lib\orasaaj.jar;D:\oracle\jdevstudio10133\webservices\lib\saaj-api.jar;D:\oracle\jdevstudio10133\webservices\lib\orawsdl.jar;D:\oracle\jdevstudio10133\webservices\lib\orawsrm.jar;D:\oracle\jdevstudio10133\webservices\lib\jaxr_api.jar;D:\oracle\jdevstudio10133\webservices\lib\orajaxr.jar;D:\oracle\jdevstudio10133\webservices\lib\relaxngDatatype.jar;D:\oracle\jdevstudio10133\webservices\lib\jaxb-impl.jar;D:\oracle\jdevstudio10133\webservices\lib\jaxb-libs.jar;D:\oracle\jdevstudio10133\webservices\lib\xsdlib.jar;D:\oracle\jdevstudio10133\webservices\lib\mdds.jar;D:\oracle\jdevstudio10133\jlib\jaxen.jar;D:\oracle\jdevstudio10133\jlib\oraclepki!
    .jar;D:\oracle\jdevstudio10133\jlib\ojpse.jar;D:\oracle\jdevstudio10133\jlib\osdt_core.jar;D:\oracle\jdevstudio10133\jlib\osdt_cert.jar;D:\oracle\jdevstudio10133\jlib\osdt_xmlsec.jar;D:\oracle\jdevstudio10133\jlib\osdt_wss.jar;D:\oracle\jdevstudio10133\jlib\osdt_saml.jar;D:\oracle\jdevstudio10133\jlib\repository.jar;D:\oracle\jdevstudio10133\jlib\ojmisc.jar;D:\oracle\jdevstudio10133\j2ee\home\lib\http_client.jar;D:\oracle\jdevstudio10133\j2ee\home\jazncore.jar;D:\oracle\jdevstudio10133\j2ee\home\oc4jclient.jar;D:\oracle\jdevstudio10133\rdbms\jlib\xdb.jar;D:\oracle\jdevstudio10133\diagnostics\lib\ojdl2.jar;D:\e812\ETDV812\ini\sbf;D:\e812\System\Classes\Base_JAR.jar;D:\e812\System\Classes\BizLogicContainer_JAR.jar;D:\e812\System\Classes\BusinessLogicServices_JAR.jar;D:\e812\System\Classes\Connector.jar;D:\e812\System\Classes\EventProcessor_JAR.jar;D:\e812\System\Classes\Generator_JAR.jar;D:\e812\System\Classes\JdbjBase_JAR.jar;D:\e812\System\Classes\JdbjInterfaces_JAR.jar;D:\!
    e812\System\Classes\JdeNet_JAR.jar;D:\e812\System\Classes\Maf2Base_JAR
    .jar;D:\e812\System\Classes\mafsecurity.jar;D:\e812\System\Classes\Metadata.jar;D:\e812\System\Classes\MetadataInterface.jar;D:\e812\System\Classes\PMApi_JAR.jar;D:\e812\System\Classes\SBFFoundation_JAR.jar;D:\e812\System\Classes\Spec_JAR.jar;D:\e812\System\Classes\System_JAR.jar;D:\e812\System\Classes\SystemInterfaces_JAR.jar;D:\e812\System\Classes\castor.jar;D:\e812\System\Classes\log4j.jar;D:\e812\System\Classes\xerces.jar;D:\e812\System\Classes\xml-apis.jar;D:\e812\System\Classes\Rijndael.jar;D:\e812\System\Classes\ManagementAgent_JAR.jar;D:\e812\System\Classes\commons-logging.jar;D:\e812\System\Classes\commons-codec-1.3.jar;D:\e812\System\Classes\commons-httpclient-3.0.jar;D:\e812\System\Classes\jmxremote.jar;D:\e812\System\Classes\jmxremote_optional.jar;D:\e812\System\Classes\jmxri.jar;D:\e812\System\Classes\rmissl.jar;D:\e812\misc\ojdbc5.jar;D:\e812\misc\mssqlserver.jar;D:\e812\misc\msutil.jar;D:\e812\misc\msbase.jar;D:\e812\misc\db2java.zip;D:\e812\misc\jt400.jar;D:\!
    e812\misc\sqljdbc.jar;D:\oracle\jdevstudio10133\lib\xmlparserv2.jar;D:\oracle\jdevstudio10133\lib\xml.jar
    oracle.e1.bssv.J594101.CallSQLProcedure3
    name com.evermind.server.rmi.RMIInitialContextFactory
    Exception in thread "main" java.lang.NoClassDefFoundError:
    org/apache/bcel/generic/Instruction
    at
    oracle.oc4j.sql.spi.ConnectionHandle.getConnectionHandle(ConnectionHandle.java:725)
    at
    oracle.oc4j.sql.spi.ManagedConnectionImpl.getConnectionHandle(ManagedConnectionImpl.java:273)
    at
    oracle.oc4j.sql.spi.ManagedConnectionImpl.getConnection(ManagedConnectionImpl.java:255)
    at
    com.evermind.server.connector.ApplicationConnectionManager.createConnectionHandle(ApplicationConnectionManager.java:1786)
    at
    com.evermind.server.connector.ApplicationConnectionManager.allocateConnection(ApplicationConnectionManager.java:1472)
    at
    oracle.j2ee.connector.OracleConnectionManager.unprivileged_allocateConnection(OracleConnectionManager.java:238)
    at
    oracle.j2ee.connector.OracleConnectionManager.allocateConnection(OracleConnectionManager.java:192)
    at
    oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:272)
    at
    oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:200)
    at
    oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:142)
    at
    oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:127)
    at
    oracle.e1.bssv.J594101.CallSQLProcedure3.main(CallSQLProcedure3.java:70)
    Process exited with exit code 1.

  • How to call Pl/sql procedure from form ?

    Hi all,
    I need to call a procedure from form after the user has pressed the button to invoke the sql procedure, can anyone please advise me on how to do it ?
    Thanks.
    Lim

    Hi,
    Thanks for your reply.
    yes, I have include in when-button-pressed trigger as
    AIC_PROC_AR_CCID_UPD;
    Below is my procedure :-
    CREATE OR REPLACE PROCEDURE AIC_PROC_AR_CCID_UPD(errbuf out Varchar2,
              retcode out Number ) is
    VAR_BUF VARCHAR2(240);
    Cursor C1 is
    SELECT CONCATENATED_SEGMENTS ACCT,
    SEGMENT5 SEG5
    FROM AIC_GL_COA AGC
    WHERE AGC.CODE_COMBINATION_ID IS NULL;
    Rec1 C1%RowType;
    BEGIN
    FOR Rec1 IN C1 LOOP
         BEGIN
         UPDATE AIC_GL_COA A SET ( DESCRIPTION, CODE_COMBINATION_ID, SEGMENT5 )=
         ( SELECT FFVT.DESCRIPTION, GLA.CODE_COMBINATION_ID, GLA.SEGMENT5
         FROM GL_CODE_COMBINATIONS_KFV GLA,
         FND_FLEX_VALUES_TL FFVT,
         FND_FLEX_VALUES FFV
         WHERE GLA.CONCATENATED_SEGMENTS = REC1.ACCT
         AND FFV.FLEX_VALUE = REC1.SEG5
         AND FFV.FLEX_VALUE_ID = FFVT.FLEX_VALUE_ID
         AND FFV.FLEX_VALUE_SET_ID = 1002673 )
         WHERE A.SEGMENT5 = REC1.SEG5 ;
         EXCEPTION
         WHEN NO_DATA_FOUND THEN
         FND_FILE.PUT_LINE(FND_FILE.OUTPUT, 'NO RECORD UPDATE !!');     
         END;
    END LOOP;
    COMMIT;
    RETURN;
    END;
    However, when I try to compile it, error prompt :-
    Error 306 at line 1, column 1
    wrong number or types of arguments in call to 'AIC_PROC_AR_CCID_UPD'
    Error 0 at line 1, column 1
    statement ignored.
    By the way, my form 6i is running at client site and connection to procedure in unix server. Will this is ok ?
    Thanks
    Rgds
    Lim

  • How to call PL/SQL procedure from PERL

    I have a requirement to create a PERL wrapper for few PL/SQL procedure.
    Can any one tell me how to call the procedures from PERL ?
    Thanks in advance.
    ....srini

    A quick Google search shows:
    http://www.saturn5.com/~jwb/dbi-examples.html#ora_sp

  • How to Call pl/sql procedure from shell script

    Hi,
    I've one procedure which takes the xml file name as input from one of the remote location. Every day users keep one file in that location.
    For eg:
    ACS_RPO00020110316_20110316220956.xml
    ACS_RPO00020110319_20110319220956.xml
    I need to read the latest file in this case. In this case second one is the latest file.
    Can some body please help me how to write script to pass parameter to that procedure that via shell program and execute that.
    Thanks in advance.
    Regards
    Nagendra

    hi
    I executed the below mentioned steps, but I did not get any result:
    I am pasting all the steps which I did
    -bash-3.2$ ls -lrt
    total 316
    -rw-r--r-- 1 oratest dba 4884 Mar 16 03:56 XXGEBIZ_EPO160320110356.xml
    -rw-r--r-- 1 oratest dba 4884 Mar 16 03:57 XXGEBIZ_EPO160320110357.xml
    -rw-r--r-- 1 oratest dba 4884 Mar 16 17:52 GEBIZ_ACS_RPO00020110316_20110316175216.xml
    -rw-r--r-- 1 oratest dba 38 Mar 16 18:18 GEBIZ_ACS_RPO00020110316_20110316181858.NODATA
    -rw-r--r-- 1 oratest dba 63 Mar 16 22:09 GEBIZ_ACS_RPO00020110316_20110316220956.xml
    -rw-r--r-- 1 oratest dba 9716 Mar 16 22:14 GEBIZ_ACS_RPO00020110316_20110316221429.xml
    -rw-r--r-- 1 oratest dba 12988 Mar 17 01:42 GEBIZ_POC_RPO000EPO20110317_20110317014247.xml
    -rw-r--r-- 1 oratest dba 13103 Mar 17 01:53 GEBIZ_POC_RPO000EPO20110317_20110317015356.xml
    -rw-r--r-- 1 oratest dba 38 Mar 17 01:57 GEBIZ_POC_RPO00020110317_20110317015712.NODATA
    -rw-r--r-- 1 oratest dba 38 Mar 17 18:44 GEBIZ_ACS_RPO00020110317_20110317184423.NODATA
    -rw-r--r-- 1 oratest dba 12326 Mar 17 18:46 GEBIZ_ACS_RPO00020110317_20110317184603.xml
    -rw-r--r-- 1 oratest dba 67578 Mar 18 01:32 GEBIZ_POF_RPO000EPO20110318_20110318013232.xml
    -rw-r--r-- 1 oratest dba 14484 Mar 18 20:27 GEBIZ_POF_RPO000EPO20110318_20110318202754.xml
    -rw-r--r-- 1 oratest dba 47653 Mar 19 01:29 GEBIZ_PYS_RPO00020110319_20110319012953.xml
    -rw-r--r-- 1 oratest dba 937 Mar 21 09:34 GEBIZ_SUPP.xml
    -rw-r--r-- 1 oratest dba 947 Mar 21 09:35 GEBIZ_SUPP1.xml
    -rwxrwxrwx 1 oratest dba 121 Mar 21 17:43 test
    -bash-3.2$
    -bash-3.2$ cat > test
    ls -lrt | tail -1
    filelist = $(ls GEBIZ_SUPP*.xml)
    for file in $filelist ; do
    echo "inside loop"
    file = $file
    echo "file name " $file
    done
    XGBZ_SUPP_MAST_XMLTAG_PROC $file
    -bash-3.2$ chmod 777 test
    -bash-3.2$ ./test
    -bash: ./test: Text file busy
    -bash-3.2$
    Initially I listed down all the files, in a sample file I've written the steps. But nothing is executed.
    One thing I want to ask here XGBZ_SUPP_MAST_XMLTAG_PROC is my procedure. I think I need to invoke sqlplus in the so as to execute my pl/sql script.
    Gurus, please let me know how to write them.
    Regards
    Nagendra

  • Calling PL/Sql Procedure in Jdeveloper 11g

    Hi All,
    How to call PL/Sql Procedure in Jdeveloper 11G. Here my procedure prints some statements in procedure using "dbms.output.put_line" . Here I want to call that procedure using button (or) ImageLink and print all the statements in pl/sql procedure in Jdeveloper Environment.
    Can anybody help on this .
    Thanks in Advance .
    Edited by: u41411 on Sep 28, 2009 7:18 AM

    Her is what I use to call Oracle DB procedure:
    procCall = "BEGIN " + YOUR_PROC_NAME + "(); END;";
    returned = am.getTransaction().executeCommand(procCall);
    where am is my application Module
    Hope this help.
    Jack

  • How to call pl/sql procedure/function from XML

    Hi,
    I have a requirement to call pl/sql function/procedure from the RTF template. How can I do this?

    Hi,
    I have got the same requirement. We need to call the store PL/SQL procedure from the XML template to generate the fixedwidth files. Could you tell me if you are able to call PL/SQL procedure from XML template?
    Thanks,
    Ram

  • Calling PL/SQL procedures from a Windows CMD script

    Hello,
    I am writing a Windows CMD script. From this script I want to call procedures from a PL/SQL package which selects, inserts or deletes rows from the database.
    How do I go about logging into the database from the cmd script and calling PL/SQL procedures from there?
    Does anyone have any examples of such scripts? Thanks in advance.

    No, it is not a job that needs to be scheduled.
    The script will be used when needed to select info from a certain table and also to insert or delete certain info into/from this table (so, it is just simple sql statements which I have put into a package), but I'm sure how to log into the database and execute the procedures from this package in a cmd script.

  • Calling PL/SQL Procedures from Java

    Hello,
    I want to know, if it is possible to call PL/SQL Procedures from
    SQLJ(which uses htp.print from the Package web toolkit ).
    Though, it is possible to call normal procedures but if I want
    to call PL/SQL procedures with htp.print then I get I error.
    For example:
    #sql{Call html_test()};
    Can you give me a advice?
    Your help is much appreciated!
    M|ller

    Oracle's htp packages are develop to be work with
    mod_plsql/OAS/OWS webserver.
    If you are trying to use htp packages first need to instanciate
    some enviroment vars for htp packages, for example first you has
    to call to owa.initialize procedure, populate owa.cgi array and
    so on.
    If you need more information about how this toolkit works you
    could get the source of DB Prism at
    http://www.plenix.com/dbprism/ this open source framework
    includes backward compatibility with mod_plsql application and
    then includes settings of this values from Java code.
    Best regards, Marcelo.

  • 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 a stored procedure from WorkShop

    Hello Everyone .. I'm quite new with WebLogic 8.1 & WorkShop, so please bare with
    me .. Today I'm simply trying to find out how to call a stored procedure from
    within workshop, using any of the DB Controls .. I see workshop provides a way
    create a Java Control, Rowset Control, but it wont easily allow for a stored procedured
    to be entered in place of the inline query .. Perhaps I've over looked it. Any
    advise on the best way to tackle this task will be appreciated.
    Atahualpa

    Atahualpa--
    Maybe this will help:
    http://edocs.bea.com/workshop/docs81/doc/en/workshop/guide/controls/database/conStoredProcedures.html
    Eddie
    Atahualpa wrote:
    Hello Everyone .. I'm quite new with WebLogic 8.1 & WorkShop, so please bare with
    me .. Today I'm simply trying to find out how to call a stored procedure from
    within workshop, using any of the DB Controls .. I see workshop provides a way
    create a Java Control, Rowset Control, but it wont easily allow for a stored procedured
    to be entered in place of the inline query .. Perhaps I've over looked it. Any
    advise on the best way to tackle this task will be appreciated.
    Atahualpa

  • Calling pl/sql procedure from jsp

    Hi:
    Could anyone tell me how to call a pl/sql procedure from a jsp page by passing args or without . Is there any specific method to use.
    Thanks.

    Like from any other java code
    <%
    Connection conn = DriverManager.getConnection(...);
    CallableStatement cs = conn.prepareCall("BEGIN myprocedure(); END;");
    cs.execute();
    %>
    With params:
    <%
    Connection conn = DriverManager.getConnection(...);
    CallableStatement cs = conn.prepareCall("BEGIN myprocedure(?, ?); END;");
    cs.setInt(1, 10);
    cs.setString(2,"aaaa");
    cs.execute();
    %>
    to return some value as out param
    Connection conn = DriverManager.getConnection(...);
    CallableStatement cs = conn.prepareCall("BEGIN myprocedure(?, ?, 3); END;");
    cs.setInt(1, 10);
    cs.setString(2,"aaaa");
    cs.registerOutParameter(3, Types.VARCHAR);
    cs.execute();
    out.println("Returned value: " + cs.getString(3));
    %>
    Of course after all close statement and connection to free resources.

  • Jdbc NullPointerException calling pl/sql procedure from java

    Hi.
    Getting the following exception calling a plsql procedure from jdbc.
    - Jdbc version is 10.2.0.2, but it also happens running several other variants, including 10.1.0.5.0.
    - Application is running in Weblogic 8.1.3 (8.1 SP 3).
    The procedure call itself has 2 in/out parameters which are tables (actually just 1 dimensional arrays), which I'm suspecting has something to do with the problem. I can successfully call this procedure using a plsql developer tool with the same bind parameters.
    Any ideas?
    Exception encountered while executing PL/SQL procedure MVT_Web_Inquiry.ShowInquiry:
    java.lang.NullPointerException at oracle.jdbc.driver.T4CTTIiov.processRXD([Loracle.jdbc.driver.Accessor;I[B[C[SILoracle.jdbc.driver.DBConversion;[B[B[[Ljava.io.InputStream;[[[B[[Loracle.jdbc.oracore.OracleTypeADT;Loracle.jdbc.driver.OracleStatement;[B[C[S)[Loracle.jdbc.driver.Accessor;(T4CTTIiov.java:139)
    at oracle.jdbc.driver.T4C8Oall.receive()V(T4C8Oall.java:521)
    at oracle.jdbc.driver.T4CCallableStatement.doOall8(ZZZZ)V(T4CCallableStatement.java:215)
    at oracle.jdbc.driver.T4CCallableStatement.executeForRows(Z)V(T4CCallableStatement.java:1119)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout()V(OracleStatement.java:1278)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal()I(OraclePreparedStatement.java:3446)
    at oracle.jdbc.driver.OraclePreparedStatement.execute()Z(OraclePreparedStatement.java:3552)
    at oracle.jdbc.driver.OracleCallableStatement.execute()Z(OracleCallableStatement.java:5261)
    at weblogic.jdbc.wrapper.PreparedStatement.execute()Z(PreparedStatement.java:70)
    at
    [snip]

    OK... I figured it out.
    Apparently, this error happens when you forget to register the output part of an in/out parameter. I would have hoped for better error messaging, but oh well.
    -ed-

  • How to Call PL/SQL Procedure

    Hi
    I am trying to call PL/SQL Procedure in OCI but i didn't get success, Please answer,
    Thank you in advance
    null

    Here is a very short sample. Hope it helps
    char SQLStatemen[] ="BEGIN spFoo (:P_Name);END;";
    /* Initialize everything */
    OCIBindByName (CommandHandler, &OCIBindName, ErrorHandler, (text *) ":P_Name", -1, (dvoid *) Name, strlen(Name) +1, SQLT
    _STR, (dvoid *) 0,(ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT) == OCI_ERROR);
    OCIStmtExecute (ServiceContext, CommandHandler,ErrorHandler, 1, 0, (OCISnapshot *) NULL,(OCISnapshot *) NULL, OC
    I_DEFAULT);
    /* if P_Name is an out parameter, at this point, it has the value it got from the database */
    /* logoff and close everything */

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

Maybe you are looking for