Package that defines a stored procedure

how can i write a package which would have store procedure in it.
i have a table called invoice which has invoice_no invoice_date and amount in it and its has around 100 records in it.
how can i write a package which has store procedure in it which would list out the entire contents on the INVOICE table to a calling PL SQL script.
i am trying something something like as under but i am getting error message with it
create or replace package hvinvoice as
procedure hv_invoice(cur_invoice out t_cursor)
is
begin
open cur_invoice for
select * from invoice;
end hv_invoice;
end hvinvoice;
Thanks

872959 wrote:
how can i write a package which would have store procedure in it.
i have a table called invoice which has invoice_no invoice_date and amount in it and its has around 100 records in it.
how can i write a package which has store procedure in it which would list out the entire contents on the INVOICE table to a calling PL SQL script.
i am trying something something like as under but i am getting error message with it
create or replace package hvinvoice as
procedure hv_invoice(cur_invoice out t_cursor)
is
begin
open cur_invoice for
select * from invoice;
end hv_invoice;
end hvinvoice;
ThanksAside from the documentation that Centinul has provided, let's put it in simple terms for you...
A package is generally made of two parts, a "package specification" and a "package body".
The package specification defines any variables, types, constants, cursors, functions and/or procedures that any user of the package should be able to access. By "defines" that means that the functions and procedures are declared in the specification but don't contain any actual code.
The package body is where the code for those functions and procedures is written, along with any other variables, functions, procedures etc. that should only be accessible to that package itself.
So, let's take your code. First we need a package specification:
create or replace package hvinvoice as
  procedure hv_invoice(cur_invoice out sys_refcursor);  -- I've used a sys_refcursor here because it's the most reasonable datatype for passing back a cursor
end;So that's the package specification, which is just defining the procedure to expose to users of the package, without providing the actual code.
Now we need the package body:
This starts off looking similar to the package specification, but has the word "body" in the package declaration...
create or replace package body hvinvoice as
  procedure hv_invoice(cur_invoice out sys_refcursor) is
  begin
    open cur_invoice for
      select * from invoice;
   end hv_invoice;
end;Note: any functions or procedures you declare in the package specification must have an equivalent body of code in the package body. If you miss out the code, the package won't compile without errors.
It's also possible to create just a package specification without a package body, though you'd only do that if you wanted a package that just defined a standard set of constants or variables etc., you wouldn't be able to put functions or procedures in it.
Hope that helps.

Similar Messages

  • Is it possible to trigger an error so that the running stored procedure is stopped?

    Hello all,
    I want to run an existing stored procedure and then I want to manually trigger an error/abort/interruption so see what happens and do some testing with that.
    Is it possible to manually trigger an error/abort/interruption on a running stored procedure so that it is stopped?
    If yes, how can I do that?
    I hope someone has an idea. For me it sounds not really difficult, but I just do not get the idea how to do it.
    Kind regards
    Peter

    Hello Visakh,
    I dont want to modify the existing procedure. I just want to run it and than stop it, but not with the button to stop it, but "kill" it somehow with an error (with not destroying the database).
    Nope you cant simulate an intermediate failure inside procedure code from outside. For that you have to modify the actual sp code itself
    Another way is by doing data manipulation in such a way which causes a error in procedure but for that you need to revisit the logic to ensure you do changes in such way as to cause an error
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Pivot table that uses a Stored Procedure parameter and filters the data based on it

    Hello, my 1st post.  I am lost.  Please help.
    I am trying to create an Excel Pivot Table that has data that comes from an ODC but needs to be filtered based on a parameter from a Stored Procedure.  This involves Project Server.  I need to filter the results based on the RBS value of the logged
    in user.  My Stored Procedure can return the RBS as long as the ResourceNTAccount value is given.  I cant figure out how to tie this all together.

    Hi,
    Based on your description,I think this issue should be  more related to Programming/coding, you can sumbit a new case to MSDN forum.
    As I'm not quite formular with Project Server, all I can tell you is that it is easy to running a Stored Procedure within Excel, however, if you have to pass dynamic parameters you’ll have to turn to VBA.For detailed information,please refer
    to:
    http://blogs.office.com/2010/06/07/running-a-sql-stored-procedure-from-excel-no-vba/
    Wind Zhang
    TechNet Community Support

  • The link to a user defined oracle stored procedure does not work

    This is based on the HowTo Download a file
    http://otn.oracle.com/products/database/htmldb/howtos/howto_file_upload.html
    I have given a link to a procedure as follows, which will download the file (as given in the HowTo):
    #OWNER#.download_my_file?p_file=#ID#.
    However, this does not work. It tries to open a page rather than executing the procedure. It displays the page not found message

    that page not found message is a generic one. you'd want to check your apache logs for more info on what really happened. my guess is that you missed step 5 of that how-to, "grant execute on download_my_file to public"
    hope this helps,
    raj

  • How to call a stored procedure using its package name in Oracle

    hi
    we're doing a JDBC scenario where we call a stored procedure(a.prc) using its package name(b)The stored procedure has In /Out/IN-OUT parameter.
    i have got 2 queries:
    1- How to call the stored procedure using it's package.
    2- How to capture the In/Out parameter in the response.

    hi Prateek
    thanks for the reply.
    However when i tried mapping it to Package.procedure, communication channel throws the error saying that Package.proceudre needs to be declared.
    As i said , the procedure has IN-OUT parameter too.In oracle we need to write a block if we want to read the IN-OUT parameter.
    How to get the IN-OUT parameter in XI?

  • Size limitation that can be passed to Java stored procedure

    Hello!
    I enjoy using Oracle8i these days. But I have some questions
    about Java stored procedure. I want to pass the XML data to Java
    stored procedure as IN parameter. But I got some errors when the
    data size is long. Is there any limitation in the data size that
    can be passed to Java stored procedure?
    Would you please help me ?
    This message is long, but would you please read my message?
    Contents
    1. Outline : I write what I want to do and the error message I
    got
    2. About the data size boundary: I write about the boundary
    size. I found that it depend on which calling sequence I use.
    3. The source code of the Java stored procedure
    4. The source code of the Java code that call the Java stored
    procedure
    5. The call spec
    6. Environment
    1.Outline
    I want to pass the XML data to Java stored procedure. But I got
    some errors when the data size is long. The error message I got
    is below.
    [ Error messages and stack trace ]
    java.sql.SQLException: ORA-01460: unimplemented or unreasonable
    conversion reque
    sted
    java.sql.SQLException: ORA-01460: unimplemented or unreasonable
    conversion reque
    sted
    at oracle.jdbc.ttc7.TTIoer.processError(Compiled Code)
    at oracle.jdbc.ttc7.Oall7.receive(Compiled Code)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(Compiled Code)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch
    (TTC7Protocol.java:721
    at oracle.jdbc.driver.OracleStatement.doExecuteOther
    (Compiled Code)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithBatch
    (Compiled Code)
    at oracle.jdbc.driver.OracleStatement.doExecute(Compiled
    Code)
    at
    oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(Compiled
    Code
    at
    oracle.jdbc.driver.OraclePreparedStatement.executeUpdate
    (OraclePrepar
    edStatement.java:256)
    at oracle.jdbc.driver.OraclePreparedStatement.execute
    (OraclePreparedStat
    ement.java:273)
    at javaSp.javaSpTestMain.sample_test
    (javaSpTestMain.java:37)
    at javaSp.javaSpTestMain.main(javaSpTestMain.java:72)
    2. About the data size boundary
    I don|ft know the boundary that I got errors exactly, but I
    found that the boundary will be changed if I use |gprepareCall("
    CALL insertData(?)");|h or |gprepareCall ("begin insertData
    (?); end ;")|h.
    When I use |gprepareCall(" CALL insertData(?)".
    The data size 3931 byte --- No Error
    The data size 4045 byte --- Error
    Whne I use prepareCall ("begin insertData(?); end ;")
    The data size 32612 byte --No Error
    The data size 32692 byte --- Error
    3. The source code of the Java stored procedure
    public class javaSpBytesSample {
    public javaSpBytesSample() {
    public static int insertData( byte[] xmlDataBytes ) throws
    SQLException{
    int oraCode =0;
    String xmlData = new String(xmlDataBytes);
    try{
    Connection l_connection; //Database Connection Object
    //parse XML Data
    dits_parser dp = new dits_parser(xmlData);
    //Get data num
    int datanum = dp.getElementNum("name");
    //insesrt the data
    PreparedStatement l_stmt;
    for( int i = 0; i < datanum; i++ ){
    l_stmt = l_connection.prepareStatement("INSERT INTO test
    " +
    "(LPID, NAME, SEX) " +
    "values(?, ?, ?)");
    l_stmt.setString(1,"LIPD_null");
    l_stmt.setString(2,dp.getElemntValueByTagName("name",i));
    l_stmt.setString(3,dp.getElemntValueByTagName("sex",i));
    l_stmt.execute();
    l_stmt.close(); //Close the Statement
    l_stmt = l_connection.prepareStatement("COMMIT"); //
    Commit the changes
    l_stmt.execute();
    l_stmt.close(); //Close the Statement l_stmt.execute
    (); // Execute the Statement
    catch(SQLException e ){
    System.out.println(e.toString());
    return(e.getErrorCode());
    return(oraCode);
    4. The source code of the Java code that call the Java stored
    procedure
    public static void sample_test(int num) {
    //make data
    Patient p = new Patient();
    byte[] xmlData = p.generateXMLData(num);
    try{
    // Load the Oracle JDBC driver
    DriverManager.registerDriver(new
    oracle.jdbc.driver.OracleDriver());
    Connection m_connection = DriverManager.getConnection
    ("jdbc:oracle:thin:@max:1521:test",
    "testuser", "testuser");
    CallableStatement l_stmt =
    // m_connection.prepareCall(" CALL insertData(?)");
    m_connection.prepareCall("begin insertData(?); end
    l_stmt.setBytes(1,xmlData);
    l_stmt.execute();
    l_stmt.close();
    System.out.println("SUCCESS to insert data");
    catch(SQLException e ){
    System.out.println( e.toString());
    e.printStackTrace();
    5. The call spec
    CREATE OR REPLACE PROCEDURE insertData( xmlData IN LONG RAW)
    AS
    LANGUAGE JAVA NAME 'javaSp.javaSpBytesSample.insertData(byte[])';
    6. Environment
    OS: Windows NT 4.0 SP3
    RDBMS: Oracle 8i Enterprise Edition Release 8.1.5.0.0 for
    Windows NT
    JDBC Driver: Oracle JDBC Drivers 8.1.5.0.0.
    JVM: Java1.1.6_Borland ( The test program that call Java stored
    procedure run on this Java VM)
    null

    Iam passing an array of objects from Java to the C
    file. The total size of data that Iam sending is
    around 1GB. I have to load this data into the Shared
    memory after getting it in my C file. Iam working on
    HP-UX (64-bit). Everything works fine for around 400MB
    of data. When I try to send around 500MB of data, the
    disk utilization becomes 100%, so does my memory
    utilization and I get a "Not enough space" when I try
    to access shared memory. I have allocated nearly 2.5GB
    in my SHMMAX variable. Also, I have around 45GB of
    disk free. The JVM heap size is also at 2048MB. Where did you get the 400/500 number from? Is that the size of the file?
    What do you do with the data? Are you doing nothing but copying it byte for byte into shared memory?
    If yes then a simple test is to write a C application that does the same thing. If it has problems then it means you have an environment problem.
    If no then you are probably increasing the size of the data by creating a structure to hold it. How much overhead does that add to the size of the data?

  • Crystal Report That Uses Stored Procedure Errors when connecting to the DB

    We had developed reports a few years ago, including one that calls a Stored Procedure on an iSeries AS400 DB2 database.  We upgraded our environments to Crystal Reports 2008 and BO XI 3.1.  Now, the existing report that previously ran in the old environment is not running (note that the other SQL-based reports work without a problem, only this one which uses a store procedure is not working).  I downloaded the report into my local Crystal Reports designer and tried to run it from there and I got the following error message:
    ======
    Failed to retieve data from the database.
    Details: ADO Error Code: 0x
    Source Microsoft OLE DB Provider for ODBC Drivers
    Description: [IBM][iSeries Access ODBC Driver] Statement violates access rule:  Connection is set to read only.
    SQL State: 37000
    Native Error: [Database Vendor Code: 30186 ]
    ======
    {CALL "<database>"."<library>"."RELEASEDNOTINVOICE"({d '2010-03-01'})}
    This call will still work from on a SQL client running on a JDBC connection.  Is there some problem with the new verion of BO and Crystal Reports with using the iSeries ODBC driver?

    ...my issue was resolved by setting the ODBC.INI registry entry for AllowProcCalls from 0 to 1.

  • Function calling stored procedure that returns a cursor into a LOV

    Hello,
    Is it possible in HTML DB to implement a process that has a function that calls a stored procedure that returns a cursor, used to then populate a select list?
    Or can I do a function call to a stored procedure in the 'List of values definition' box for the item itself that returns a cursor to populate the item's select list?

    Hi Vikas,
    Actually, I just found another posting that shows how to do what I'm looking for:
    Re: Filling a LOV with a cursor
    Check it out. I posted another question in response to that discussion...maybe you could answer that? Thanks!
    Laura

  • Calling DTS package from Stored Procedure

    I am getting error calling DTS package from CF.
    So i want to call DTS package from SQL Server Stored
    Procedure.
    DTS package create text file. So no need of input or output
    parameter.
    What is the syntax?.
    thanks for ur help.

    Ted Kruger explains how this can be done in his blog post
    Run SSIS Package from Stored Procedure
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog

  • Baffled by Toplink and stored procedures

    Here's what I'm after...
    I have a nice package built to act as a bridge to a MySQL database. Everything works fine, but I need to write classes to "wrap" two stored procedures (procedures, not functions or triggers, defined in the database itself). I want to leverage the TopLink connection handling so that I don't have to open/close connections for these two classes. Surely there is some way to do this.
    Working with one example...
    Stored Procedure definition:
    CREATE PROCEDURE openPorts (ipAddr INT UNSIGNED)
    BEGIN
      DECLARE lastScanID INT UNSIGNED;
      SELECT results.scanrequestid INTO lastScanID
        FROM (results,network,scanner)
        WHERE
          results.ip=ipAddr and
          results.ip between network.ip and network.ip+pow(2,(32-network.cidr))-1 and
          results.scannerip=scanner.ip and
          scanner.regionid=network.regionid
        ORDER BY results.endtime DESC LIMIT 1;
      SELECT distinct protocol,port
        FROM results
        where
          ip=ipAddr and
          scanrequestid=lastScanID and
          port>0 and protocol>0
        ORDER BY PROTOCOL,PORT;
    ENDI want to create a class file OpenPortsDAO such that calling
    List<OpenPort> ports = OpenPortsDAO.find(int ipInteger)Yields a list (or vector, whatever) of the rows returned as the result.
    Ignoring for the moment the issues with mapping returned row fields to object fields in my OpenPort class, how the heck do I...
    1) Define the stored procedure
    2) Set the input variable value
    3) Get the connection (if necessary)
    4) Execute the query
    I imagine it's going to be something like...
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("hostSummary");
    call.addNamedArgumentValue("ipAddr", value);
    call.getResult();Should this wrapping class be defined in the persistence unit just like any other? If so, my assumption is then that I would not have to manually handle connections, etc.
    Any help would be very much appreciated. I think if I can just get pointed in the right direction, it should "click" for me.
    -David

    Doug,
    Thanks for the info. I was able to handle the stored procedure, but I did so via POJOs.
    I'm interested in this part of your reply...
    >
    This will give you an entity class with a full lifecycle to it assuming that TopLink may write it back to the database if modified in a transaction.
    Given the following pseudo-&lt;code|SQL>...
    drop table starship
    go
    drop table contractor
    go
    create table contractor (
    id serial primary key,
    name text unique)
    go
    create table starship (
    id serial primary key,
    name text unique,
    contractor_id int references contractor)
    go
    create function get_by_id(shipid int, OUT contractor, OUT shipname)
    BEGIN
      blah
    END;
    GOAre you saying that I can create a full CRUD object for the function/procedure call? IE., assuming I get back a result and I see that the ship name is incorrect, I could make a change to the returned data and have that persisted? Without having to get a starship object on my own?
    If that's the case, I'd like to know more.
    -David

  • Calling Java Methods from Stored Procedures

    Can I call Java Methods from Oracle Stored Procedures? I have a Java framework that logs events and would like to reuse it for logging events that occur in stored procedures.
    null

    You need to publish java class methods to plsql.
    Attached below is some information.
    Although both PL/SQL modules and Java classes are stored in the database
    and are managed by many of the same mechanisms, each of them resides in
    its own namespace. Therefore, Java methods are not accessible from SQL
    and PL/SQL by default. In order to expose Java methods to the SQL and
    PL/SQL engines, first publish that Java method to the SQL namespace using
    a 'Call Spec'.
    Note: A 'Call Spec' does not create an additional layer of
    execution so there is no performance penalty incurred.
    A 'Call Spec' is simply a syntactical mechanism used to
    make a method known in the SQL namespace.
    The SQL name established by the 'Call Spec' can be top-level or packaged.
    The syntax differs only slightly and is consistent with that used for
    PL/SQL procedures and packages. For more information on the exact
    syntax, see the references listed in 'Related Topics'.
    In general, a top-level procedure 'Call Spec' takes the form:
    CREATE OR REPLACE PROCEDURE procname ( pname mode ptype, ... )
    AS LANGUAGE JAVA NAME 'javaname ( javatype, ... )';
    Where: procname is the SQL name you wish to publish
    pname is the name for a parameter to procname
    mode is the parameter mode (i.e. IN, OUT, IN OUT)
    ptype is a valid SQL type (e.g. NUMBER, CHAR, etc.)
    javaname is the fully qualified name of the Java method
    javatype is a Java type for the corresponding parameter
    Likewise, a top-level function 'Call Spec' takes the form:
    CREATE OR REPLACE FUNCTION fname ( pname mode ptype, ... ) RETURN rtype
    AS LANGUAGE JAVA NAME 'javaname ( javatype, ... ) return javatype';
    Where: fname is the SQL name you wish to publish
    rtype is the SQL return type of the function
    Note: Within the NAME clause, everything within quotes is case
    sensitive. For example, if the keyword 'return' is in all
    CAPS, this Call Spec will not compile.
    Other optional parts of this syntax have been omitted here for simplicity.
    Additional examples in subsequent sections illustrate some of these options.
    eg
    CREATE PROCEDURE MyProc (rowcnt IN NUMBER, numrows OUT NUMBER)
    AS LANGUAGE JAVA NAME 'MyClass.MyMethod(int, int[])';
    There are several important things to note here:
    1.) The 'Call Spec' for a JSP must be created in the same schema as the
    corresponding Java class that implements that method.
    2.) IN parameters are passed by value. This is the only parameter mode
    available in Java. OUT parameters, therefore, must be passed as single
    element arrays in order to emulate pass by reference.
    3.) Parameter names do not need to match, but the number and types of
    the parameters must match (with just one exception - see item 5 below).
    Oracle 8i supports conversions between an assortment of SQL and Java.
    See the references listed in 'Related Topics' for additional information.
    4.) Primitive types (e.g. int, float, etc.) are not required to be fully
    qualified with any package name. However, standard Java object types
    (e.g. String, Integer, etc.) as well as any user defined object types
    (e.g. like those generated by JPublisher) must be prefixed with a
    corresponding package name (e.g. java.lang) if applicable.
    5.) The 'main' method which takes a single String[] parameter can be
    mapped to any PL/SQL procedure or function which takes some number
    of VARCHAR2 or CHAR type IN parameters. For example, the java method:
    public static void main ( String[] args ) { ... }
    can be mapped to each of the following:
    PROCEDURE MyProc2 ( arg1 IN CHAR ) ...
    PROCEDURE MyProc3 ( arg1 IN CHAR, arg2 IN VARCHAR2 ) ...
    PROCEDURE MyProc4 ( arg1 IN VARCHAR2, arg2 IN VARCHAR2 ) ...
    and so forth. Parameters map to the corresponding element of the String
    array (e.g. arg1 -> args[0], arg2 -> args[1], etc.).
    null

  • Printing OUT variables from a Stored Procedure

    Hi all,
    I'm running an SQL command that calls a Stored Procedure and passes in some value. I've pasted in the important parts of it below. What I am trying to do is access the OUT variables that have been assigned to the DECLARED variables. I come from a SQL Server background and there we can do "SELECT @variable" which will print it to screen. I'm trying to do something similar here.
    I need to access the contents of the three variables declared at the top of the script.
    Thanks in advance.
    DECLARE
    l_error_value NUMBER;
    l_error_product VARCHAR2 (10);
    l_CE_DOC_ID number;
    BEGIN
    PEM.create_enquiry   
         (      ce_cat => 'COMP'
                   , ce_class => 'FRML'
                   , error_value => l_ERROR_VALUE
                   ,error_product => l_ERROR_PRODUCT
                   , ce_doc_id => l_ce_doc_id
    END;

    Ah yes I see. Sorry I misunderstood what you were suggesting. I'm currently working on a test script that uses an approach similar to the one you mentioned, but I'm having trouble resolving foreign key relationships with test data.
    I've no access to the tables or anything so it's proving to be a time consuming task!!
    Is it required that all fields are given a value, even if they have a "DEFAULT" defined for them within the procedure. At the moment I'm using a rather cumbersome approach to this:
    i.e.
    With cmmAddRequest
        .ActiveConnection = strConnect
        .CommandType = adCmdText
        .CommandText = strSQL
        .Parameters(0).Direction = adParamInput
        .Parameters(1).Direction = adParamInput
        .Parameters(2).Direction = adParamInput
        .Parameters(3).Direction = adParamOutput
        .Parameters(4).Direction = adParamOutput
        .Parameters(5).Direction = adParamOutput
        .Parameters(0).Value = "COMP"
        .Parameters(1).Value = "FRML"
        .Parameters(2).Value = "1"
        .Execute
        WScript.Echo(.Parameters(5).Value)
    End With

  • Report using Stored Procedure

    <p>HI, we are having problems with a report that uses a stored procedure.  </p><p>When we run the report and enter the parameters, the report comes back blank.  Having a look in the &#39;Show SQL&#39; box says that Crystal Reports is executing the stored procedure but instead of placing in the parameters entered, it is showing &#39;NULL&#39; for all the parameters!</p><p>We can execute the stored procedure fine in the DB and we have checked the ODBC and the OLE DB connections are valid.  </p><p>Has any one encountered this before?</p><p> </p><p>Thanks in advance. <br /></p>

    <p>Did you check little check box below entering parameters.</p><p>Or another reason might be while defining odbc you need to have stored procedures returns value option. But this doesnt seem to be a problem in your case</p>

  • The ways to return data from a stored procedure.

    Hi, I know there are three ways to pass out a value from a Microsoft SQL stored procedure, but I have no clear idea what Oracle SP can do, I know Oracle doesn't support multi-recordset(v8), can not return a recordset by a inner select query, but I do know there is a cursor object, which doesn't like its counterpart in Microsoft SQL server, is a choice under most situation. Here I wonder anyone who is good at Oracle can give a list of all ways to return data from a SP, including example is more better, thanks.

    Here is a way to get return a record from a function and a procedure. You need to be familiar with Oracle packages as well as stored procedures and functions:
    CREATE OR REPLACE PACKAGE EmpPkg AS
    cursor cEmp(pEmpno in number) is
    select empno, ename, job, hiredate, sal
    from emp
    where empno = pEmpno;
    FUNCTION GetEmployee(pnEmpNo in number) RETURN cEmp%rowtype;
    PROCEDURE GetEmployee(pnEmpNo in number, prEmp out cEmp%rowtype);
    END;
    CREATE OR REPLACE PACKAGE BODY EmpPkg AS
    FUNCTION GetEmployee(pnEmpNo in number) RETURN cEmp%rowtype IS
    rEmp cEmp%rowtype;
    BEGIN
    open cEmp(pnEmpNo);
    fetch cEmp into rEmp;
    close cEmp;
    return rEmp;
    END;
    PROCEDURE GetEmployee(pnEmpNo in number, prEmp out cEmp%rowtype) IS
    BEGIN
    open cEmp(pnEmpNo);
    fetch cEmp into prEmp;
    close cEmp;
    END;
    END;
    Here's how you use the package:
    DECLARE
    rEmp EmpPkg.cEmp%rowtype;
    BEGIN
    rEmp := EmpPkg.GetEmployee(7782);
    dbms_output.put_line(rEmp.ename);
    EmpPkg.GetEmployee(7902, rEmp);
    dbms_output.put_line(rEmp.ename);
    END;
    Note that you can return any Oracle data type from a function. Likewise, you can specify any Oracle data type as an out parameter in a procedure. Also, you can make a parameter both an in and an out datatype like this:
    PROCEDURE GetEmployee(pnEmpNo in out number);
    I hope this puts you in the right direction.
    null

  • ORABPEL-11809 - call a stored procedure - error in OUT parameter

    Hi all.
    I have a problem in a BPEL process that calls a stored procedure.
    I create a Partner Link that calls a stored procedure in the database. That procedure returns a type that is a table (is defined as a type of the database).
    When I deploy the process I have the following error:
    <messages>
    - <input>
    - <WC01_Pesquisa_Ut_InputVariable>
    - <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="InputParameters">
    - <InputParameters xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/IGIF/WC01/PESQUISA_UT/">
    <P_NIR xmlns="">
    165968274
    </P_NIR>
    <P_NOME_COMPLETO xmlns="">
    carla diogo
    </P_NOME_COMPLETO>
    <P_SEXO xmlns="">
    Feminino
    </P_SEXO>
    <P_DATA_NASC xmlns="">
    2007-03-01
    </P_DATA_NASC>
    <P_NATURALIDADE xmlns=""/>
    </InputParameters>
    </part>
    </WC01_Pesquisa_Ut_InputVariable>
    </input>
    - <fault>
    - <remoteFault xmlns="http://schemas.oracle.com/bpel/extension">
    - <part name="code">
    <code>
    17002
    </code>
    </part>
    - <part name="summary">
    <summary>
    file:/oracle/product/10.1.3/SOA/Integration10131/bpel/domains/default/tmp/.bpel_SaudeIdentificarCidadao_5.0_e3768f57d137443e1ba52d4a6d809426.tmp/WC01_Pesquisa_Ut.wsdl [ WC01_Pesquisa_Ut_ptt::WC01_Pesquisa_Ut(InputParameters,OutputParameters) ] - WSIF JCA Execute of operation 'WC01_Pesquisa_Ut' failed due to: Error registering an out parameter.
    An error occurred when registering parameter PESQUISA_UT as an out parameter of the IGIF.WC01.PESQUISA_UT API. Cause: java.sql.SQLException: Io exception: Connection reset [Caused by: Io exception: Connection reset]
    ; nested exception is:
         ORABPEL-11809
    Error registering an out parameter.
    An error occurred when registering parameter PESQUISA_UT as an out parameter of the IGIF.WC01.PESQUISA_UT API. Cause: java.sql.SQLException: Io exception: Connection reset [Caused by: Io exception: Connection reset]
    Check to ensure that the parameter is a valid IN/OUT or OUT parameter of the API. Contact oracle support if error is not fixable.
    </summary>
    </part>
    - <part name="detail">
    <detail>
    Internal Exception: java.sql.SQLException: Io exception: Connection resetError Code: 17002
    </detail>
    </part>
    </remoteFault>
    </fault>
    </messages>
    The code of the XSD created when I create the partner link is:
    <schema targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/db/IGIF/WC01/PESQUISA_UT/" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:db="http://xmlns.oracle.com/pcbpel/adapter/db/IGIF/WC01/PESQUISA_UT/"
    elementFormDefault="unqualified" attributeFormDefault="unqualified">
    <element name="InputParameters">
    <complexType>
    <sequence>
    <element name="P_NIR" type="decimal" db:index="1" db:type="NUMBER" minOccurs="0" nillable="true"/>
    <element name="P_NOME_COMPLETO" type="string" db:index="2" db:type="VARCHAR2" minOccurs="0" nillable="true"/>
    <element name="P_SEXO" type="string" db:index="3" db:type="VARCHAR2" minOccurs="0" nillable="true"/>
    <element name="P_DATA_NASC" type="dateTime" db:index="4" db:type="DATE" minOccurs="0" nillable="true"/>
    <element name="P_NATURALIDADE" type="string" db:index="5" db:type="VARCHAR2" minOccurs="0" nillable="true"/>
    </sequence>
    </complexType>
    </element>
    <element name="OutputParameters">
    <complexType>
    <sequence>
    <element name="PESQUISA_UT" type="db:TABELA_DE_IDS" db:index="0" db:type="Array" minOccurs="0" nillable="true"/>
    </sequence>
    </complexType>
    </element>
    <complexType name="TABELA_DE_IDS">
    <sequence>
    <element name="PESQUISA_UT_ITEM" type="decimal" db:type="NUMBER" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
    </sequence>
    </complexType>
    </schema>
    Any ideia?
    Thanks in advance.
    Carla

    I'd suggest that you turn on xml validation on the bpel boundaries to make sure that the xml being passed to the adapter is valid. You do this by logging in to bpel console, go to Manage Domain, at the bottom of the Configuration tab, set validateXml to true.
    Then see if it is an xml validation issue - in which case you will have to fix your maps to make sure it is valid indeed.
    Assuming your XML is valid and you are still seeing this error, couple of follow up questions:
    - are you using synonyms ?
    -- note that synonyms are not supported completely by the adapter at this time.
    - could you spell out where your types/sp-pkg resides and what are you connecting as at runtime ?
    -- just to keep things simple enough to debug, i'd do everything as just one user and slowly go to a scheme that you desire.
    HTH

Maybe you are looking for

  • HOW TO TURN $6 INTO $6,000!!!!!! READING THIS COULD CHANGE YOUR LIFE!

    HOW TO TURN $6 INTO $6,000!!!!!! READING THIS COULD CHANGE YOUR LIFE! I found this on a bulletin board and decided to try it. A little while back, I was browsing through newsgroups, just like you are now, and came across an article similar to this th

  • Jquery mobile - how to create multiple CSS files?

    I've been researching this heavily, and can't seem to find anyone discuss this. I'm a CS4 user, and understand 5.5 now includes builtin support for jquery mobile. I've watched the videos on how you set the sizes for phone, tablet, desktop, point each

  • UPGRADE FROM ECC 5.0 TO ECC 6.0 Ehp4

    Hai, Can any one tell me the upgrade strategy from ecc 5.0 to ecc 6.0 Ehp4,also before we upgrade to Ehp4 do we have to upgrade to ecc 6.0 ?If no plz provide me with the link for latest documentation on this . -regards Srinivas Bitra

  • ERROR - 1051417 - Essbase Application Existence Check Fails against..

    Hi Our backup routine copies our Essbase databases to a seperate application. First, it drops the target app before rebuilding it. But in our Test environment (11.1.1.3) this step fails with the following error: +ERROR - 1051417 - Essbase Application

  • 2 Day Plus Application Express Developer Guide - error?

    Good day ! In "Oracle Database Express Edition 2 Day Plus Application Express Developer Guide" chapter 8 "How to Upload and Download Files in an Application" at the topic "Store the Document in a Custom Table" ( page 8-10, 8-11) is recommended: 6. Un