Call a PL/SQL Package

Hi all

I use ADF BC, JDev 11 G.
I need to call a package stored to do the validation of data entered in the page layout. I would like to know how to call the AppmoduleImpl.java package no matter what an example for reference would be useful.
Thanks in advance, help will be appreciated.

Jyothi

Use a method such as the following in your AppModuleImpl file.

  public Integer myMethod(String pParam1, int pParam2) {
    int returnValue = 0;
    String selectDML = "{? = call pkg_name.pkg_function(?,?)}";

    CallableStatement statement = getDBTransaction().createCallableStatement(selectDML, 1);

    try {
      statement.registerOutParameter(1, Types.INTEGER);

      statement.setInt(1, returnValue);
      statement.setString(2, pParam1);
      statement.setInt(3, pParam2);
      statement.execute();

      returnValue = statement.getInt(1);

      statement.close();

      return returnValue;
    } catch (Exception ex) {
      throw new JboException(ex);
    }
  }

Above an example using a pkg with 1 output and 2 in params, customize to your needs.

Then you can use it inside a bean managed as follows:

  private int returnValue;

  public int getReturnValue() {
    ApplicationModule am =
      BindingContext.getCurrent().getDefaultDataControl().getApplicationModule();

    AppModuleImpl appModuleImpl = (AppModuleImpl)am;

    returnValue = appModuleImpl.myMethod("aString", 0);

    return returnValue;
  }

Hope that helps.
Matthew.

Tags: Java

Similar Questions

  • Call a pl/sql package unix script

    Hello

    With the help of 11.2.0.3 on AIX.

    Is it possible to call the pl/sql package unix script?

    I am cretaing a file in a directory but would like it to automatically write to a directory to archive as well.

    Could use either 2 utl_file.put_lines to 2 separate directories or 1 utl_file and cal script to archive files in another directory. ?

    Thoughts?

    Thank you

    user5716448 wrote:

    Thoughts?

    Use UTL_FILE. FCOPY copy the file you created in the directory of the archive.

    SY.

  • Need to call the PL/SQL Package in the group dynamics of approval class that implements IDynamicApprovalGroup

    Hi all

    This is regarding the approval of invoice AP I need in my project where the user selects the users/people approval when creating the invoice based on logic. There may be any number of users who could be part of the approval group.

    Approval users information is stored in a table with a single Bill.

    When the user initiates invoice approval, approval of the Bill should go to all the people/users selected in the invoice.

    I created the dynamic of approval group which is the result of a java class. This java class implements IDynamicApprovalGroup. (what is the oracle Developer Guide).

    I called PL/SQL to java class package to get all the details of users of custom for the current invoice table.

    I used the DriverManager.getConnection method by hard coding (JDBC URL, Username, Pwd) connection details that works perfectly fine.

    But I don't want to hard-code the connection details because it will change in bodies SIT/UAT/PROD.

    Please ask you to guide me if there is no solution for the information of connection without hard coding it.

    Following code used to get the connection details

    try {}

    Class.forName ("oracle.jdbc.driver.OracleDriver");

    System.out.println ("= class loaded");

    }

    catch (ClassNotFoundException ex) {}

    System.out.println ("= class loading error");

    ex.printStackTrace ();

    }

    Fitting out = null;

    CallableStatement cstmt = null;

    Try

    {

    connection = DriverManager.getConnection ("jdbc:oracle:thin:@xxhostname:1521/SID", "FUSION", "*");

    Connection = GetConnection ();

    System.out.println ("= connection =" + connection);

    prepare the call

    cstmt = connection.prepareCall ("{call XX_AP_INV_DYN_APPROVAL_PKG. {GET_GROUP_PARTICIPANTS (?,?)} ») ;

    cstmt.setString (1, '12345');   ID on invoice

    Exit of the register

    cstmt.registerOutParameter (2, java.sql.Types.VARCHAR);

    Call the stored procedure

    cstmt. Execute();

    System.out.println ("= procedure being executed");

    approvalGroupMembers = cstmt.getString (2).split("#");

    System.out.println ("= output:" + cstmt.getString (2));

    }

    catch (Exception ex) {}

    ex.printStackTrace ();

    }

    Finally

    {

    Try

    {

    If (cstmt! = null)

    close the callable statement

    {

    cstmt. Close();

    cstmt = null;

    }

    System.out.println ("= stmt closed");

    }

    catch (SQLException ex)

    {

    System.out.println ("= stmt close err");

    ex.printStackTrace ();

    }

    Try

    {

    If (connection! = null)

    close the connection

    {

    Connection.Close;

    connection = null;

    }

    System.out.println ("= closed conn");

    }

    catch (SQLException ex)

    {

    System.out.println ("= Close conn err");

    ex.printStackTrace ();

    }

    }

    Thank you

    Dipak.

    HI Dembélé - you should be able to call the provider database from the java class. Documentation is here. However, you need to specify the name of the data provider that is the same in all environments. Do you know what it is? If it's not I'll take a look and get back to you.

    __

    Peter Maurer

    Relationship with the developers of Applications in fusion

    https://blogs.Oracle.com/fadevrel/

  • 'DBMS_FGA identifier must be declared' when it is called from PL/SQL package...

    Hello

    I'm calling dbms_fga dynamically (of sorts) of a package, and I get the error according to the title.

    I tried as many ways as I can think this call from another package, with each time similar results.

    The user/owner of the package has rights DBA, so it doesn't seem to be a permissions issue.

    Oracle Version is 11.1.0.6.0 on Suse.

    any ideas on this person?

    See you soon

    CODE:

    Attempt 1:

    PROCEDURE enable_sql_auditing (on_off Boolean false by default) is
    v_ssql varchar2 (900);
    cursor c1 is
    Select table_name
    of all_all_tables
    where owner = gcv_pkg_owner;
    Start
    for rec loop c1
    sys.dbms_fga.add_policy (object_schema = > "| gcv_pkg_owner |",)
    object_name = > "| Rec.TABLE_NAME: ",.
    POLICY_NAME = > "| Rec.table_name | ' _AUDIT "'.
    handler_schema = > "| gcv_pkg_owner: ",.
    handler_module = > 'FGA_SQL ',.
    activate = > true);
    end loop;
    end enable_sql_auditing;


    Attempt 2:

    PROCEDURE enable_sql_auditing (on_off Boolean false by default) is
    v_ssql varchar2 (900);
    cursor c1 is
    Select table_name
    of all_all_tables
    where owner = gcv_pkg_owner;
    Start
    for rec loop c1
    v_ssql: = ' start sys.dbms_fga.add_policy (object_schema = > "' | gcv_pkg_owner |) "', object_name = >"' | Rec.TABLE_NAME | " ', policy_name = > "' | Rec.table_name: "_AUDIT", select = > true); end;';
    run immediately (v_ssql);
    end loop;

    end enable_sql_auditing;

    Frenchwood wrote:
    The user/owner of the package has rights DBA, so it doesn't seem to be a permissions issue.

    But it is.

    DBA is a role.
    in PL/SQL, the permissions must be granted directly, rather than through roles.

    for example, you need to directly grant the Execute permission on the package for the required users.

  • ORA-06508, procedure cannot call the procedure of package

    I have a large stored procedure that calls a package (procedure) that manages a number of procedures to determine whether the process can continue or not.  (It checks authorization of the student to enroll in a class).  We have a web process calling the stored procedure, and that works fine.  What does not work, is a call to the package.  Oracle returned ORA-06508: PL? SQL: could not find program unit called.

    I have included instructions for debugging, so I know that it is the specific call to a procedure in the package fails with ORA-06508.  Thinking it's perhaps something in the package, I inserted a debug statement as the first line in the procedure called in the package.    (Debugging instructions call a procedure inserts of rows in a table of debugging with independent validation).

    When I log in the user account with sqlplus and run a test, everything works fine.  But when the web process is running under the same user, the process fails to call the procedure of package and fails with ORA-06508.

    It seems as if the web process runs with the rights of the appellant, or a role is not granted.

    Can someone help me understand what the problem is?

    offered hv, I appreciate your comments.

    We solved the problem: remove the package that couldn't be cited, then re-create.   That's all!

    Apparently, something in the database was tangled upward.   The server recently had problems with disk space, then it might have been related to that.  But we'll never know for sure.

    The stored procedure and packaging (procedures) which he called were owned by the same schema, and there is no mechanism that I can find to prevent one of the other appellant.  But that was the case - Oracle threw the ORA-06508 exception when the stored procedure called the package procedure.

    I replaced the stored procedure and package several times fine-tuning debugging code, but this has not fixed the problem.

    Finally let it drop and then re-create the package, it's which solved the problem.

    Regarding requests to view the code, there is no way that I could reproduce the problem, since the error that occurred was against the permissions and rules which packages run and the procedures of the Oracle.  Thanks for all the tips and suggestions.

  • Node affinity d ' execution for the PL/SQL Packages?

    Colleagues dbas,

    We have a problem of random performance on one of our database RAC 11 GR 1 material due to waiting for IO.

    In fact, we've tracked down the problem and noticed that the sql packages are executed on the bad weather causing node 1 and were executed on node 2 with good results.

    Now the question is how we apply these pl/sql packages, that are called via batch external, must be running on node 2?

    Affinity of the proceeding came to my mind, but I have no idea whatsoever how to apply for parcels and incorporated the pl/sql code.

    Can you please give me an advice?

    Thanks for your comments!

    Best regards

    Sebastian

    You must define a service to run on node 2 with failover to node 1 and give a your batch jobs a string of connection that connects to this service:

    Add srvctl service d a s batchserv - r node2 - a node1

    and in your tnsnames.ora,.

    batchserv =

    (description =

    (address_list =

    (failover = on) (load_balance = on)

    (address = (node1...) (address = (node2...))

    )

    (connect_data = (service_name = batchserv))

    )

    I recorded several demos of this thing of the kind,

    Database Oracle 12 c and g 11 tutorials free for Administration and developers SkillBuilders

    --

    John Watson

    Oracle Certified Master s/n

  • Calling a procedure of package with only Date setting

    Hi all

    Please, help me to call a procedure of package with Date from the sql command prompt parameter.


    Arif

    Check the procedure below.

    SQL> ed
    Wrote file afiedt.buf
    
      1  create or replace procedure procdate (p_date_in date)
      2  is
      3  p_date_out date;
      4  begin
      5  p_date_out := add_months(p_date_in,6);
      6  dbms_output.put_line(p_date_out);
      7* end;
    SQL> /
    
    Procedure created.
    
    SQL> exec procdate('01-JAN-2010');
    01-JUL-10
    
    PL/SQL procedure successfully completed.
    
    SQL> exec procdate(to_date('01/01/2010','DD-MM-YYYY'));
    01-JUL-10
    
    PL/SQL procedure successfully completed.
    
    SQL> exec procdate('31-DEC-2010');
    30-JUN-11
    
    PL/SQL procedure successfully completed.
    
  • Pl/Sql package

    KIM

    can we call pl/sql package as part of OSTEOARTHRITIS

    Hello

    Yes, it is possible. You can use a callable statement. Read more in old wire and dev guide.

    Thank you
    -Anil

  • How to call the PL/SQL of EntityImpl procedure

    Hello

    I have a page that can create/update visitors. When a new customer is created themselves, a line gets inserted into the database table. I use EO for this feature.

    I need to create lines to two or three other table also when a new line is created in the main table. What is the best practice for this feature?

    The 2 options that I know:

    1 create a trigger on the main table and the appeal of trigger for inserting rows in other tables.

    2. call a PL/SQL of EntityImpl procedure after the permanent data is committed to the table. (If this is the best approach, could you please let me know how to get there)

    See you soon

    AJ

    In fact, Java Mail API is included in WLS and JDev, then you can simply add %MIDDLEWARE_HOME%\Oracle_Home\oracle_common\modules\javax.mail_2.0.0.0_1-4-4.jar to your project.

    Dario

  • Cannot query a view in PL/SQL package but it can query in SQL * more

    Hello

    Logged on as a user, I can query the table DBA_SEGMENTS, but I can't question via a slider or select from a PL/SQL package.

    I get the following error message:

    LINE/COL ERROR

    -------- -----------------------------------------------------------------

    28/4 PL/SQL: statement ignored

    33/5 PL/SQL: ORA-00942: table or view does not exist

    28 select

    29                             count(*)

    30 in

    31                             n

    32 of

    33 dba_segments;


    Can someone explain to me what is the missing privilege that I need?

    Thank you in advance.

    Kind regards.

    It seems that you have granted to dba_segments by role.

    To use this object in pl/sql or sp, you need directly.

    Ask your dba to grant:

    SQL > grant select on dba_segments to your_user;

    Mustafa DOGANAY

    http://Doganay.WordPress.com

  • How can I expose a PL/SQL package to a webservice

    Hello

    Using Jdeveloper 12 c, how can I expose a PL/SQL package as a webservice?

    Thanks in advance

    Look for the option 'Web of TopLink-DB services provider' under the section of Web Service in the new gallery.

    Timo

  • Create the PL/SQL package in SQL Developer 4.0.0.12

    Hello

    I built a model in SQL Developer 4.0.0.12 and I want to create a PL/SQL package.

    In ODMiner 11.1.0.4 of 'Tools' > 'Create pl/sql package' I can get a script to create the package and every thing is OK.

    but in SQL Developer, I select "Deploy" from the popup menu of each node and it generates a folder containing scripts associated with each node. I don't see any relevant script for creating a package.

    How can I create a PL/SQL package in my workflow?

    Thanks for any help you can provide in this situation.

    Please see this whitepaper to find out how to build the PL/SQL package for deployment of workflow:

    Oracle Data Miner (Extension of SQL Developer 4.0)

    PL/SQL script for the deployment of workflow

    http://www.Oracle.com/technetwork/database/options/advanced-analytics/odmrcodegenwhitepaper-2042206.PDF

  • Problem building java pl/sql package

    Hello

    In JDeveloper (11.1.1.6) I'm having a problem of java generation from a pl/sql package. When I'm in the database browser I click with the right button on the package and select "generate java. Which produces java files, some sqlj files and a < package_name > .javatmp file. When a colleague doing the same thing all the files are generated with the .java extension. Can someone tell me what I can do to build all the java files?

    Thank you

    Graeme

    It turns out that I was running against a 64 bit JDK. (1.6.0_41.)

    When that face a 32 bit JDK (also 1.6.0_41), I've changed my problem disappeared.

    It might be interesting to note that my machine is 64-bit.

  • Call the PL/SQL shell script

    Hi all

    I've seen several links and options for calling a PL/SQL shell script. I was wondering if there is something like DBMS_SCHEDULER. CREATE_PROGRAM-> executable that calls an external program in 11 GR 2.

    Here's what I have to. I have 11 GR 2 database with Dataguard. I have START triggering who begins a DBMS_SERVICE when the role becomes PRIMARY. In the same instance, I would stop the VIP on the former primary database and start the VIP on the new primary database.

    Thanks for the advice and assistance.

    Jan S.

    The URL below links to ask Tom. Inside, he talks about creating a Java procedure in your database that allows you to execute commands from the host OS (PL/SQL calls the proc of Java that runs the host command). There are several ways to run the OS commands, but this one is very flexible. I needed to use it for a task that I have who didn't fit one of the other methods very well.

    http://asktom.Oracle.com/pls/Apex/f?p=100:11:0:no:P11_QUESTION_ID:3069633370832

  • PL/SQL package, output XML

    Hello

    I'm working on the Pl/sql package to generate the output in xml format using tags XML, but the output is the break with the following error when data have special characters as '& '.

    Error:

    The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Fix the error and then click the Refresh button, or try again later.

    Whitespace is not allowed at this location. Error processing resource

    I use the <? XML version = "1.0" encoding = "ISO-8859-1? > and even tried "UTF - 8' at the beginning of my xml." Anyone can guide me please how I can handle this.



    Thank you!

    Can you guide me on how I can use CDATA for this specific tag.

    XYZ & Co. Inc.

    SQL> set scan off
    SQL> select xmlelement("CUST_NAME", 'XYZ & Co. Inc') from dual;
    
    XMLELEMENT("CUST_NAME",'XYZ&CO
    --------------------------------------------------------------------------------
    XYZ & Co. Inc
    
    SQL> select xmlelement("CUST_NAME", xmlcdata('XYZ & Co. Inc')) from dual;
    
    XMLELEMENT("CUST_NAME",XMLCDAT
    --------------------------------------------------------------------------------
    
     
    

    -First method automatically escapes the characters not valid and replaces them with their corresponding entity reference
    -Second method encapsulates the data in a CDATA section so that there is no need to escape

    You can build the entire XML document with these functions, that's exactly what they did:

    http://docs.Oracle.com/CD/E11882_01/AppDev.112/e23094/xdb13gen.htm#g1047191

Maybe you are looking for

  • Remove my modem connection?

    I have a few computers on a small network ethernet, via a residential gateway (i.e., router), which allow computers to share files and printers, and share an Internet connection cable. Most of the computers on my network is not yet have PSTN modems a

  • Search for TC1100 recovery disks

    Hello I have a p/n #ABA DQ871A TC100 who is down and need a set of recovery disks that normally comes with it (I put them in this safe place not, even if I remember) where can I get a new set? Operating system is Windows XP. Thank you

  • ADSM 5.0.5 not loaded with image ASA 7.0.5

    Hello Having an ASA5520, who was running with the image: asa704-4 - k8.bin and the ADSM: asdm504 - 2.bin I improved the image in version 7.0.5 and the ADSM in 5.0.5 The ASA boots properly with this new version 7.0.5, but still start with the asdm504

  • Problem after upgrade Windows 10 Lightroom 4 printing

    cannot print from LR4 or use gmail since the installation of Windows10

  • When back the content viewer?

    I give a course of interactive design and CC2015 lack of a dps Viewer, I can't teach about a third of the course. I can get a PDF and SWF preview and I'm working on the opportunity to do for 2 types of ePUB with mixed results - I'm an artist, not a c