Ref cursor to object  and return to ref cursor

how i will call object type from refcursor and return value to ref cursor .

I need a help. please help me.
takes oracle object types as input/output.
PROCEDURE createserviceorder(
P_serviceorder IN serviceorder,
P_serviceid in out p_sm_type.serviceid,
P_serviceorderid out p_sm_type.serviceorderid,
Returnstatus out callstatus);
The serviceorder, callstatus are oracle object types.
The wrapper procedure for this API would be something like the example with pseudo code below
PROCEDURE createserviceorderwrapper(
P_serviceorder IN REFCURSOR,
P_serviceid in out p_sm_type.serviceid,
P_serviceorderid out p_sm_type.serviceorderid,
Returnstatus out REFCURSOR)
Map from ref cursor P_serviceorder to oracle object for serviceorder;
Map from other data types to local variables;
Call createserviceorder (pass the parameters here and get output….);
Map output callstatus to its equivalent REF CURSOR variable;
Return callstatus (and other out parameters if any )as REF CURSORS;
}

Similar Messages

  • Sorting an array of objects and returning another variable

    Hi there,
    Bit stuck on this one I wonder if anyone can help..
    I have an object array into which I've pushed a number of objects with different variables :-
    myArray.push({myRef: 1, myValue: "W"});
    I can sort the array in numerical order using :-
    myArray.sortOn("myRef", Array.NUMERIC);
    but after sorting I would like to collapse the array using something along the lines of :-
    myArray.join("");
    to join the OTHER variable (myValue)...
    Is it possible to do this without pushing every instance of 'myValue' to another array and then joining that ?
    Many Thanks in advance
    Martin

    Hi kglad,
    I really appreciate you helping, but I have had to completely change my approach to this problem, therefore I will be marking the question as answered !!
    Thanks again

  • How to return a ref cursor from this dbms_sql?

    Hi,
    Can anyone show me how to return a ref cursor from this dbms_sql based procedure? I see 11g has a dbms_sql.to_refcursor(cursor_handle). How can this be done is 10g?
    Thx.
    CREATE OR REPLACE PROCEDURE Sample_Get_t
    p_sample_id sample.sample_id%TYPE,
    p_contract_id sample.contr_id%TYPE
    IS
    cursor_handle INT;
    sql_stmnt varchar2(500);
    rows_processed NUMBER;
    BEGIN
    sql_stmnt :=
    'SELECT
    sample_id,
    contr_id,
    rcpt_id
    FROM
    sample s
    WHERE
    s.contr_id = :1
    and s.sample_id = :2
    ORDER BY
    sample_id';
    cursor_handle := dbms_sql.open_cursor;
    dbms_sql.parse(cursor_handle, sql_stmnt, dbms_sql.native);
    dbms_sql.bind_variable(cursor_handle, ':1', p_contract_id);
    dbms_sql.bind_variable(cursor_handle, ':2', p_sample_id);
    rows_processed := dbms_sql.execute(cursor_handle);
    dbms_sql.close_cursor(cursor_handle);
    END Sample_Get_t;

    In 10 this cannot be done with dbms_sql (to my knowledge). There are a couple of other options.
    1) open the ref cursor for the dynamic statement using bind variables (or SYS_CONTEXT variables, which i prefer since they are much easier to deal with when you are dynamically adding predicates).
    declare
       wRefCursor  SYS_REFCURSOR;
    begin
       open wRefCursor for 'select * from all_objects where owner = :Logged_in_user' using user;
    end;
    /or using the context (the context will bind for you)
    declare
       wRefCursor  SYS_REFCURSOR;
    begin
       open wRefCursor for 'select * from all_objects where owner = SYS_CONTEXT(''CONTEXT_NAME'', ''VARIABLE_NAME'') ';
    end;
    /Be aware that contexts ALWAYS return varchar values, so if you are comparing to a number you should wrap it in TO_NUMBER, a date, TO_DATE and so on....
    2) change the DBMS_SQL to do an insert into a global temporary table and return the ref cursor which select's * from GTT;
    3) upgrade to Oracle 11 :)

  • Refer to an object in Edge from an onclick="" in a .html file loaded into an iFrame in the animation

    HI, I am trying to figure out the Edge hierachies by stumbling my way through coding reference attempts. I've hit a wall...
    How can I refer to an object and a global function in my Edge animation from an onclick=""  located in an .html file loaded into an iFrame created within the master/parent Edge animation. Here's what I have...
    My main index.html is an Edge animation. One object <div> is a box created within Edge. I have added an iFrame with the Edge code:
    sym.$("MenuPanelScreen").html('<iframe src="list_images_cemetery.html" width="267" height="670" sandbox="allow-same-origin allow-scripts allow-top-navigation"></iframe>');
    That .html file which loads into the iframe within the animation contains thumbnails in <a> tags and contain onclick="" statements that should call a function within the Edge file.
    Eventually, I want the statements to read something like... onclick="changePic('Dragon.jpg', 'The Dragon', 'Saint and Worm')"
    However, I had no idea how to reference the changePic() function in the Edge animation. So, just to figure out how to reference the parent animation from an html in an iFrame, I change the onclick="" statements to...
    <a onclick="alert('Try to hide Nameplate'); sym.$('NamePlate_sym').hide();" >  <img src="gallery/TheyGaveUpTheirDead.jpg" width="80" alt="Angel and Worm" /></a>
    I first wanted to see if I could hide an Edge Symbol or div/element from the child html. I tried the following...
    onclick="alert('Try to hide Nameplate'); sym.$('NamePlate_sym', window.parent.document).hide();"
    I tried a few other variations that I won't bore you with. Can someone help me with the proper reference to effect an Edge element?
    Furthermore, I eventually wnat the onclick="" statement to reference a global function on attached to the Edge stage in the compositionReady event of the stage. The function is...
    window.changePic=function(myFileCurr, myLabelCurr, myDescriptionCurr) {
    alert("in changePick");
      document.getElementById("myImage").src="gallery/"+myFileCurr;
      document.getElementById("myImageLabel").innerHTML=myLabelCurr;
      document.getElementById("myImageDescr").innerHTML=myDescriptionCurr;
    I hope someone can point me in the right direction. Please forgive my ignorance. i am just getting back into coding and learning the intricacies of Jscript and jQuery. Thanks!

    Hi again Elaine,
    I actually had some success after many attempts with using your code. I can control the .stop() and .play() of the "NamePlate_sym" symbol. Yet, I am still having trouble doing anything else with it. I cannot .hide() it, nor use .html("Change text") on another element on the stage called"Rectangle". If I can accomplish that and all a global function on the stage, I'm in good shape.
    I placed the following script in the header of the .html file that gets loaded into the iFrame within the Edge composition:
      <script type="text/javascript">
       window.parent.AdobeEdge.bootstrapCallback(function(compId) {
       comp = window.parent.AdobeEdge.getComposition(compId).getStage();
       alert("CompID is "+compId);
       var symbol = document.createElement('div');
       symbol.innerHTML = 'Rotate';
       symbol.style.cssText = 'background-color:#fea; width: 50px; text-align: center;';
       symbol.style.cursor = 'pointer';
       symbol.onclick = function() {
        if (comp.getSymbol("NamePlate_sym").isPlaying()) {
         comp.getSymbol("NamePlate_sym").stop();
        else {
         comp.getSymbol("NamePlate_sym").play();
       window.parent.document.body.appendChild(symbol);
            </script>
    Once I put window.parent. in the first two lines of code and the last, my test worked. As I mentioned earlier though, I still can't get the syntax correct to .hide() an element (i.e. comp.getSymbol("NamePlate_sym").hide(); does not work), or more importantly, change the innerHTML value of an element on the stage. The code either does nothing or freezes.
    Thanks... Tommy

  • Oracle Function returns a Ref Cursor to a ResultSet object - Performance

    My program calls an Oracle PL/SQL function which returns a ref cursor to a ResultSet object. I know that the function runs to completion relatively quickly when i run it in an anonymous block but when the call is made through my Java application the resultset takes about 30 mins to return. Below is a snippet of my code:
    currentConnection = ConnectionManager.getInstance().getConnection();
    reportStmt = currentConnection.prepareCall("BEGIN ? := ENVISION.PKG_WMS_TO_AP.F_REPORT_CI_SC_HOLDING(?,?); END;"); reportStmt.registerOutParameter(1, OracleTypes.CURSOR);
    reportStmt.setString(2, invoice.getCrewHQ());
    reportStmt.setDate(3, invoice.getWrCompletionDate());
    reportStmt.execute();
    reportRS = ((OracleCallableStatement) reportStmt).getCursor(1);
    Through a debugger I see that the second last statement (reportStmt.execute()) runs quickly. It is only when I step into the last statement that the debugger takes up to 30 minutes.
    Any thoughts?

    Flynn,
    The Internet is a dynamic place. After nearly two and a half years, there is a chance that a link will change. This is the new URL for the relevant Web page:
    http://asktom.oracle.com/~tkyte/ResultSets/
    Good Luck,
    Avi.

  • Help on CAST function, defining TYPE TABLE and using a REF cursor

    Hi,
    I have written a procedure (lookup) inside a package (lookup_pkg) as shown below.
    Procedure has an output variable of type PL/SQL TABLE which is defined in the package.
    I want to write a wrapper procedure lookupref to the procedure lookup to return a ref cursor.
    CREATE OR REPLACE PACKAGE lookup_pkg AS
    TYPE t_lookup_refcur IS REF CURSOR;
    CURSOR c_lookup IS
         Select columns1,2,3,....100
                   FROM A, B, C, D, E
                   WHERE ROWNUM < 1;
    TYPE t_lookup IS TABLE OF c_lookup%ROWTYPE;
    Procedure lookup(id Number, o_lookup OUT t_lookup);
    End lookup_pkg;
    CREATE OR REPLACE PACKAGE BODY lookup_pkg As
    Procedure lookup(id Number, o_lookup OUT t_lookup) IS
    BEGIN
    END lookup;
    Procedure lookupref(id Number, o_lookupref OUT t_lookup_refcur) IS
    o_lookup t_lookup;
    BEGIN
    lookup(id, o_lookup t_lookup);
    OPEN t_lookup_refcur FOR
    SELECT *
         FROM TABLE(CAST(o_lookup AS t_lookup));
    Exception
    End lookupref;
    END lookup_pkg;
    When I compile this procedure, I am getting invalid datatype Oracle error and
    cursor points the datatype t_lookup in the CAST function.
    1. Can anyone tell me what is wrong in this. Can I convert a PL/SQL collection (pl/sql table in this case) to PL/SQL datatype table or does it need to be a SQL datatype only (which is created as a type in database).
    Also, to resolve this error, I have created a SQL type and table type instead of PL/SQL table in the package as shown below.
    create or replace type t_lookuprec as object
                   (Select columns1,2,3,....100
                   FROM A, B, C, D, E
                   WHERE ROWNUM < 1);
    create or replace type t_lookup_tab AS table of t_lookuprec;
    CREATE OR REPLACE PACKAGE BODY lookup_pkg As
    Procedure lookup(id Number, o_lookup OUT t_lookup) IS
    BEGIN
    END lookup;
    Procedure lookupref(id Number, o_lookupref OUT t_lookup_refcur) IS
    o_lookup t_lookup;
    BEGIN
    lookup(id, o_lookup t_lookup);
    OPEN t_lookup_refcur FOR
    SELECT *
         FROM TABLE(CAST(o_lookup AS t_lookup_tab));
    Exception
    End lookupref;
    END lookup_pkg;
    When I compile this package, I am getting "PL/SQL: ORA-22800: invalid user-defined type" Oracle error and
    points the datatype t_lookup_tab in the CAST function.
    2. Can anyone tell me what is wrong. Can I create a type with a select statement and create a table type using type created earlier?
    I have checked the all_types view and found that
    value for Incomplete column for these two types are YES.
    3. What does that mean?
    Any suggestions and help is appreciated.
    Thanks
    Srinivas

    create or replace type t_lookuprec as object
    (Select columns1,2,3,....100
    FROM A, B, C, D, E
    WHERE ROWNUM < 1);You are correct that you need to use CREATE TYPE to use the type in SQL.
    However unless I am mistaken you appear to have invented your own syntax for CREATE TYPE, suggest you refer to Oracle documentation.

  • Function call returned in ref cursor

    We have a ref cursor that calls a function in a package. When ODP.NET reads the cursor, it can't see what the function is returning. OO4O works fine, and if I take the sql that populates the ref cursor and put it into a temporary table, then select from that temporary table to return the ref cursor to ODP, it works fine. Anyone else seen this issue? Any help would be appreciated. Thanks.
    Eric Schrauth
    [email protected]

    Did you set the parameter direction to be ParameterDirection.Input when you created the parameter? Post your code.

  • Returning a Ref cursor as an OUT Parameter

    Hi Guys
    I have defined 2 Types and 2 Ref cursors as shown below.I have written a procedure having 2 IN and 2 OUT parameters which are of type Ref cursors and return records to the calling client. My question is how can i test for the output of the two cursors here in pl/sql?.. also i should not close the sursors.. right?..its the job of the calling client as per my knowledge....Please suggest
    TYPE type_dept_Rec IS RECORD(deptNo varchar2);
    TYPE type_prod_Rec IS RECORD(prodType varchar2);
    TYPE deptCursor IS REF CURSOR RETURN type_dept_Rec;
    TYPE prodCursor IS REF CURSOR RETURN type_prod_Rec;
    PROCEDURE TEST (pinCode IN varchar2, prodType IN number, deptCursor OUT deptType, productCursor OUT deptType) IS
    BEGIN
    OPEN deptCursor FOR SELECT
    deptNo
    from
    DEPT
    where
    pinCode = pinCode;
    OPEN productCursor FOR SELECT
    prodCode
    from
    PROD
    where
    prodType = prodType;
    end;

    A Correction to the above code snippet
    Hi Guys
    I have defined 2 Types and 2 Ref cursors as shown below.I have written a procedure having 2 IN and 2 OUT parameters which are of type Ref cursors and return records to the calling client. My question is how can i test for the output of the two cursors here in pl/sql?.. also i should not close the sursors.. right?..its the job of the calling client as per my knowledge....Please suggest
    TYPE type_dept_Rec IS RECORD(deptNo varchar2);
    TYPE type_prod_Rec IS RECORD(prodType varchar2);
    TYPE deptCursor IS REF CURSOR RETURN type_dept_Rec;
    TYPE prodCursor IS REF CURSOR RETURN type_prod_Rec;
    PROCEDURE TEST (pinCode IN varchar2, prodType IN number, deptCursor OUT deptCursor, productCursor OUT prodCursor) IS
    BEGIN
    OPEN deptCursor FOR SELECT
    deptNo
    from
    DEPT
    where
    pinCode = pinCode;
    OPEN productCursor FOR SELECT
    prodCode
    from
    PROD
    where
    prodType = prodType;
    end

  • Problem declaring and using a REF CURSOR

    I'm having a real problem using a REF CURSOR type
    Here's the DECLARE and the start of the BEGIN I've so far developed.
    DECLARE
    TYPE r1 IS RECORD (
    szvcapc_pidm szvcapc.szvcapc_pidm%TYPE,
    szvcapc_term_code szvcapc.szvcapc_term_code%TYPE,
    szvcapc_request_no szvcapc.szvcapc_request_no%TYPE);
    szvcapc_rec r1;
    TYPE cursor_1 IS REF CURSOR RETURN r1;
    szvcapc_cv cursor_1;
    TYPE r2 IS RECORD (
    stvests_code stvests.stvests_code%TYPE
    stvests_rec r2;
    TYPE cursor_2 IS REF CURSOR RETURN stvests_rec;
    stvests_cv cursor_2;
    BEGIN
    OPEN szvcapc_cv FOR
    SELECT szvcapc_pidm, szvcapc_term_code, szvcapc_request_no
    FROM szvcapc
    WHERE szvcapc_passed_ind = 'Y'
    AND szvcapc_award_credits = 'N';
    LOOP
    FETCH szvcapc_cv INTO szvcapc_rec;
    EXIT WHEN szvcapc_cv%NOTFOUND;
    END LOOP;
    OPEN stvests_cv FOR
    SELECT stvests_code
    FROM stvests
    WHERE stvests_eff_headcount = 'Y';
    LOOP
    FETCH stvests_cv INTO stvests_rec;
    EXIT WHEN stvests_cv%NOTFOUND;
    END LOOP;
    SELECT *
    FROM (
    <snip>
    INNER JOIN stvests_rec
    ON SFBETRM.SFBETRM_ESTS_CODE = stvests_rec.STVESTS_CODE
    <snip>
    I later try to use the stvests_rec and szvcapc_rec in the main SELECT statement it doesn't recognise stvests_rec and szvcapc_rec as a "Table or View".
    I have to use a REF CURSOR as this code is ultimately for use in Oracle Reports.
    What am I doing wrong?

    > The reason I'm trying to use a REF CURSOR is that I was told that you
    couldn't use CURSORs in Oracle Reports.
    That does not change anything ito what happens on the Oracle server side. A cursor is a cursor is a cursor.
    Every single SQL winds up as a cursor. Each cursor has a reference handle to access and use. HOW this handle is used in the language differs. But that is a language issue and not an Oracle RDBMS issue.
    For example. An EXECUTE IMMEDIATE in PL/SQL creates a cursor handle and destroys it after use - automatically. An implicit cursor works the same. An explicit cursor you have the handle fetch from it and close from it when done.
    A ref cursor is simply a handle that can be returned to an external client - allowing that application to use the handle to fetch the rows.
    Do not think that a ref cursor is any different from the RDBMS side than any other cursor. The RDBMS does not know the difference. Does not care and nor should it.
    > I'm trying to reduce the hits on the database from nested selects by
    removing the dataset from the main SELECT statement and performing it only
    once outside and then referencing this previously collected dataset inside the
    main SELECT statement.
    Good stuff that you are considering SQL performance. But you need to make sure that you
    a) identify the performance inhibitor issue correctly
    b) address this issue correctly
    And you need to do that within SQL. Not PL/SQL. PL/SQL will always be slower at crunching data than SQL. For example, wanting to cache the data somehow to reduce the read overhead - that is exactly what the DB buffer cache does. It caches data. That is also exactly what the CBO will attempt - reduce the amount of data that needs to be read and processed.
    Not saying that the RDBMS can do it all. It needs help from you - in the form of a SQL that instructs it to process only the minimum amount of data required to get the required results. In the form of a sound physical design that provides optimal usage of data storage and access (like indexing, partitioning, clustering, etc).
    Bottom line - you cannot use a REF CURSOR to make a SQL go faster. A REF CURSOR is simply a cursor in the SQL Engine. A cursor is nothing but the "compiled-and-executable" code of a SQL "source program".

  • Plsql use a function which returns a ref cursor

    Hi
    I've been using an function which returns a ref cursor. I've been returning this into a java resultset. Fine!
    Now i'm in plsql and want to use the same function. I'm not sure how to get this resultset in plsql.

    It's not very practical to use a refcursor like you want to, but here you go
    create or replace function test_ref
    return sys_refcursor
    is
    v_rc sys_refcursor;
    begin
    open v_rc for select emp_name  from emp ;
    return v_rc;
    end;
    declare
    v_rc sys_refcursor;
    v_emp_name emp.emp_name%type;
    begin
    v_rc :=  test_ref ;
    loop
        fetch v_rc into v_emp_name ;
        exit when v_rc%notfound ;
        dbms_output.put_line('Employee Name: '||v_emp_name );
    end loop;
    end;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Procedure to RETURN a REF CURSOR

    Environment:
    OWB10g Client on Windows XP Professional
    Repository - 9.2.0.4 on UNIX (AIX 5.2)
    Target - 9.2.0.4 on UNIX (AIX 5.2)
    Is it possible to create a PROCEDURE in OWB that returns a REF CURSOR?
    It was not one of the TYPEs available when specifying the procedure parameters.
    Is this an enhancement that's coming if it's not possible today?
    Many thanks for all feedback. This is a great interactive discussion forum.
    Gary

    Good afternoon Gary,
    Have you checked whether it's possible to use the table-function?
    Don't know you specific requirements, but according to the explanation ("Table functions extend PL/SQL and are a new option in Oracle9i. This option allows a function to accept, process and return multiple rows.") it at least is capable of returning rowtypes.
    Cheers, Patrick

  • Hi,i am trying to edit a BP and i get this error;An attempt was made to execute a dynamic method callon an initial(NULL-) object reference. The reference must refer to an object. what could be missing?

    BP_....AccountActivitiesOV.htm....application BPBT.
    what could be wrong? An attempt was made to execute a dynamic method callon an initial(NULL-) object reference. The reference must refer to an object???

    Hi Dunamis,
    Please check if below links can help you;
    Error on execution of Web Interface
    Help! I meet this Business Server Page (BSP) error CX_SY_REF_IS_INITIAL
    Strange Error in Transformation of 2LiS_03_BF with 0IC_C03
    Regards,
    Kamfrk.

  • Cursors are not closed when using Ref Cursor Query in a report  ORA-01000

    Dear Experts
    Oracel database 11g,
    developer suite 10.1.2.0.2,
    application server 10.1.2.0.2,
    Windows xp platform
    For a long time, I'm hitting ORA-01000
    I have a 2 group report (master and detail) using Ref Cusor query, when this report is run, I found that it opens several cursors (should be only one cursor) for the detail query although it should not, I found that the number of these cursors is equal to the number of master records.
    Moreover, after the report is finished, these cursors are not closed, and they are increasing cumulatively each time I run the report, and finally the maximum number of open cursors is exceeded, and thus I get ORA-01000.
    I increased the open cursors parameter for the database to an unbeleivable value 30000, but of course it will be exceeded during the session because the cursors are increasing cumulatively.
    I Found that this problem is solved when using only one master Ref Cursor Query and create a breake group, the problem is solved also if we use SQL Query instead of Ref Query for the master and detail queries, but for some considerations, I should not use neither breake group nor SQL Query, I have to use REF Cursor queries.
    Is this an oracle bug , and how can I overcome ?
    Thanks
    Edited by: Mostafa Abolaynain on May 6, 2012 9:58 AM

    Thank you Inol for your answer, However
    Ref Cursor give me felxibility to control the query, for example see the following query :
    function QR_1RefCurDS return DEF_CURSORS.JOURHEAD_REFCUR is
    temp_JOURHEAD DEF_CURSORS.JOURHEAD_refcur;
              v_from_date DATE;
              v_to_date DATE;
              V_SERIAL_TYPE number;
    begin
    SELECT SERIAL_TYPE INTO V_SERIAL_TYPE
    FROM ACC_VOUCHER_TYPES
    where voucher_type='J'
    and IDENT_NO=:IDENT
    AND COMP_NO=TO_NUMBER(:COMPANY_NO);
         IF :no_date=1 then
                   IF V_SERIAL_TYPE =1 THEN     
                   open temp_JOURHEAD for select VOCH_NO, VOCH_DATE
                   FROM JOURHEAD
                   WHERE COMP_NO=TO_NUMBER(:COMPANY_NO)
                   AND IDENT=:IDENT
              AND ((TO_NUMBER(VOCH_NO)=:FROM_NO and :FROM_NO IS NOT NULL AND :TO_NO IS NULL)
              OR (TO_NUMBER(VOCH_NO) BETWEEN :FROM_NO AND :TO_NO and :FROM_NO IS NOT NULL AND :TO_NO IS NOT NULL )
              OR (TO_NUMBER(VOCH_NO)<=:TO_NO and :FROM_NO IS NULL AND :TO_NO IS NOT NULL )
              OR (:FROM_NO IS NULL AND :TO_NO IS NULL ))
                   ORDER BY TO_NUMBER(VOCH_NO);
                   ELSE
                   open temp_JOURHEAD for select VOCH_NO, VOCH_DATE
                   FROM JOURHEAD
                   WHERE COMP_NO=TO_NUMBER(:COMPANY_NO)
                   AND IDENT=:IDENT               
              AND ((VOCH_NO=:FROM_NO and :FROM_NO IS NOT NULL AND :TO_NO IS NULL)
              OR (VOCH_NO BETWEEN :FROM_NO AND :TO_NO and :FROM_NO IS NOT NULL AND :TO_NO IS NOT NULL )
              OR (VOCH_NO<=:TO_NO and :FROM_NO IS NULL AND :TO_NO IS NOT NULL )
              OR (:FROM_NO IS NULL AND :TO_NO IS NULL ))     
                   ORDER BY VOCH_NO;          
                   END IF;
         ELSE
                   v_from_date:=to_DATE(:from_date);
                   v_to_date:=to_DATE(:to_date);                         
              IF V_SERIAL_TYPE =1 THEN
                   open temp_JOURHEAD for select VOCH_NO, VOCH_DATE
                   FROM JOURHEAD
                   WHERE COMP_NO=TO_NUMBER(:COMPANY_NO)
              AND IDENT=:IDENT                         
                   AND ((voch_date between v_from_date and v_to_date and :from_date is not null and :to_date is not null)
                   OR (voch_date <= v_to_date and :from_date is null and :to_date is not null)
                   OR (voch_date = v_from_date and :from_date is not null and :to_date is null)
                   OR (:from_date is null and :to_date is null ))     
                   ORDER BY VOCH_DATE,TO_NUMBER(VOCH_NO);     
              ELSE
                   open temp_JOURHEAD for select VOCH_NO, VOCH_DATE
                   FROM JOURHEAD
                   WHERE COMP_NO=TO_NUMBER(:COMPANY_NO)
                   AND IDENT=:IDENT                         
              AND ((voch_date between v_from_date and v_to_date and :from_date is not null and :to_date is not null)
                   OR (voch_date <= v_to_date and :from_date is null and :to_date is not null)
                   OR (voch_date = v_from_date and :from_date is not null and :to_date is null)
                   OR (:from_date is null and :to_date is null ))     
                   ORDER BY VOCH_DATE,VOCH_NO;          
              END IF;
         END IF;               
         return temp_JOURHEAD;
    end;

  • EJB Handle return remote ref fails??

    Having a problem getting a remote reference on an EJB using a handle. Create a remote ref to an EJB and store three items and display said items - okay
    Get a handle to the remote ref and serialize and store - okay
    Deserialize - okay
    Cast to remote ref - NOT okay wants a home ref?
    This example is, by and large, similar to the example in section 6.8 of the EJB 2.0 Spec.
    Need to know why I cannot get the remote ref returned? Is there an OC4J issue? Please let me know when you can as would like to use this in a class.
    THANKS - Ken Cooper
    public class CartClient {
    public static void main(String[] args) {
    CartClient cartClient = new CartClient();
    try {
    Context context = getInitialContext();
    CartHome cartHome = (CartHome) PortableRemoteObject.narrow(context.lookup(
    "Cart"), CartHome.class);
    Cart cart;
    // Use one of the create() methods below to create a new instance
    cart = cartHome.create();
    // Call any of the Remote methods below to access the EJB
    // cart.getItems( );
    // cart.addItems( java.lang.String p );
    cart.addItems("Truck");
    cart.addItems("Car");
    cart.addItems("Boat");
    System.out.println(cart.getItems());
    // Serialize and store in C:\cartHandle
    Handle cartHandle = cart.getHandle();
    FileOutputStream out = new FileOutputStream("C:/cartHandle");
    ObjectOutputStream so = new ObjectOutputStream(out);
    so.writeObject(cartHandle);
    so.flush();
    System.out.println("Serialized");
    // Deserialize from C:\cartHandle
    FileInputStream in = new FileInputStream("C:/cartHandle");
    ObjectInputStream si = new ObjectInputStream(in);
    cartHandle = (Handle) si.readObject();
    System.out.println("DeSerialized");
    Cart cart2 = (Cart) PortableRemoteObject.narrow(cartHandle.getEJBObject(),
    Cart.class);
    System.out.println("Second: " + cart2.getItems());
    } catch (Throwable ex) {
    ex.printStackTrace();
    private static Context getInitialContext() throws NamingException {
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "com.evermind.server.rmi.RMIInitialContextFactory");
    env.put(Context.SECURITY_PRINCIPAL, "admin");
    env.put(Context.SECURITY_CREDENTIALS, "welcome");
    env.put(Context.PROVIDER_URL,
    "ormi://localhost:23891/current-workspace-app");
    return new InitialContext(env);
    OUTPUT AND ERROR FROM EXECUTION
    C:\JDev9031\jdk\bin\javaw.exe -ojvm -classpath C:\JDev9031\jdev\mywork\del15aug\Project4\classes;......
    Start: TruckCarBoat
    Serialized
    DeSerialized
    com.evermind.server.rmi.OrionRemoteException: Error looking up EJBHome at location 'Cart'
    javax.ejb.EJBObject com.evermind.server.ejb.StatefulSessionHandle.getEJBObject()
    StatefulSessionHandle.java:56
    void mypackage4.CartClient.main(java.lang.String[])
    CartClient.java:53 (NOTE: The highlighted line above is line 53)

    Thank you all guys for your suggests, and sorry for my (long) silence: i was at home with hard cough. I think that unfortunally the problem is more in deep. This because:
    1) at the beginnnig, in my (many) attempts I've tried to give the server url in a lot of ways:
    a) only the IP;
    b) http://<IP>;
    c) http://<IP>: <port>;
    d) http://<server-name>;
    e) http://<server-name>:<server-port>;
    b) iiop://<IP>;
    c) iiop://<IP>: <port>;
    d) iiop://<server-name>;
    e) iiop://<server-name>:<server-port>;
    In this cases, using init.put(org.omg.CORBA.ORBInitialHost,<param-value>) (init is Java Properties object), I didn't get what I would: always AppServer running on Win2000 responded me, instead of the one running on Linux.
    Using instead using init.put(Context.PROVIDER_URL,<param-value>) , in case a) I got the error message Root exception is java.net.MalformedURLException: no protocol:<IP-number>. In case b), c), d) and e) I got invalid url - connection refused error message (Invalid URL: http://gandalf.engiweb.com. Root exception is java.net.ConnectException: Connection refused: connect).
    A collegue of mine is using WebSphere and everything seems to work correctly. I'm afraid that there is a problem (of misconfiguration?) in the Borland Application Server. This is a problem, because, if I have (suppose) server gandalf running, with the correct EJB, and the server Saruman running too, but with the scorrect EJB, or the ejb container down, always respond me Saruman, not Gandalf: my tests gave me this result.
    At the moment I don't know what to do, except migrate to WebSphere, or another Application Server.
    Thank you a lot for your interest. Bye!

  • Using Ref Cursor in procedure in place of normal cursor

    Hi,
    I have a procedure where i have the follwoing cursors declared,
    CURSOR c_wip IS
    SELECT tdvalue
    FROM tabledetails
    WHERE tdidcode = 'PEL_DASHBOARD'
    AND tdkey LIKE 'WIP_QUEUES%';
    CURSOR c_pending IS
    SELECT tdvalue
    FROM tabledetails
    WHERE tdidcode = 'PEL_DASHBOARD'
    AND tdkey LIKE 'PENDING_QUEUES%';
    CURSOR c_out IS
    SELECT tdvalue
    FROM tabledetails
    WHERE tdidcode = 'PEL_DASHBOARD'
    AND tdkey LIKE 'OUT_QUEUES%';
    CURSOR c_out_status IS
    SELECT tdvalue
    FROM tabledetails
    WHERE tdidcode = 'PEL_DASHBOARD'
    AND tdkey LIKE 'OUT_STATUS%';
    Will the usage of 1 ref cursor instead of the 4 cursors increase the performance.
    Thanks.

    Cursor is a structure which points to a memory locations.
    While a Ref-cursor is a datastructure which point to a object which inturn points to Memory locations.
    The advantage of having Ref-cursor is that we can pass dynamically the Ref-cursor as a parameter to a procedures.
    So it does improve the performance to a small extent.

Maybe you are looking for

  • My Noisy 24" HD

    Well..it's almost 2 weeks since I got my new 24' Imac. It's beautiful..no dead pixels and the fans are silent. The issue is the noisy Seagate HD. This is my second Intel Mac in less than a year, so I have some basis of comparison when it comes to noi

  • Call function starting new task:

    I am trying to create a program in which few database update are mentioned. after database updates , I am calling a function module using starting new task in which I want to commit database updates inside in function module. Problem is I want to com

  • Material Master Purchase Order Text.

    Hi Guys, What is table and Field name where "Purchase order Text"  stored. Reg, Gopi

  • ID and Password problem

    After down loading an update for the flash player, I am asked for a password.  I have no record of any such password. If I enter my adobe ID (email address) and password, a window appears stating that either the ID or the password is incorrect. I res

  • One sender n multiple receiver for BPM

    Hi, In BPM ( one sender to Multpli receivers ( file to IDOC ) i need to split the incoming message as per message content to multiple receivers,can we achive such scenario without using BPM?if yes how? if not why? Thanks in advance.