How to fetch from cursor into plsql collection

Dear Friends,
I am trying to understand PLSQL collections. I am trying with the following example.
CREATE OR REPLACE TYPE emp_obj AS OBJECT
(     empname          VARCHAR2(100),     empjob          VARCHAR2(50),     empsal          NUMBER);
CREATE OR REPLACE TYPE emp_tbl IS TABLE OF emp_obj;
CREATE OR REPLACE PACKAGE eg_collection AS
-- Delcare ref cursor
TYPE rc IS REF CURSOR;
-- Procedure
PROCEDURE eg_collection_proc (out_result OUT rc);
END;
CREATE OR REPLACE PACKAGE BODY eg_collection AS
PROCEDURE eg_collection_proc( out_result OUT rc) AS
emp_tdt     emp_tbl := emp_tbl(emp_obj('oracle','DBA',100));
CURSOR c2 IS SELECT ename,job,sal FROM emp WHERE sal > 2000;
-- Declare a record type to hold the records from cursor and then pass to the collection
emp_rec emp_obj;
BEGIN
     OPEN c2;
     LOOP FETCH c1 INTO emp_rec;
          EXIT WHEN c1%NOTFOUND;
          emp_tdt.extend;
emp_tdt(emp_tdt.count) := emp_rec;
     END LOOP;
     CLOSE c2;
OPEN out_result FOR SELECT * FROM TABLE(CAST(emp_tdt AS emp_tbl));
END eg_collection_proc;
END eg_collection;
Executing the proc
variable r refcursor;
exec eg_collection.eg_collection_proc(:r);
print r;
But I am getting compilation error type mismatch found at emp_rec between fetch cursor into variable

I am trying to understand PLSQL collections. I dont why the code is not working
SQL> CREATE OR REPLACE TYPE emp_obj AS OBJECT
2 (
3      empname          VARCHAR2(100),
4      empjob          VARCHAR2(50),
5      empsal          NUMBER
6 )
7 /
Type created.
SQL> CREATE OR REPLACE TYPE emp_tbl IS TABLE OF emp_obj
2 /
Type created.
SQL> DECLARE
2      emp_tdt emp_tbl := emp_tbl ();
3 BEGIN
4
5      emp_tdt.extend;
6      SELECT emp_obj(ename, job, sal) BULK COLLECT INTO emp_tdt
7      FROM emp WHERE sal < 4000;
8
9      DBMS_OUTPUT.PUT_LINE ('The total count is ' || emp_tdt.count);
10
11      emp_tdt.extend;
12      SELECT ename, job, sal INTO emp_tdt(1).empname, emp_tdt(1).empjob, emp_tdt(1).empsal
13      FROM emp WHERE empno = 7900;
14
15      DBMS_OUTPUT.PUT_LINE ('The total count is ' || emp_tdt.count);
16
17 END;
18 /
The total count is 13
The total count is 14
PL/SQL procedure successfully completed.
SQL> DECLARE
2      emp_tdt emp_tbl := emp_tbl ();
3 BEGIN
4
5      emp_tdt.extend;
6      SELECT ename, job, sal INTO emp_tdt(1).empname, emp_tdt(1).empjob, emp_tdt(1).empsal
7      FROM emp WHERE empno = 7900;
8
9      DBMS_OUTPUT.PUT_LINE ('The total count is ' || emp_tdt.count);
10
11      emp_tdt.extend;
12      SELECT emp_obj(ename, job, sal) BULK COLLECT INTO emp_tdt
13      FROM emp WHERE sal < 4000;
14
15      DBMS_OUTPUT.PUT_LINE ('The total count is ' || emp_tdt.count);
16 END;
17 /
DECLARE
ERROR at line 1:
ORA-06530: Reference to uninitialized composite
ORA-06512: at line 6

Similar Messages

  • SAVE EXCEPTIONS when fetching from cursors by BULK COLLECT possible?

    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    Hello,
    I'm using an Cursor's FETCH by BULK COLLECT INTO mydata...
    Is it possible to SAVE EXCEPTIONS like with FORALL? Or is there any other possibility to handle exceptions during bulk-fetches?
    Regards,
    Martin

    The cursor's SELECT-statement uses TO_DATE(juldat,'J')-function (for converting an julian date value to DATE), but some rows contain an invalid juldat-value (leading to ORA-01854).
    I want to handle this "rows' exceptions" like in FORALL.
    But it could also be any other (non-Oracle/self-made) function within "any" BULK instruction raising (un)wanted exceptions... how can I handle these ones?
    Martin

  • Fetch from cursor variable

    Hello,
    I have a procedure, which specification is something like that:
    procedure proc1 (pcursor OUT SYS_REFCURSOR, parg1 IN NUMBER, parg2 IN NUMBER, ...);Inside the body of proc1 I have
    OPEN pcursor FOR
      SELECT column1,
                  column2,
                  CURSOR (SELECT column1, column2
                                    FROM table2
                                  WHERE <some clauses come here>) icursor1
          FROM table1
       WHERE <some clauses come here>;In a PL/SQL block I would like to execute proc1 and then to fetch from pcursor. This is what I am doing so far:
    DECLARE
      ldata SYS_REFCURSOR;
      larg1 NUMBER := 123;
      larg2 NUMBER := 456;
      outcolumn1 dbms_sql.Number_Table;
      outcolumn2 dbms_sql.Number_Table;
    BEGIN
      some_package_name.proc1 (ldata, larg1, larg2, ...);
      FETCH ldata BULK COLLECT INTO
        outcolumn1, outcolumn2,...,  *and here is my problem*;
    END;
    /How can I rewrite this in order to get the content of icursor1 ?
    Thanks a lot!

    Verdi wrote:
    How can I rewrite this in order to get the content of icursor1 ?
    Firstly ref cursors contain no data they are not result sets but pointers to compiled SQL statements.
    Re: OPEN cursor for large query
    PL/SQL 101 : Understanding Ref Cursors
    Ref cursors are not supposed to be used within PL/SQL or SQL for that matter, though people keep on insisting on doing this for some reason.
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10472/static.htm#CIHCJBJJ
    Purpose of Cursor Variables
    You use cursor variables to pass query result sets between PL/SQL stored subprograms and their clients. This is possible because PL/SQL and its clients share a pointer to the work area where the result set is stored.A ref cursor is supposed to be passed back to a procedural client language, such as Java or .Net.
    If you want to re-use a SQL statement in multiple other PL/SQL or SQL statements you would use a view.

  • Fetch From Cursor

    In my Procedure I want to explicitly open the cursor and fetch from the cursor and again close the cursor
    I don’t want to use like this for some testingsomething:
    Create procedure kk
    Cur out sys_refcursor
    As
    Open cur for
    Select * from table;
    End
    I need to use like this
    Create procedure kk
    Cursor c is select * from table; need to return this cursor.
    As
    How to return that cursor
    Thanks

    maybe something like:
    create or replace procedure get_emp_name as
      cursor c1 is
        select * from emp;
      vEname emp.ename%type;
    begin
      open c1;
      fetch c1 into vEname;
      if c1%notfound then
         exit;
      end if;
      close c1;
    end;
    /or
    Create procedure get_emp_name as
      Cursor c1 is
       select *
         from emp;
    begin
      for c1_rec in c1 loop
         dbms_output.put_line('Emp Name: '||c1_rec.ename);
      end loop;
    end;
    /

  • Fetching from cursor

    Hello all.
    How can i enforce the sql+ start fetching first cursor field by
    one field intervals?
    My sql+ starts fetch from the second item by 2 records intervals,
    so the 4th record is the next one to fetched after the second.
    best regards
    yosi sarid.

    Hi,
    could you please show us the where clause of the cursor?
    I think you are missing something.
    Another fault in your Code is the x_commit_count.
    You increment it every time, but you never set it to zero again. So after 100 inserts, it commits after each loopstep.
    Is this what you want???
    DECLARE
    CURSOR c_cursor IS SELECT * FROM TABLE_A@REMOTE, TABLE_B@REMOTE WHERE...
    x_commit_count NUMBER := 0;
    BEGIN
    FOR r_record IN c_cursor LOOP
    INSERT INTO LOCAL_TABLE;
    x_commit_count := x_commit_count + 1;
    IF x_commit_count >= 100 THEN
    COMMIT;
    ELSE
    NULL;
    END IF;
    END LOOP;
    END;
    HTH
    Detlev

  • Help!!! slow fetch from cursor

    I have a problem fetching records from a ref cursor returned by a procedure.
    Basically I play both a PL/SQL developer and DBA roles for a development and production Oracle 9.2.0.6 databases hosted on separate Sun Solaris 5.8 servers. The problem PL/SQL signature is shown below, and it basiccally dynamically constructs a large querry (I will call global querry) which is a UNION ALL of 16 smaller querries and opens the cursor parameter for this dynamically constructed querry. The entire querry is assigned to a VARCHAR2(20000) variable, and is normally a little over 15,000 bytes in size. The returned cursor is used to publish the querry result records in Crystal reports. The problem is that the entire process of executing and fetching the result records from the procedure is taking as much as 25 minutes to complete. On investigation of the problem by executing the procedure with a PL/sql block in sqlplus, and adding timing constructs in the execution of the procedure and fetches from the returned cursor, I discovered to my shock that the procedure executes consistently in 1 second (second is the granularity of the timer), but each record fetch is done in a minimum of 16 seconds. All efforts to tune the database memory structures to improve the fetches have yielded very small improvements bringing down the fetch times to about 11 seconds. This is still unacceptable. Is there anybody out there who can suggest a solution to this problem?
    Procedure signature:
    sp_production_report ( p_result_set IN OUT meap_report.t_reportRefCur,
    p_date_from IN VARCHAR2,
    p_date_to IN VARCHAR2,
    p_agency_code IN INTEGER DEFAULT NULL,
    p_county_code IN INTEGER DEFAULT NULL,
    p_selection IN INTEGER DEFAULT 0);
    Test block in sqlplus:
    declare
    -- Local variables here
    i integer;
    v_start INTEGER;
    v_end INTEGER;
    v_end_fetch INTEGER;
    v_cnt INTEGER := 0;
    v_end_loop INTEGER;
    v_elapsed INTEGER;
    v_cur meap_report.t_reportRefCur;
    v_desc VARCHAR2(300);
    v_hh VARCHAR2(300);
    v_meap INTEGER;
    v_bp INTEGER;
    v_ara INTEGER;
    v_tot INTEGER;
    BEGIN
    -- Test statements here
    DBMS_OUTPUT.ENABLE(100000);
    SELECT TO_NUMBER ( TO_CHAR(SYSDATE, 'SSSSS')) INTO v_start FROM DUAL;
    sp_production_report ( p_result_set => v_cur,
    p_date_from => '07/01/2008',
    p_date_to => '07/31/2008',
    p_selection => 0);
    SELECT TO_NUMBER ( TO_CHAR(SYSDATE, 'SSSSS') ) INTO v_end FROM DUAL;
    FETCH v_cur INTO v_desc, v_hh, v_meap, v_bp, v_ara, v_tot;
    SELECT TO_NUMBER ( TO_CHAR(SYSDATE, 'SSSSS') ) INTO v_end_fetch FROM DUAL;
    WHILE v_cur%FOUND LOOP
    v_cnt := v_cnt + 1;
    FETCH v_cur INTO v_desc, v_hh, v_meap, v_bp, v_ara, v_tot;
    END LOOP;
    SELECT TO_NUMBER ( TO_CHAR(SYSDATE, 'SSSSS') ) INTO v_end_loop FROM DUAL;
    v_elapsed := v_end_loop - v_end;
    DBMS_OUTPUT.PUT_LINE ( 'Procedure (p_selection 0) executed in ' || TO_CHAR ( (v_end - v_start) ) || ' seconds.' );
    DBMS_OUTPUT.PUT_LINE ( 'Fetched 1st record in ' || TO_CHAR ( (v_end_fetch - v_end) ) || ' seconds.' );
    DBMS_OUTPUT.PUT_LINE ( 'Procedure (p_selection 0) :' || TO_CHAR (v_cnt) ||
    ' records fetched in ' || TO_CHAR ( v_elapsed ) || ' seconds.' );
    CLOSE v_cur;
    END;

    And why not use timestamps instead of dates? They get subsecond resolution:
    declare
            t1 timestamp;
            t2 timestamp;
            d1 INTERVAL DAY(3) TO SECOND(3);
    begin
            t1 := systimestamp;
            dbms_lock.sleep(1.45);
            t2 := systimestamp;
            d1 := t2 - t1;
            dbms_output.put_line('Start:    '||t1);
            dbms_output.put_line('End:      '||t2);
            dbms_output.put_line('Duration: '||d1);
    end;
    /As for how to speed up your fetch, that depends on how the SQL the cursor is based on is constructed. Without that you need to refer to Rob's post.

  • Fetch from cursor when no records returned

    Hi,
    I've got the following question / problem?
    When I do a fetch from a cursor in my for loop and the cursor returns no record my variable 'r_item' keeps the value of the previous fetched record. Shouldn't it contain null if no record is found and I do a fetch after I closed and opend the cursor? Is there a way the clear the variable before each fetch?
    Below you find an example code
    CURSOR c_item (itm_id NUMBER) IS
    SELECT DISTINCT col1 from table1
    WHERE id = itm_id;
    r_item  c_item%ROWTYPE;
    FOR r_get_items IN c_get_items LOOP
      IF r_get_items.ENABLE = 'N' THEN       
          open c_item(r_get_items.ITMID);
          fetch c_item into r_item;
          close c_item;
          IF  r_item.ACCES = 'E' then
               action1
          ELSE                 
               action2
          END IF;
      END IF;
    END LOOP;  Thanx

    DECLARE
        CURSOR c_dept IS
          SELECT d.deptno
          ,      d.dname
          ,      d.loc
          ,      CURSOR (SELECT empno
                         ,      ename
                         ,      job
                         ,      hiredate
                         FROM   emp e
                         WHERE  e.deptno = d.deptno)
          FROM   dept d;
        TYPE refcursor IS REF CURSOR;
        emps refcursor;
        deptno dept.deptno%TYPE;
        dname dept.dname%TYPE;
        empno emp.empno%TYPE;
        ename emp.ename%TYPE;
        job emp.job%TYPE;
        hiredate emp.hiredate%TYPE;
        loc dept.loc%TYPE;
    BEGIN
       OPEN c_dept;
       LOOP
         FETCH c_dept INTO deptno, dname, loc, emps;
         EXIT WHEN c_dept%NOTFOUND;
         DBMS_OUTPUT.put_line ('Department : ' || dname);
         LOOP
           FETCH emps INTO empno, ename, job, hiredate;
           EXIT WHEN emps%NOTFOUND;
           DBMS_OUTPUT.put_line ('-- Employee : ' || ename);
         END LOOP;
      END LOOP;
      CLOSE c_dept;
    END;
    /like this...

  • How to import from PE10 into iPhoto

    I am about to buy PE10 but I have seen a lot of discussions on the web about problems saving from PE into iPhoto. Is it achievable and how? I will be using PE for more complicated manipulation involving layers.

    Afraid not. You will need something to convert those comments into standard photo metadata like Exif or IPTC.
    Regards
    TD

  • How to import from youtube into imove 11

    How to import a video from youtube into imove11?

    How many orders do you need to import one photo?
    Perhaps you need to explain that again
    Regards
    TD

  • How to convert a string into a collection of KeyEvents

    I'm working on a program that must interact with a 3rd party application (closed to me, I have no access to the code or anything like that). I have been unable to send data to the program by getting its OutputStream. The only thing that has worked was using a Robot object to send individual key events (i.e. robot.keyPress(KeyEvent.VK_A);). Therefore I'm looking to convert a string (many different strings actually) into a collection of their associated KeyEvents so I can send them to the other application. Does anyone know a good way of doing it, or is anyone able to help me with using the OutputStream?
    Thank you!
    (The 3rd party application is Attachmate InfoConnect, a Unisys terminal emulation program that I have to use to access a mainframe).

    Here is a code sample.     public void checknumber(int vsize){
    int total;
    String anum;
    anum = tf2.getText();
    validnumber = true;
    lines2combine = 1;     //default (an integer)
    recs2make = 1;          //default
    try{
    lines2combine = Integer.parseInt(anum);
    catch (NumberFormatException e){
              System.out.println("Entry for lines to combine not numeric");
         validnumber = false;
         d1Title = "Data Entry Error";
         d1Txt = "For number for lines to combine;";
         d2Txt = "Enter a number.";
         doMessage();

  • How to fetch the data into one out parameter from two different queries

    Hi,
    I have an a problem how to implement condition in above procedure,and scenario is
    i have to get the output into one out parameter from two queries.i.e if one query data is null
    then i have to pick out data from another query into same out parameter.
    CREATE OR REPLACE PROCEDURE GET_POLICIESMAP_BASEDON_GHPLID(I_COMPANYID IN NUMBER,
    I_CARDID IN VARCHAR2,
    PR_RESULTSET OUT SYS_REFCURSOR) IS
    /* LOC_INSUREDID VARCHAR2(200);
    LOC_RELATIONCODE VARCHAR2(200);
    LOC_CURRENTPOLICYID VARCHAR2(4000);*/
    BEGIN
    OPEN PR_RESULTSET FOR
    WITH A AS
    (SELECT DISTINCT PM.MAINPOLICYID MAINPOLICYID,
    id INSUREDID,
    RELATIONCODE,
    CURRENTPOLICYID
    from INSUREDPERSONS IP
    LEFT OUTER JOIN POLICIES_RULES_MAPPING PM
    ON PM.POLICYID = IP.Currentpolicyid
    where EIN IN (SELECT EIN
    FROM INSUREDPERSONS ipp
    JOIN VW_INSUREDINFO vw
    ON IPP.ID = vw.insuredid
    and vw.cardid = I_CARDID)
    AND IP.CURRENTPOLICYID in
    (SELECT ID
    from policies
    where companyid = I_COMPANYID
    and dead = 0
    AND POLICYTO > SYSDATE - 1))
    SELECT INSUREDID, RELATIONCODE, CURRENTPOLICYID
    FROM A
    WHERE RELATIONCODE = 0
    AND (A.MAINPOLICYID is null or
    RELATIONCODE = 0 AND CURRENTPOLICYID = MAINPOLICYID)
    UNION
    SELECT INSUREDID, RELATIONCODE, CURRENTPOLICYID
    FROM A
    WHERE RELATIONCODE > 0;
    /* HERE I NEED TO GET THE DATA FROM THIS BELOW QUERY INTO SAME OUT PARAMETER
    WHEN ABOVE QUERY DATA CONTAINS NULLS */
    /* IF PR_RESULTSET IS NULL THEN*/
    OPEN PR_RESULTSET FOR
    WITH A AS
    (SELECT DISTINCT PM.MAINPOLICYID MAINPOLICYID,
    id INSUREDID,
    RELATIONCODE,
    CURRENTPOLICYID
    from INSUREDPERSONS IP
    LEFT OUTER JOIN POLICIES_RULES_MAPPING PM
    ON PM.POLICYID = IP.Currentpolicyid
    where FAMILYID IN (SELECT FAMILYID
    FROM INSUREDPERSONS ipp
    JOIN VW_INSUREDINFO vw
    ON IPP.ID = vw.insuredid
    and vw.cardid = I_CARDID)
    AND IP.CURRENTPOLICYID in
    (SELECT ID
    from policies
    where companyid = I_COMPANYID
    and dead = 0
    AND POLICYTO > SYSDATE - 1))
    SELECT INSUREDID, RELATIONCODE, CURRENTPOLICYID
    FROM A
    WHERE RELATIONCODE = 0
    AND (A.MAINPOLICYID is null or
    RELATIONCODE = 0 AND CURRENTPOLICYID = MAINPOLICYID)
    UNION
    SELECT INSUREDID, RELATIONCODE, CURRENTPOLICYID
    FROM A
    WHERE RELATIONCODE > 0;
    /* END IF;*/
    END GET_POLICIESMAP_BASEDON_GHPLID;
    Thanks in Advance,
    vvr.

    SELECT DISTINCT PM.MAINPOLICYID MAINPOLICYID,
                           id              INSUREDID,
                           RELATIONCODE,
                           CURRENTPOLICYID
             from INSUREDPERSONS IP
             LEFT OUTER JOIN POLICIES_RULES_MAPPING PM
               ON PM.POLICYID = IP.Currentpolicyid
            where EIN IN (SELECT EIN
                            FROM INSUREDPERSONS ipp
                            JOIN VW_INSUREDINFO vw
                              ON IPP.ID = vw.insuredid
                             and vw.cardid = I_CARDID)In this code
    where EINEIN is a column in INSUREDPERSONS?
    and in the sub query below
    (SELECT EIN
                            FROM INSUREDPERSONS ipp
                            JOIN VW_INSUREDINFO vw
                              ON IPP.ID = vw.insuredid
                             and vw.cardid = I_CARDID)EIN belongs to INSUREDPERSONS or VW_INSUREDINFO?
    Please use Alias as we dont know your table structure.

  • Dynamic Column Name while Fetching from Cursor?

    Scenario:
    I have a table having 5 Column C01,C02,C03,C04,C05....... now i have
    a record type variable att_rec. One first fetch the first record
    fetch into att_rec and i can access column like
    att_rec.C01,att_rec.C02 and so on simply i wan access these columns
    through following Loop but unable to do so. It Understand the
    att_Rec.C01 as String .. Any Clue ???
    IF NOT attdays_cnt%ISOPEN
    THEN
    OPEN attdays_cnt;
    END IF;
    /* Keep fetching until no more records are FOUND */
    FETCH attdays_cnt INTO att_rec;
    message('Cursor Opened');
    WHILE attdays_cnt%FOUND
    LOOP
    a31_cnt:=1; -- reinitializtion of variables for other employees
    p_days:=0;
    w_days:=0;
    WHILE a31_cnt<32 LOOP
    IF concat('ATT_REC.C',to_char(a31_cnt,'00'))='L'='P' THEN
    p_days:=p_days+1;
    ELSE ATT_REC.C01='W' THEN
    w_days:=w_days+1;
    END IF;
    END LOOP;
    Message was edited by:
    Fiz Dosani

    Perhaps this is marginally simpler with nested table, YMMV ;-)
    (based on Elic's example)
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> CRE ATE TABLE t (i, j, k)
      2  AS
      3     SELECT LEVEL, POWER (LEVEL, 2), POWER (LEVEL, 3)
      4     FROM DUAL
      5     CONNECT BY LEVEL <= 5;
    Table created.
    SQL> CREATE OR REPLACE type ntt_number AS TABLE OF NUMBER;
      2  /
    Type created.
    SQL> SET SERVEROUTPUT ON;
    SQL> DECLARE
      2     TYPE t_tbl IS TABLE OF ntt_number;
      3
      4     var t_tbl;
      5  BEGIN
      6     SELECT ntt_number (i, j, k)
      7     BULK COLLECT INTO var
      8     FROM   t;
      9
    10     FOR i IN 1 .. var.COUNT LOOP
    11        FOR j IN 1 .. var (i).COUNT LOOP
    12           DBMS_OUTPUT.PUT_LINE (
    13              'var (' || i || ') (' || j || ') => ' || var (i) (j));
    14        END LOOP;
    15     END LOOP;
    16  END;
    17  /
    var (1) (1) => 1
    var (1) (2) => 1
    var (1) (3) => 1
    var (2) (1) => 2
    var (2) (2) => 4
    var (2) (3) => 8
    var (3) (1) => 3
    var (3) (2) => 9
    var (3) (3) => 27
    var (4) (1) => 4
    var (4) (2) => 16
    var (4) (3) => 64
    var (5) (1) => 5
    var (5) (2) => 25
    var (5) (3) => 125
    PL/SQL procedure successfully completed.
    SQL>

  • NLS Error on Second Fetch from Cursor

    Oracle 8i using PRO*C
    We have a UNIX (HP) environment (operational account) in which the NLS_LANG was not set for the shell. One of our applications opened a cursor for update and performed its first fetch. After processing it went back to fetch an additional buffer. At this point, the application failed with the following error: "SQLCODE: ORA-01890: NLS error detected". When we set the NLS_LANG enviroment variable this error disappeared.
    I need to know what the NLS_LANG enviroment variable is doing and why it is causing the second fetch to fail when it is not set so I can argue with the powers that be to have this paremeter always set for this accounts shell (i.e. globally). No-one really knows what this does here or why it would cause the cursor to fail, and so they are telling us to just set the variable in our own applications shell.
    I know the real answer to this is to set it up for the operational (global) shell but...
    Thanks in advance,
    Bill Rosmus

    it is difficult. The main problem is that you can't be sure that the function is called only once for each row.
    Why don't you simply run the cursor and the function separatly in pl/sql.
      CURSOR myCur IS SELECT myTable1.* FROM myTable1 ;
      SUBTYPE myRecType IS myCur%ROWTYPE ;
      funcResult varchar2(100); /* use the correct return datatype from your function here */
      FOR myRec in myCur LOOP
          BEGIN
             funcResult := myPackage.myFunc(myRec.column1);
          EXCEPTION
             WHEN myPackage.myFunc_Exception THEN
               <... do anything when fetched but function myFunc raised this exception ...>
          END ;
          <...do anything with row currently fetched>
       END LOOP;You even have more control where to handle the exception. Also there is one pl/sql context switch less. Since the function itself is pl/sql it could even be faster to run it in pl/sql then to call it from sql (inside a select).

  • How to import from Aperture into LR?

    How do I import photos (which have been uploaded automatically from SD card to Aperture) to Lightroom? Thank you for your help.
    Moms90

    Can anyone help me in moving my pictures out of Aperture 3 and into iPhoto?
    Aperture and iPhoto are entirely different applications that work in very different ways.
    iPhoto has no knowledge of, and knows nothing of how the Aperture Library works. It cannot read the Aperture library. So,
    1. Export all your Masters
    2. Export all your Versions
    You can write the metadata to the files on export - check out the Export presets. Note that you cannot export Faces. There is no convention for sharing Faces. The best you can do is use Faces as a basis for keywording.
    Import them into iPhoto. Note that there is no way to associate the masters with the versions in iPhoto, so you'll have apparent duplicates.
    I assume some photo's which were taken on my Canon 550d won't show up? And it will show a blank picture instead?
    Why do you assume this?
    Regards
    TD

  • How to go from VOBs into QuickTime Pro to Apple TV ?

    How can I get a bunch of VOB files from a DVD so that I can use QuickTime Pro to convert to Apple TV ?
    I have played for weeks with QuickTime Pro, MediaFork, HandBrake, MPEG StreamClip, VisualHub, iSquint, ffmpegX, Mac the Ripper, and more, and compared outputs. I have tried all kinds of bit rates, 1 and 2 pass, etc. In the end, I personally like the QuickTime Pro conversions best, and I find that I have had very few problems with QuickTime Pro.
    I want to use QuickTime Pro to convert a few of my DVD for Apple TV. With Quicktime Pro I can read a single VOB file and convert it but I don't get sound or all the VOB files that I need. How can I quickly, without a lengthy conversion, pull all the VOB files from a DVD so that I can convert them to Apple TV with QuickTime Pro ?

    1) Pull the information off the DVD with NO video/audio conversion.This is not possible -- at least not possible to do without at least converting the AC3 Audio first. And, then it will only be possible if you have the QT MPEG-2 component installed. You appear to be operating under the misguided assumption that QT Pro -- a temporally synchronized, "frame-ro-frame" player/converter asset -- will work on a spatially synchronized file containing a single data stream of video data blocks interspersed with blocks of audio data. It won't. There are basically only two approaches here. Both require the use of an intermediate file format. (I.e., a conversion is required.):
    1) The first approach is to use an application like MPEG Streamclip to convert your VOBs (both audio and video) to a less compressed format and/or editable format like "animation/PCM" or the "DV" format. However, since DV is an exacting specification which may change the frame rate and/or physical dimensions of your movies, I'd recommend "animation/PCM" here. This approach allows audio and video to be converted by QT Pro during a single conversion which usually eliminates the likelihood of audio and video going "out of sync."
    2) The other approach requires you to use a third-party application (like MPEG Streamclip) to demux your VOBs to associated elementary MPEG-2 (M2V) and PCM (AIFF) files which QT Pro can handle either individually (may allow de-synchronization) or as a "resourced" pair (best approach) of files. In this case the M2V file contains the original, unconverted MPEG-2 data and the AIFF contains a stereo "mix-down" of the AC3 audio.
    Recommend you try the second option here. Once the paired files are created, (without moving them) open the M2V in QT Pro by double-clicking it. This should open M2V which, in turn, references the AIFF file as a resource. (Not moving the files is to ensure the the resource path does not become broken.) In any case, you can now process the opened file(s) in QT Pro using the "Movie to TV" export option. Be advised that neither MPEG Streamclip nor QT Pro allow "easy" cropping of the video using this workflow. In addition, if you plan to customize the dimensions of a 16:9 "widescreen" 640 x 360 file to 720 x 405 or 854 x 480 for encoding, the dimensions must be changed in before selecting the export option.

Maybe you are looking for