Cursors returned from a package

Ok, I've done this a long time ago but how do I get a package to return a cursor?
Here's my spec...
CREATE OR REPLACE PACKAGE reservationhistory AS
TYPE ResType IS RECORD
               (resid integer,
               status varchar2(2));
PROCEDURE getHistory(i_providerid in integer,
     resdetail in out ResType,
     o_error_code out varchar2);
END reservationhistory;
Here's my attempt at the body...
CREATE OR REPLACE PACKAGE BODY reservationhistory AS
PROCEDURE getHistory(i_providerid in integer,
          resdetail in out ResType,
          o_error_code out varchar2) IS
BEGIN
OPEN resdetail FOR
               select bookingid resid, status, providerid from booking
               where providerid = i_providerid;
          o_error_code := 0;
END getHistory;
END reservationhistory;
But it doesn't like this.
What am I missing???
Thanks,
Todd

Thanks, I tried that and but it still doesn't work. The following code gives me this error:
LINE/COL ERROR
10/9 PLS-00306: wrong number or types of arguments in call to
'RESDETAIL'
10/9 PL/SQL: SQL Statement ignored
Here's the code...
CREATE OR REPLACE PACKAGE reservationhistory AS
TYPE ResType IS ref cursor;
PROCEDURE getHistory(i_providerid in integer,
     resdetail in out ResType,
     o_error_code out varchar2);
END reservationhistory;
CREATE OR REPLACE PACKAGE BODY reservationhistory AS
PROCEDURE getHistory(i_providerid in integer,
          resdetail in out ResType,
          o_error_code out varchar2) IS
BEGIN
OPEN resdetail FOR
               select bookingid resid, status, providerid from booking
               where providerid = i_providerid;
          o_error_code := 0;
END getHistory;
END reservationhistory;
I appreciate your help on this.

Similar Messages

  • REF CURSOR RETURNED FROM STORED PROCEDURE OPENED WITH CURRENT_USER PRIVILEGES

    Hi.
    I was wondering if anyone knows when this bug will be fixed. The bug# is 899567 off of metalink.
    I am running into this problem as well, and we do not want to use OCI/SQLNet as the fix. We have an application with secure data concerns and only want to give access to stored procedures to an application user.
    Thanks,
    Brad

    I'm using version 8.1.6.0.0 on a W2K server.
    PS: a strange behaveour
    if i try to insert a row using the following anonymous pl/sql block
    begin
    insert into objects select 2, 'B', ref(c) from meta.classes c where id =1;
    end;
    i get the following error msg
    ERROR at line 1:
    ORA-06552: PL/SQL: Compilation unit analysis terminated
    ORA-06553: PLS-302: component 'OBJ_T' must be declared
    but if i use only the sql command from the sql plus prompt
    insert into objects select 2, 'B', ref(c) from meta.classes c where id =1;
    the row is inserted.
    OBJ_T is the object type(id number, label varchar2, class ref class_t),
    OBJECTS is a table of obj_t,
    CLASS_T is an object type(id number, label varchar2)
    CLASSES is a table of CLASS_T.
    null

  • Can't create WS from PLSQL package (Jdeveloper 11g 4) (Exception occured)

    Hello,
    I'am using JDeveloper 11g preview 4.
    On database i have a package with 2 procedures.
    When I like to create a WS from database package I get the Exception:
    java.lang.ClassCastException: oracle.jdeveloper.webservices.model.plsql.PLSQLPortType
         at oracle.jdeveloper.webservices.model.generator.AddToDeploymentProfiles.getJarFiles(AddToDeploymentProfiles.java:592)
         at oracle.jdeveloper.webservices.model.generator.AddToDeploymentProfiles.action(AddToDeploymentProfiles.java:292)
         at oracle.jdeveloper.webservices.model.generator.GeneratorAction.run(GeneratorAction.java:147)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
         at java.awt.Dialog$1.run(Dialog.java:525)
         at java.awt.Dialog$2.run(Dialog.java:553)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.awt.Dialog.show(Dialog.java:551)
         at java.awt.Component.show(Component.java:1300)
         at java.awt.Component.setVisible(Component.java:1253)
         at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
         at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
         at oracle.ide.dialogs.ProgressBar.start(ProgressBar.java:361)
         at oracle.ide.dialogs.ProgressBar.start(ProgressBar.java:222)
         at oracle.ide.dialogs.ProgressBar.start(ProgressBar.java:194)
         at oracle.jdeveloper.webservices.model.Model.saveEditSync(Model.java:242)
         at oracle.jdevimpl.webservices.wizard.jaxrpc.PLSQLWizard.runWizard(PLSQLWizard.java:366)
         at oracle.jdevimpl.webservices.wizard.jaxrpc.PLSQLWizard.runWizard(PLSQLWizard.java:137)
         at oracle.jdevimpl.webservices.WebServicesAddin.fastCreatePlSqlService(WebServicesAddin.java:1503)
         at oracle.jdevimpl.webservices.WebServicesAddin.handleEvent(WebServicesAddin.java:870)
         at oracle.ide.controller.IdeAction.performAction(IdeAction.java:513)
         at oracle.ide.controller.IdeAction.actionPerformedImpl(IdeAction.java:843)
         at oracle.ide.controller.IdeAction.actionPerformed(IdeAction.java:486)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
         at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
         at javax.swing.plaf.basic.BasicMenuItemUI$Handler.menuDragMouseReleased(BasicMenuItemUI.java:1104)
         at javax.swing.JMenuItem.fireMenuDragMouseReleased(JMenuItem.java:578)
         at javax.swing.JMenuItem.processMenuDragMouseEvent(JMenuItem.java:475)
         at javax.swing.JMenuItem.processMouseEvent(JMenuItem.java:422)
         at javax.swing.MenuSelectionManager.processMouseEvent(MenuSelectionManager.java:283)
         at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1043)
         at java.awt.Component.processMouseEvent(Component.java:5501)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
         at java.awt.Component.processEvent(Component.java:5266)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3968)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1778)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    Exception from Jdeveloper console
    Validating XML...
    Validating C:\Generali\WsGenerali\public_html\WEB-INF\web.xml
    Validate XML: 0 errors, 0 warnings.
    Aug 13, 2008 1:20:20 PM oracle.javatools.logging.LogUtils log
    WARNING: Exception in task oracle.jdeveloper.webservices.model.generator.FixLocationAttribute$1@1fa522d on model oracle.jdevimpl.webservices.wsdl.WSDLXmlModel@129271e; txn name=null
    java.lang.NullPointerException
         at oracle.jdeveloper.webservices.model.generator.FixLocationAttribute$1.performTask(FixLocationAttribute.java:72)
         at oracle.bali.xml.model.task.StandardTransactionTask.runThrowingXCE(StandardTransactionTask.java:172)
         at oracle.bali.xml.model.task.StandardTransactionTask.run(StandardTransactionTask.java:103)
         at oracle.jdeveloper.webservices.model.generator.FixLocationAttribute.action(FixLocationAttribute.java:51)
         at oracle.jdeveloper.webservices.model.generator.GeneratorAction.run(GeneratorAction.java:147)
         at java.lang.Thread.run(Thread.java:595)
    Aug 13, 2008 1:20:20 PM oracle.j2ee.xml.XMLMessages warningException
    WARNING: Exception Encountered
    Aug 13, 2008 1:20:20 PM oracle.j2ee.xml.XMLMessages warningException
    WARNING: Exception Encountered
    Aug 13, 2008 1:20:20 PM oracle.j2ee.xml.XMLMessages warningException
    my procedures are:
    type r_sifrant is record
    ( id number,
    nadrejeni_id number,
    opis varchar2(100),
    privzeto varchar2(1)
    type r_cursor is ref cursor return r_sifrant;
    function f_sel_sifrant(p_naziv in varchar2) return r_cursor;
    procedure gen_polica(p_username in varchar2, p_polica_xml in clob, p_stevilka_police out number);
    Here I have posted a video of generating ws from plsql package (screen capture):
    http://shrani.si/f/x/P6/m5GSF8c/in2.avi
    Thank you for any help
    best regards
    Peterv
    Message was edited by:
    user651799

    Hello,
    I'am using JDeveloper 11g preview 4.
    On database i have a package with 2 procedures.
    When I like to create a WS from database package I get the Exception:
    java.lang.ClassCastException: oracle.jdeveloper.webservices.model.plsql.PLSQLPortType
         at oracle.jdeveloper.webservices.model.generator.AddToDeploymentProfiles.getJarFiles(AddToDeploymentProfiles.java:592)
         at oracle.jdeveloper.webservices.model.generator.AddToDeploymentProfiles.action(AddToDeploymentProfiles.java:292)
         at oracle.jdeveloper.webservices.model.generator.GeneratorAction.run(GeneratorAction.java:147)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
         at java.awt.Dialog$1.run(Dialog.java:525)
         at java.awt.Dialog$2.run(Dialog.java:553)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.awt.Dialog.show(Dialog.java:551)
         at java.awt.Component.show(Component.java:1300)
         at java.awt.Component.setVisible(Component.java:1253)
         at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
         at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
         at oracle.ide.dialogs.ProgressBar.start(ProgressBar.java:361)
         at oracle.ide.dialogs.ProgressBar.start(ProgressBar.java:222)
         at oracle.ide.dialogs.ProgressBar.start(ProgressBar.java:194)
         at oracle.jdeveloper.webservices.model.Model.saveEditSync(Model.java:242)
         at oracle.jdevimpl.webservices.wizard.jaxrpc.PLSQLWizard.runWizard(PLSQLWizard.java:366)
         at oracle.jdevimpl.webservices.wizard.jaxrpc.PLSQLWizard.runWizard(PLSQLWizard.java:137)
         at oracle.jdevimpl.webservices.WebServicesAddin.fastCreatePlSqlService(WebServicesAddin.java:1503)
         at oracle.jdevimpl.webservices.WebServicesAddin.handleEvent(WebServicesAddin.java:870)
         at oracle.ide.controller.IdeAction.performAction(IdeAction.java:513)
         at oracle.ide.controller.IdeAction.actionPerformedImpl(IdeAction.java:843)
         at oracle.ide.controller.IdeAction.actionPerformed(IdeAction.java:486)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
         at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
         at javax.swing.plaf.basic.BasicMenuItemUI$Handler.menuDragMouseReleased(BasicMenuItemUI.java:1104)
         at javax.swing.JMenuItem.fireMenuDragMouseReleased(JMenuItem.java:578)
         at javax.swing.JMenuItem.processMenuDragMouseEvent(JMenuItem.java:475)
         at javax.swing.JMenuItem.processMouseEvent(JMenuItem.java:422)
         at javax.swing.MenuSelectionManager.processMouseEvent(MenuSelectionManager.java:283)
         at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1043)
         at java.awt.Component.processMouseEvent(Component.java:5501)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
         at java.awt.Component.processEvent(Component.java:5266)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3968)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1778)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    Exception from Jdeveloper console
    Validating XML...
    Validating C:\Generali\WsGenerali\public_html\WEB-INF\web.xml
    Validate XML: 0 errors, 0 warnings.
    Aug 13, 2008 1:20:20 PM oracle.javatools.logging.LogUtils log
    WARNING: Exception in task oracle.jdeveloper.webservices.model.generator.FixLocationAttribute$1@1fa522d on model oracle.jdevimpl.webservices.wsdl.WSDLXmlModel@129271e; txn name=null
    java.lang.NullPointerException
         at oracle.jdeveloper.webservices.model.generator.FixLocationAttribute$1.performTask(FixLocationAttribute.java:72)
         at oracle.bali.xml.model.task.StandardTransactionTask.runThrowingXCE(StandardTransactionTask.java:172)
         at oracle.bali.xml.model.task.StandardTransactionTask.run(StandardTransactionTask.java:103)
         at oracle.jdeveloper.webservices.model.generator.FixLocationAttribute.action(FixLocationAttribute.java:51)
         at oracle.jdeveloper.webservices.model.generator.GeneratorAction.run(GeneratorAction.java:147)
         at java.lang.Thread.run(Thread.java:595)
    Aug 13, 2008 1:20:20 PM oracle.j2ee.xml.XMLMessages warningException
    WARNING: Exception Encountered
    Aug 13, 2008 1:20:20 PM oracle.j2ee.xml.XMLMessages warningException
    WARNING: Exception Encountered
    Aug 13, 2008 1:20:20 PM oracle.j2ee.xml.XMLMessages warningException
    my procedures are:
    type r_sifrant is record
    ( id number,
    nadrejeni_id number,
    opis varchar2(100),
    privzeto varchar2(1)
    type r_cursor is ref cursor return r_sifrant;
    function f_sel_sifrant(p_naziv in varchar2) return r_cursor;
    procedure gen_polica(p_username in varchar2, p_polica_xml in clob, p_stevilka_police out number);
    Here I have posted a video of generating ws from plsql package (screen capture):
    http://shrani.si/f/x/P6/m5GSF8c/in2.avi
    Thank you for any help
    best regards
    Peterv
    Message was edited by:
    user651799

  • Creating a function having a ref cursor returned

    I get an error message for the following code below. I am trying to create a function that allows the users to pass in a certain parameter which is used to invoke a specific query for the paramented passed in. Once the query is invoked, it should return a ref cursor. Please help. I am still using pl/Sql developer.
    create or replace package TEST2 is
    type rec_DropDownList_Item is RECORD(
    TEXT_TYPE VARCHAR2(200),
    xsVALUE VARCHAR2(200));
    TYPE cur_DropDownList IS REF CURSOR RETURN rec_DropDownList_Item;
    FUNCTION Getprocedure_yearreportdisplay (need_type in VARCHAR2) RETURN cur_DropDownList;
    end TEST2;
    create or replace package body TEST2 is
    FUNCTION Getprocedure_yearreportdisplay (need_type in VARCHAR2)
    RETURN cur_DropDownList IS
    my_ref_cursor cur_DropDownList;
    BEGIN
    OPEN my_ref_cursor FOR
    SELECT vehicletype, vehicledescription
    FROM cars where vehicletype = need_type;
    return my_ref_cursor;
    END Getprocedure_yearreportdisplay;
    end TEST2;

    user13046875 wrote:
    a simple example might help because I am having a difficult understanding the reply. Thank you.
    create or replace package TEST2 is
       type rec_DropDownList_Item is RECORD(
       TEXT_TYPE VARCHAR2(200),
       xsVALUE VARCHAR2(200));
       TYPE cur_DropDownList IS REF CURSOR RETURN rec_DropDownList_Item;
       FUNCTION Getprocedure_yearreportdisplay (need_type in VARCHAR2) RETURN cur_DropDownList;
    end TEST2;
    create or replace package body TEST2 is
    FUNCTION Getprocedure_yearreportdisplay (need_type in VARCHAR2)
    RETURN cur_DropDownList IS
    my_ref_cursor cur_DropDownList;
    BEGIN
       OPEN my_ref_cursor FOR
       SELECT 'column1', 'column2'
       FROM dual;
       return my_ref_cursor;
    END Getprocedure_yearreportdisplay;
    end TEST2;
    TUBBY_TUBBZ?variable x refcursor;
    TUBBY_TUBBZ?
    TUBBY_TUBBZ?exec :x := TEST2.Getprocedure_yearreportdisplay('dummy');
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.01
    TUBBY_TUBBZ?print :x
    'COLUMN 'COLUMN
    column1 column2
    1 row selected.
    Elapsed: 00:00:00.03
    TUBBY_TUBBZ?Is an example of running in SQLPLUS (you may want to get your own copy, it's free and available on OTN).

  • How to read my cursor that is ref cursor returning user defined type

    Hi
    I have types defined as follows:
    TYPE MY_RECORD IS RECORD (
    COL1 TABLE1.COL1%TYPE,
    COL2 TABLE1.COL2%TYPE
    TYPE MY_CURSOR IS REF CURSOR
    RETURN MY_RECORD;This is used as return type in a stored procedure.
    I have a pl/sql block where I make a call to the SP that returns this cursor.
    How can I read individual values being returned from SP?

    SQL> create or replace package pkg
    as
       type my_record is record (col1 emp.empno%type, col2 emp.ename%type);
       type my_cursor is ref cursor
          return my_record;
       procedure p (cur out my_cursor);
    end pkg;
    Package created.
    SQL> create or replace package body pkg
    as
       procedure p (cur out my_cursor)
       as
       begin
          open cur for
             select   empno, ename
               from   emp
              where   rownum <= 2;
       end p;
    end pkg;
    Package body created.
    SQL> declare
       cur     pkg.my_cursor;
       e_rec   pkg.my_record;
    begin
       pkg.p (cur);
       loop
          fetch cur into   e_rec;
          exit when cur%notfound;
          dbms_output.put ('Empno: ' || e_rec.col1);
          dbms_output.put_line ('; Ename: ' || e_rec.col2);
       end loop;
       close cur;
    end;
    Empno: 7369; Ename: SMITH
    Empno: 7499; Ename: ALLEN
    PL/SQL procedure successfully completed.

  • Ref cursor returns login ids

    I have this ref cursor that returns login ids from a procedure.
    While I can define the ref cursor as sys_refcursor; I want to use strongly typed ref cursor ( for improved readabilty of code).
    But I guess I can not define the cursor that returns %type.
    e.g. Type return_login_id IS REF CURSOR return tab1.login_id%type;
    On compilation the package threw an error saying the return type should be record.
    I need to define a record with one column and use that as return type ?
    any other way around ?
    TIA
    S

    Btw, why you need to use REF Cursor?
    You can use just a cursor:
    SQL> declare
      2  cursor c1 is select empid from emp;
      3  TYPE my_id IS TABLE OF emp.empid%type;
      4  myid my_id := my_id();
      5  BEGIN
      6  OPEN c1;
      7  FETCH c1 BULK COLLECT INTO myid;
      8  CLOSE c1;
      9  END;
    10  /
    PL/SQL procedure successfully completed.
    SQL>

  • Ref cursor return type

    i am using a ref cursor as out parameter in a stored procedure.
    When I call the stored procedure and want to retrieve the rows returned by the ref cursor,
    is there a way to fetch the records using something like %ROWTYPE if I donot know the type of rows returned by the cursor.
    eg.
    procedure my_test_ref_cursor ( a OUT SYS_REFCURSOR) IS
    BEGIN
    OPEN a FOR SELECT EMP_ID, EMP_NAME FROM EMP;
    END;
    procedure call_my_test_ref_cursor is
    b sys_refcursor;
    begin
    my_test_ref_cursor(b);
    fetch b into XXXXXXX - if this program doesnot know the type of ref cursor 'b' is pointing to is there a way to use
    something like %ROWTYPE here ?
    end;

    While you can use the logic to return a weakly typed reference cursor, there should be a compelling why. A strongly typed reference cursor may be a better solution. You define a strongly typed reference cursor inside a package, and you anchor it to a ROWTYPE. Weakly typed reference cursors are typically useful when you are working with a subset of a table because you can't anchor to part of a table. However, you can define a view that uses the portion of the table and anchor a strongly typed reference cursor to the view.
    A strongly typed PL/SQL reference cursor is defined like this in a package specification:
    TYPE strongly_typed_cursor IS REF CURSOR RETURN some_table%ROWTYPE;
    So, if you rewrote it like this ...
    PROCEDURE my_test_ref_cursor (a OUT SOME_PACKAGE.STRONGLY_TYPED_CURSOR) IS
    BEGIN
    OPEN a FOR SELECT emp_id, emp_name FROM emp;
    END;
    Now, you can access it like this ...
    PROCEDURE call_my_test_ref_cursor IS
    another_var SOME_PACKAGE.STRONGLY_TYPED_CURSOR;
    target SOME_TABLE%ROWTYPE;
    BEGIN
    my_test_ref_cursor(another_var);
    LOOP
    FETCH another_var INTO target;
    EXIT WHEN another_var%NOTFOUND;
    dbms_output.put_line('See it '||target.emp_name||'.');
    END LOOP;
    END;
    The DBMS_SQL method you're looking for is Method 4. My recollection is that there isn't a good example in the docs but I could be wrong ... The OCI works no differently, nor does the JDBC interface. Hope this helps.

  • "An error occurred while extracting files from the package "BaseSystem.pkg".

    Hello!
    I have a
    MacBookPro5,5
    Prozessortyp:Intel Core 2 Duo
    Prozessorgeschwindigkeit:2.26 GHz
    Anzahl der Prozessoren:1
    Gesamtzahl der Kerne:2
    L2-Cache:3 MB
    Speicher:2 GB
    Busgeschwindigkeit:1.07 GHz
    Boot-ROM-Version:MBP55.00AC.B03
    SMC-Version (System):1.47f2
    Hardware-UUID:A2DD27C4-9829-5A4D-854B-485EF8A6B20F
    Problem:
    I upgraded Leopard to Snow Leopard. Everything worked fine for a month. To free up disk space I deleted some of the iPhoto flders (modfied and original images). Everything worked still fine. Shut down the computer. Next day it was incredibly slow. At the same time the indexing was running. I stopped indexing, but stll slow. Every operation took minutes. I tried all the tricks that I found in the internet (repaired file permissions, repaired disk, cleared PRAM , moved big filed from desktop, etc.). After 24 full hours of trying all this I decided to erase the hard drive and reinstall, directly from the Snow Leopard Install disk, but it fails after downloading the packages. Below is the part of the log. Then I tried to use the old Leopard install DVD to reinstall Leopard, it then sais estimated time 12 hours or so and eventually crashed, spitting out a lot of "reportcrash" in the log. What is going on? I'm running out of options. Any advice? Would zeroing the hard drive help? If nothing else I plan to buy a new hard drive, since the only explanation I have is that there is a problem with the hard driven although the disk utility says it is OK. I need a bigger one anyway. Any ideas? Thank you!
    Aug 16 05:17:31 localhost OSInstaller[139]: IFPKInstallElement (191 packages)
    Aug 16 05:17:35 localhost OSInstaller[139]: PackageKit: ----- Begin install -----
    Aug 16 05:17:35 localhost OSInstaller[139]: PackageKit: request=PKInstallRequest <191 packages, destination=/Volumes/Macintosh HD>
    Aug 16 05:17:36 localhost OSInstaller[139]: PackageKit: Extracting /Volumes/Macintosh HD/Mac OS X Install Data/BaseSystem.pkg (destination=/Volumes/Macintosh HD/.OSInstallSandbox-tmp/Root, uid=0)
    Aug 16 05:31:59 localhost Unknown[80]: /SourceCache/AppleFSCompression/AppleFSCompression-24.0.1/Common/DataPool.c:116 : Error: finished pool without filling it
    Aug 16 05:31:59 localhost Unknown[80]: /SourceCache/AppleFSCompression/AppleFSCompression-24.0.1/Common/commonUtils.c: 315: Error: fh_pread -1
    Aug 16 05:31:59 localhost Unknown[80]: /SourceCache/AppleFSCompression/AppleFSCompression-24.0.1/Common/StreamCompress or.c:236: Error: write failed for /Volumes/Macintosh HD/.OSInstallSandbox-tmp/Root//System/Library/Frameworks/OpenCL.framework/Versi ons/A/Resources/runtime.amdil.bc: Invalid argument
    Aug 16 05:31:59 localhost Unknown[80]: /SourceCache/AppleFSCompression/AppleFSCompression-24.0.1/Common/StreamCompress or.c:260: Error: futimes failed for /Volumes/Macintosh HD/.OSInstallSandbox-tmp/Root//System/Library/Frameworks/OpenCL.framework/Versi ons/A/Resources/runtime.amdil.bc: Invalid argument
    Aug 16 05:31:59 localhost Unknown[80]: /SourceCache/AppleFSCompression/AppleFSCompression-24.0.1/Common/StreamCompress or.c:829: Error: returning errno 22 from FinishStreamCompressorQueue
    Aug 16 05:32:10 localhost OSInstaller[139]: PackageKit: Install Failed: PKG: extracting "com.apple.pkg.BaseSystem"\nError Domain=PKInstallErrorDomain Code=110 UserInfo=0x12c8366a0 "An error occurred while extracting files from the package “BaseSystem.pkg”." Underlying Error=(Error Domain=BOMCopierFatalError Code=22 UserInfo=0x12e703300 "The operation couldn’t be completed. FinishStreamCompressorQueue error") {\n    NSFilePath = "/Volumes/Macintosh HD/.OSInstallSandbox-tmp/Root";\n    NSLocalizedDescription = "An error occurred while extracting files from the package \U201cBaseSystem.pkg\U201d.";\n    NSURL = "BaseSystem.pkg -- file://localhost/Volumes/Macintosh%20HD/Mac%20OS%20X%20Install%20Data/index.pro duct";\n    NSUnderlyingError = "Error Domain=BOMCopierFatalError Code=22 UserInfo=0x12e703300 \"The operation couldn\U2019t be completed. FinishStreamCompressorQueue error\"";\n    PKInstallPackageIdentifier = "com.apple.pkg.BaseSystem";\n}
    Aug 16 05:32:10 localhost OSInstaller[139]: install:didFailWithError:Error Domain=PKInstallErrorDomain Code=110 UserInfo=0x12c8366a0 "An error occurred while extracting files from the package “BaseSystem.pkg”." Underlying Error=(Error Domain=BOMCopierFatalError Code=22 UserInfo=0x12e703300 "The operation couldn’t be completed. FinishStreamCompressorQueue error")
    Aug 16 05:32:11 localhost OSInstaller[139]: Install failed: Die Installation ist aufgrund eines Fehlers fehlgeschlagen. Wenden Sie sich an den Hersteller der Software.
    Aug 16 05:32:13 localhost OSInstaller[139]: Allowing machine sleep.
    Aug 16 05:32:15 localhost OSInstaller[139]: Memory statistics for 'Installation ist fehlgeschlagen' pane:
    Aug 16 05:32:15 localhost OSInstaller[139]: Physical Memory Allocation:   139 MB wired,   259 MB trapped,   397 MB active,     7 MB inactive,  1246 MB free,  1650 MB usable,  2048 MB total

    It sounds to me like your Internal Hard Drive is failing.
    I recommend you buy a new one, that is a good candidate for replacing the old one, but install it in an External enclosure and Install a fresh Mac OS X on it from the DVD. You can boot your Mac from any attached drive.
    The new System can be used to get some work done, check your emails, and takes the pressure off resolving this immediately. You can also attempt to salvage files off the old drive if needed.
    Once things seem to be working, then move the new drive inside the computer. Failures at this point may be due to bad cable, which has been a problem in some of these MacBooks.
    Use security erase, write Zeroes, one pass, to re-write every block on the old drive. Any block discovered to be bad will be replaced with spares the drive holds in reserve for this purpose. If more than 10 blocks are pared on one pass, "Initialization Failed!" will be the result. Although you can try the erase again, there is some question whether you want to trust this drive with your precious data.

  • FTP task runs fine from SSIS Package Store, always times out in scheduled job

    SQL Server 2012
    VS 2010 SQL Server data tools
    FTP Connection Manager
     - port 21, chunk size 1kb, passive mode=false, saved plain text pw
    Downloads 1 csv file to local directory on SQL Server box
    This always works when run from the package.  And always gives a timeout error when scheduled.
    Message
    Microsoft (R) SQL Server Execute Package Utility
    Version 11.0.2100.60 for 64-bit
    Started:  11:04:59 AM
    Error: 2014-03-27 11:05:31.12
       Code: 0xC001602A
       Source: xxx Connection manager "FTP Acme1"
       Description: An error occurred in the requested FTP operation. Detailed error description: The operation timed out
    End Error
    Error: 2014-03-27 11:05:31.14
       Code: 0xC002F304
       Source: Acme FTP Task
       Description: An error occurred with the following error message: "An error occurred in the requested FTP operation. Detailed error description: The operation timed out".
    End Error
    DTExec: The package execution returned DTSER_FAILURE (1).
    Started:  11:04:59 AM
    Finished: 11:05:31 AM
    Elapsed:  31.949 seconds
    SQL Server Agent is set to Logon As my domain account, and in the package history it says "logged on as " my account.
    Any suggestions?  Thank you

    You're right, Arthur. Earlier when I tried running the package with dtexecui it did popup a Win7 firewall warning. Agreed with prompt to allow "SQL Server 2008 Integration Services Package Execution Utility" and it added C:\program
    files (x86)\microsoft sql server\110\tools\binn\managementstudio\dtexecui.exe,  to allowed programs. No problem with dtexec after that.
    Do you know of any other firewall exceptions that would be good to try?  Thanks!
    Yeah, this pop up resulted in the timeout because it was hidden but awaiting acknowledgement.
    The other thing off the top of my head would be the FTP port 21 if TCP is used.
    Arthur My Blog

  • How to find if cursor returned rows

    If i have a procedure like
    create procedure test as
    cursor cur_test is
    select col
    from table;
    begin
         delete from tab1 a;
         for var_cur_test in cur_test
         loop
              insert into temp
              values(var_cur_test.col);
         end loop;
         commit;
    end;
    How do I check if the cursor has returned any rows?
    I dont want to delete from tab1 if cursor 'cur_test' does not return any rows and I want to exit out of the proc.
    If the cursor returns rows > 0 then I want to delete and do the insert.
    Thanks for the help.

    The scenario is like this.
    There is a schema A which has to run a process and populate its tables and at the end of the process(java program) run the procedure which is in schema B to pull data from schema A and populate the tables in schema B. If there is a case where Schema A's process fails( then Schema A's tables end up with no data), the process is still running the procedure in schema B and deleting the data in tables with no data being inserted.
    So, I have to check in the procedure if the tables in Schema A have any data before the process can run the proc.
    I tried the solution you provided but it returns no data
    CREATE OR REPLACE PROCEDURE MMA_TEST
    VAR_CONTRACT_ID VARCHAR2
    AS
    CURSOR CUR_TEST IS
    SELECT CMS_CONTRACT_ID,CMS_PLAN_ID
    FROM MMA_PLANS
    WHERE CMS_CONTRACT_ID = VAR_CONTRACT_ID;
    BEGIN
         for var_cur_test in cur_test
         loop
              if (cur_test%rowcount = 1) then
              delete from temp ;
              end if ;
              insert into temp
              values(var_cur_test.cms_contract_id,var_cur_test.cms_plan_id);
         end loop;
    end;

  • Periodic Alert-How to send all the records returned from the SQL in a mail?

    Hello all,
    I have defined a Periodic Alert, my SQL query returns more than one record whenever I run it. I also defined an action to send an email with the message consisting of the output variables from the SQL. Whenever i run this alert, a mail is being sent for every single record returned from the query. But i want to send a single mail containing all the records information that my SQL query returns.
    For Example: My SQL query lists all the users created on current date.
    Select User_Id, User_Name into &OUTPUT1, &OUTPUT2
    from fnd_users where trunc(creation_date) = trunc(sysdate)
    Now i want to send a mail with all the users information from the above query, to SYSADMIN. How can this be achieved?
    Thanks & Regards
    chakoo

    Hi Chakoo,
    If the Periodic Alert is not working as requried. You can write a simple package with 3 procedures to implement the writing output to a out file and simultaneuosly send email to multiple receiptents.
    Example:
    Create Package xx_pac
    Create public Procedure P1
    begin
    Select User_Id, User_Name into &OUTPUT1, &OUTPUT2
    from fnd_users where trunc(creation_date) = trunc(sysdate)
    fnd_file.put_line (fnd_file.output, &OUTPUT1, &OUTPUT2);
    end;
    (Create private Procedure P2
    begin
    ---Write the email package using the UTL_SMTP approch. Using this approch you can send the procedure P1 output file as an attachment to the desiginated receiptents.
    end;
    (Create public Procedure P3
    begin
    ---call the procedure P1 using the "g_request_id = fnd_request.submit_request"
    ---Wait for the above procedure to complete using "l_conc_status := fnd_concurrent.wait_for_request" procedure.
    ---call the procedure P2. (When called you must provide the correct to, from address)
    end;
    end;
    Register the Package xx_pac as a concurrent program and schedule when submit it from the request.
    Regards
    Arun Rathod

  • Building the varchar string to return from a pl sql function

    i'm new with pl/sql and i'm having trouble trying to build the string that i want to return from a function that is inside a package. it seems my problem stems from the fact that i'm trying to incorporate a variable (varchar2) into the string to be returned. below are two attempts that i've made which do not work:
    function test_policy (p_schema_name IN varchar2, p_object_name IN varchar2) return varchar2 as
    predicate_value varchar2(2000);
    user_name varchar2(100);
    begin
    select first_name
    into user_name
    from employees
    where first_name = SYS_CONTEXT('hr_app_context', 'username');
    predicate_value := 'first_name = ' || user_name;
    predicate_value := 'first_name = ' || '' || user_name || '';
    return predicate_value;
    end test_policy;
    Can someone help me with the proper syntax to build my string for the return value? Thanks.

    this function implements the code for a policy i've created. basically, the policy says that when i do a select on the employees table, i should only see a record whose first_name = sys_context('hr_app_context', 'username'). so, when i perform a simple select * from employees, i get an error which says policy predicate has error. i'm pretty sure the error is caused by how i'm building the return value for that function. if i hard code some return value like:
    predicate_value := 'first_name = ''HR''' ;
    the select statement above works fine, and i only see the record from employees where first_name = 'HR'

  • Capturing xml data returned from a url post in a jsp page

    Hi,
    We are writing a interface which will capture data returned from an other website. The data returned will be in XML form.
    http://www.ecrm.staging.twii.net/ecrmfeed/ecrmfeedservices.sps?eCRMFeedInputXml=<twii><ecrmfeedinput><data%20method="Login"><username>[email protected]</username><password>password</password></data></ecrmfeedinput></twii>
    When the above url is executed in a browser, it required NT authentication. The username and password is getcouponed. Once the username and password is fed, we can see the output in the form of a xml. We require the xml in a String variable in a jsp page. We need to know the steps on how to execute the url in a jsp page. We used the url object to do the same, but we get a error saying "java.net.UnknownHostException: www.ecrm.staging.twii.net".
    Can anyone help?
    Regards,
    Gopinath.

    Hi,
    I would like to know if I can use the java.net package to get anything out of a website which requires authentication. In this case NT authentication.
    Thanks in advance,
    Gopinath.

  • Ssis error: hresult e_fail has been returned from a call to a com component

    I am using VS 2013 (BIDS) to develop SSIS packages. It is running on a windows 2012 server.
    I have a dev server on which when i try to load an SSIS project using the solution file i get a bunch of errors, and then visual studio just closes. The error is:
    hresult e_fail has been returned from a call to a com component
    If i copy the project to another machine it works fine.
    If i open VS first, and then open the project using the proj file, it seems to work.
    Any ideas what might be causing this error? I can work for now, but am worried my project may be corrupted in some way so dont want to do too much work on it.

    It might be a corruption so a re-install is desired. But
    Use SSDT (VS2010 shell) that came with the SQL Server installation media to edit SSIS 2012 packages.
    Arthur
    MyBlog
    Twitter

  • "Error 75 received from the Package Index Server. Please contact the Support Center"

    I have a T-61P running Windows XP SP2.  Within the past month, my System Updater started returning
    "Error 75 received from the Package Index Server.  Please contact the Support Center"
    I uninstalled System Update and downloaded and installed again from the Lenovo site.  Still displays same error message.  I get 20% into the update when the error message pops up.
    Any suggestions.
    Thank You!
    Solved!
    Go to Solution.

    Try this link:
    http://forum.notebookreview.com/showthread.php?t=157733
    Check the following registry keys (or similar)
    HKLM\HARDWARE\ACPI\DSDT\LENOVO\
    HKLM\HARDWARE\ACPI\FADT\LENOVO\
    HKLM\HARDWARE\ACPI\RSDT\LENOVO\
    They should be in the form of your model number without the hyphen and not TP-xx___
    In my case I had to change the TP-71___ that was showing in my registry to 87445BU.  Once I did this the software worked without a hitch.

Maybe you are looking for