Cursor Question

Hi
I have a multi-tab form and in the first tab block (B1) one of the field's values is used to populate an NBT field in another multi-record tab block (B2). When tab B2 fields are filled in, the last value is populated automatically with the value from B1. I had thought that if the value in B1 is subsequently changed then I would like the form, in B2, to update the field(s) (if any) with the new value input in B1.
DB relation is B1 parent, B2 child.
I thought the best option would be to use a cursor to loop through the records in B2 when:
B1 field's system record status is 'CHANGED'
And PK(s) in B2 are present i.e. records are present and need updated.
So i've not really get much experience using cursors so thought this would be ideal opportunity to learn it. I created the following cursor:
IF :system.record_status = 'CHANGED' AND :B2.ID IS NOT NULL THEN
DECLARE
     v_mod_id NUMBER := :B2.FK; --variable used for join condition in cursor
     v_cvs_val VARCHAR2(100) := :B1.UpdatedValue; Passes updated B1 value into variable so it can be used to update B2
     CURSOR c_cvs IS
SELECT B2_PK, B2_current_val --Current value to be updated
     FROM B2 table
     WHERE B2_FK = v_mod_id;
     B2_Table_rec c_cvs%ROWTYPE; --declares record of cursor type
BEGIN
     OPEN c_cvs;
     LOOP
          FETCH c_cvs INTO B2_Table_rec;
          EXIT WHEN c_cvs%NOTFOUND;
          :B2.field_requiring_B1updatedValue := v_cvs_val; Passes updated value into --each field in the block B2
     END LOOP;
     CLOSE c_cvs;
END;
END IF;
What I am a bit confused about is what trigger to use this in. I have used it in when validate item in B1, so when I update value the cursor should go through the records in B2 to update them, and it does, but only does it once, and only does it to the record in B2 that I left focus in; so if I was on row 2 in B2 and went and changed value in B1 it would only update row 2 in B2.
I would appreciate if anyone can offer any advice as to where i'm going wrong, either in the cursor statement itself or in what trigger I should put it.
thanks
Andrew

http://asktom.oracle.com/pls/ask/f?p=4950:8:3983328209686210967::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:5241391331097
Rgds.

Similar Messages

  • Ref cursor question

    Hi,
    I have stored proc that takes pl/sql table as IN parameter and returns a ref cursor.
    Data from pl/sql table is separated into two table type objects ... oType1 and oType2 based on some condition.
    following works fine...
    If oType1.Count > 0 then
         OPEN list_out FOR
         select col1, col2, col3, col4 ..... col20
         from TABLE(CAST(oType1 AS obj_table_t)) a,
         t1,
         t2
         where a.colvalue = t1.colvalue
         and etc....
    UNION ALL
         select col1, col2, col3, col4 ..... col20
         from TABLE(CAST(oType1 AS obj_table_t)) a,
         t3,
         t4
         where a.colvalue = t3.colvalue
         and different conditions etc....
    I have 4 UNION ALL's. Had to use this because of different where coditions.
    end if..
    The problem is with oType2......
    If oType2.Count > 0 then
    -- getting data from different database using dblink along with values from present database.
    -- resultset columns will be same as above
    -- Question is how to send these results in same refcursor.
    end if;
    Thanks for your time.

    Hi,
    I think that a plsql table is what you want and not a ref cursor. If you have a plsql table based on your user defined type you can keep assigning all the values you want to it and then pass it out of your procedure.
    null

  • "Shadow" next to cursor question

    Hello.
    Very basic question I'm sure but I only bought FCE as I couldn't adjust very well to the i-Movie change.....
    Anyway, I was happily dragging clips into the Timeline, putting some transition effects on them, adjusting, rendering and moving to the next bit. Very basic but what I needed to do.
    Now I must have changed some sort of mode as the cursor now has a small dark shadow to the right of it and I can no longer just grab a chunk on the Timeline and move it or adjust an effect in the same way as before.
    Blowed if I can find what I did or even where to start in the manual.
    Any help appreciated.
    Many thanks.
    Alastair

    I tripped over something similar a while back. I will describe mine and see if it matches yours. I have dozens of clips scattered over a few video tracks. I can select an individual clip then click select it and the 4 way move arrow shows up. I can then drag his clip anywhere. NOW here comes the tricky part.
    1 IF you choose to put this new clip on any particular track you will notice either a right arrow ( NOTE how your tracks are split into 2 parts by a long horizontal gray bar) if your cursor is above the horizontal divider the cursor showsa right arrow --OR a down arrow if your cursor is below that horizontal divider.
    Right arrow means insert ie it will drop your clip right there and shove everything on every unlocked track to the right
    Down arrow means superimpose - it will write over anything on the track you are dropping it onto. Nothing else gets shoved out of the way.
    THe fact it showed up in the middle of a project is bogus --- it may have showed up after you added enough effects etc to have not enough space to put your clip neatly in without over writing what is under it . I jsut tried it and i always see the 2 arrows when i move things around .
    In re only one frame transition i cant help you -- you can set those timers up in some place i cant find right now --
    -- ALso groping around ...

  • Voice Over : Mouse pointer moves VO cursor Question

    Hi!!
    I have low vision, and i want to use the voice over with my mouse and/or trackpad. Im able to see where the text is but i cant read it well. When I enable the Voice Over I select "Mouse pointer moves Voice Over cursor in the preferences. This works fine for me, vut i noticed that when i drag the pointer over the finders sidebar it select the folders without me clicking on them. Something similar happens in Safari when scrolling the web page. There is any way to avoid this?? The Voice Over with the keyboard is very nice but  sometimes I rather use the mouse.
    Thanks in advance!!

    ladislavfromcygnet wrote:
    Thank you Shootist007. I cannot do even Update now. I probably should have spent the same amount of money on a new IMac!
    No not really. If this is a brand new Macbook Pro take it back for a refund. Apple has a 14 day No Questions Asked return policy for Full refund.
    Take it back, get the Full Refund (DO NOT LET THEM TRY TO FIX IT. YOU BOUGHT A NEW COMPUTER NOT ONE THAT HAS BEEN WORKED ON OR NEEDS TO BE FIXED) and then decide whether to buy another Macbook Pro or the iMac. Or you could return it, get the Full refund and buy some other brand computer.

  • Graph Cursor Question

    I have a cursor on a XY-graph that I'm trying to adjust (x position) via controls on the front panel.  I have one control that works great and adjusts one number at a time (ex. 500 to 501, etc).  I'd like to have two controls one like I have that would be a fine adjustment (I believe) and another for coarse adjustment that would adjust the value by 50 or whatever.  Hence this would be adjusted first (ex 550) and then the other control would be adjusted for fine tuning (ex to say 551 etc). 
    I'm having trouble figuring this out, and was hoping someone could giv eme some tips or ideas as to what to do.  I thought this might be something fairly common, but maybe not.
    Thanks in advance...
    Using Labview 7.0 and 2010 SP1 with Windows XP and 7.

    LabVIEW 8.0 would make these things much easier, because we have events for cursor movements! .
    In LabVIEW 7.0, you need to code around it. For example, you could place the cursor reads into a timeout event which is only active when the mouse is down on the graph (enable timeout with mouse down, disable with mouse up event).
    The attached shows one simple possibility (I don't think you need the course control).
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    DualCursorControl3.vi ‏64 KB

  • XY graph as a chart cursor question

    I have several XY graphs that are behaving as a chart. On the graph when a user moves the cursor to a peak I read in the X and Y values. I also want to be able to follow that peak until the user moves the mouse again.
    Currently when a new data point comes in the cursor stays in the same X location and I get updated data. What I want is, let's say the user moves the cursor to time 8:00:01. When the next update comes along the cursor should stay on time 8:00:01, but right now the cursor stays in position and I am reading in time 8:00:02. Does anyone know how to do this, without using property nodes? As I write this I realize that I can do this with an event structure and property nodes.

    By far the best way will be with property nodes etc. The only other idea I had would be to somehow actually plot data as the cursor, therefore when more data comes in the "cursor" actually moves with it. However even to accomplish this I think you would still be using property nodes. So I would say use the property nodes to move a real cursor.

  • PL/SQL cursor question (possible to pass in the table name?)

    I want to pass the name of a table to a cursor and select from that,
    Is this possible in PL/SQL?
    CURSOR get_rows(table_name IN VARCHAR2) IS
    SELECT * FROM table_name;
         The actual sql statement that will be used is more complex.
         I have 18 tables for which the same query would work varrying only in the name of the table.
    I get an error when I try to do the above.

    >
    I am not quite sure how you can derive anything from the design given the example that has all other details stripped out
    >
    What Justin said is pretty clear
    >
    If you are really doing a SELECT * and you have 18 different tables, it seems unlikely that all tables would always have exactly the same set of columns. If they do, that is almost certainly an indication that the data model is incorrect.
    >
    A data model that includes 18 tables with the same set of columns has something wrong with it. You explained that by clarifying that it is only TWO columns in each of the 18 tables that is the same. Perhaps the tables have one-to-many relationships and the two columns are the key columns. That is different.
    >
    The 'select *' will actually pull back only two columns, both of which are primary keys (long). I need to select all rows into a data structure that is global that I can iterate through at a later time. So given that I can use a ref cursor and have a dynamic table name, how would I select into a data structure that is of two primary keys and make that global to be used in another method at a later time?
    >
    Why not use an actual table to store the column data? An index-organized table would be perfect for that use and won't use up valuable user memory.
    And by global do you mean the data needs to be accessible by a different session than the one that collected the data?
    And what do you mean by 'later'? Tomorrow or next week?
    The use case you describe sounds like you are having to update primary key values in tables that have parent-child foreign key constraints. Is that what you are doing? Can you do this offline and defer or disable the constraints, perform an update (rather than insert/delete) and then reenable the constraints?

  • Loop cursor question

    Hi all...
    Really stuck here. So, I have two tables.... one is passenger info, the other is flight info. The passengers have id numbers. When I enter a correct passenger num and flight num my program works fine. What Im trying to do is cause an error to appear if I enter an invalid flight or passenger number. I have a cursor set up for flight and one set up for passenger. I believe my error may be in the fetch? Can someone take a look?
    Thanks in advance
    CURSOR pass_cursor IS
    SELECT pnum, name, age FROM passengers
    WHERE pnum=V_pnum;
    CURSOR flights_cursor IS
    SELECT flnum, dest, hours, cost FROM flights
    WHERE flnum=v_flnum;
    OPEN pass_cursor;
    LOOP
    FETCH pass_cursor INTO v_pnum, v_name, v_age;
    EXIT WHEN pass_cursor%NOTFOUND;
    IF flights_cursor%ISOPEN THEN
    CLOSE flights_cursor;
    END IF;
    OPEN flights_cursor;
    LOOP
    FETCH flights_cursor INTO v_flnum,v_dest,v_hours,v_cost;
    EXIT WHEN flights_cursor%NOTFOUND;

    You don't need to loop through the cursors if you just need a validation on primary or unique keys.
    DECLARE
    CURSOR pass_cursor IS
    SELECT pnum, name, age
       FROM passengers
    WHERE pnum=V_pnum;
    CURSOR flights_cursor IS
    SELECT flnum, dest, hours, cost
       FROM flights
    WHERE flnum=v_flnum;
    -- <variable declaration>
    BEGIN
    OPEN pass_cursor;
    FETCH pass_cursor INTO v_pnum, v_name, v_age;
    IF pass_cursor%NOTFOUND THEN
    DBMS_OUTPUT.PUT_LINE('Invalid passenger id entered');
    CLOSE pass_cursor;
    -- RAISE exception;
    END IF;
    CLOSE pass_cursor;
    OPEN flights_cursor;
    FETCH flights_cursor INTO v_flnum,v_dest,v_hours,v_cost;
    IF flights_cursor%NOTFOUND THEN
    DBMS_OUTPUT.PUT_LINE('Invalid flight id entered');
    CLOSE flights_cursor;
    --RAISE exception;
    END IF;
    CLOSE flights_cursor;
    EXCEPTION
    WHEN OTHERS THEN
    -- Logic if any exception is raised 
    END;

  • Keyboard,cursor question.

    when the cursor in the textArea,how to forbit(ignore) the keyboard input,
    and how locate the cursor's position,(for example i press a button,
    then will show some text in the current cursor's position)
    Thank in advance.

    Add a keylistener to your textarea and consume all keypresses you do not want. Something on the line of this:
    public class numericTextField
        extends javax.swing.JTextField {
      public numericTextField() {
        super();
        this.addKeyListener(new java.awt.event.KeyAdapter() {
          public void keyTyped(java.awt.event.KeyEvent e) {
            char c = e.getKeyChar();
            if (!((Character.isDigit(c) ||
                   (c == java.awt.event.KeyEvent.VK_BACK_SPACE) ||
                   (c == java.awt.event.KeyEvent.VK_DELETE)))) {
              getToolkit().beep();
              e.consume();
    }Hope this helps.
    Kisses,
    Mink

  • Oracle cursor question

    Hello,
    When using cursors, is it the same thing if i issue:
    cursor c is .....
    r c%rowtype;
    begin
    for r in c loop .... end loop;or
    loop
    open c;
    fetch c into r;
    exit when c%NOTFOUND;
    -- do some actions....
    end loop;?
    Or is it any difference?
    Thanks
    Edited by: Roger22 on 23.06.2010 10:59

    user13165454 wrote:
    I understand both are almost same process to iterate through the result set. One is iterating the cursor result set while the other one is using for loop iteration.There is no such thing as a "+cursor result set+" - this creates the illusion that a physical set of results are created by the cursor and the client is fetching rows from this data set.
    Does not work like this. Where would such a result set lives? In database memory? What then about scalability? Such a result set can potentially contain millions of rows. A database server can be required to service 1000's of open cursors at the same time.
    Such a result set approach cannot scale as it will make a huge demand on memory.
    The results of a cursor is the output of a cursor. The cursor (the set instructions to find the relevant rows) are executed by the server. Rows are found. These are output. And the process repeats with each fetch where the cursor finds the next set of rows (based on Oracle multi version concurrency control model) to output to the client.
    As for the difference between a FOR cursor loop and a FETCH cursor loop - simply one of implicit versus explicit cursor variable management. There is no difference in how the server-side SQL cursor is used.
    E.g.
    -- FETCH loop                 -- FOR loop
    open c;                       for varBuffer in (...)  -- cursor is implicitly opened
    loop                          loop
      fetch c into varBuffer;          -- n.a. as the fetch is implicitly performed into the buffer variable "varBuffer"
      exit when c%notfound;            -- n.a. as loop will automatically terminated when %notfound
      .. process ..                    .. process ..
    end loop;                    end loop;     
    close c;                     -- n.a. as cursor is implictly closedWhich one is faster? Neither really. Both do the same things..
    a) open a cursor on the Oracle server
    b) fetch from the cursor
    c) close the cursor
    Whether that is implicitly or explicitly done, is irrelevant in terms of performance in this case.
    What is important is how the cursor on the client side acts. The FOR loop does an implicit bulk collect of a 100 rows (10g and later). With the FETCH loop one needs to manually code the bulk collect. But there one has more flexibility as one can also use bulk processing (i.e. a FORALL DML). This is not possible in the FOR loop as it does not provide access to the implicit collection used for the bulk fetch.
    On the Oracle side.. both will use the VERY SAME CURSOR for the same source SQL statement. It is important to note that "cursor performance" is not really relevant on the Oracle server side. Whether the client uses a ref cursor, DBMS_SQL cursor, implicit cursor, explicit cursors.. the Oracle server side does not know, does not need to know and does not care.
    This is a client side method for interacting with the cursor in the server.. and how "fast" that interaction (e.g single fetch vs bulk fetch) is with the cursor on the server is a client issue.

  • Basic cursor question

    When does the select statement in a cursor get execute?
    Is it when the program gets parsed during execution or when the cursor is opened.
    Thanks
    MD

    FrancisC_1 wrote:
    Would both queries for c1 and c2 be executed? Maybe it's more subtle than that and the queries might be parsed but no data actually fetched?
    I don't know if it matters, but I'm on version 9i.
    Any insight will be appreciated.In short. No.
    The cursor definitions in the declaration section do not cause "execution" of the cursors. This only happens when, you open the cursor, which in your case is done when the relevant FOR loop is started.
    Example:
    SQL> ed
    Wrote file afiedt.buf
      1  CREATE OR REPLACE PROCEDURE p1 (param1 IN VARCHAR2) IS
      2    CURSOR c1 IS
      3      SELECT empno
      4      FROM emp
      5      WHERE empno = to_number(param1);
      6  BEGIN
      7    DBMS_OUTPUT.PUT_LINE('Pre-Open');
      8    FOR r IN c1 LOOP
      9       DBMS_OUTPUT.PUT_LINE(r.empno);
    10    END LOOP;
    11    DBMS_OUTPUT.PUT_LINE('Post-Close');
    12  EXCEPTION
    13    WHEN OTHERS THEN
    14      DBMS_OUTPUT.PUT_LINE('Exception');
    15      RAISE;
    16* END;
    SQL> /
    Procedure created.
    SQL> set serverout on;
    SQL> exec p1('7788');
    Pre-Open
    7788
    Post-Close
    PL/SQL procedure successfully completed.
    SQL> exec p1('77xx');
    Pre-Open
    Exception
    BEGIN p1('77xx'); END;
    ERROR at line 1:
    ORA-01722: invalid number
    ORA-06512: at "SCOTT.P1", line 15
    ORA-06512: at line 1
    SQL>As you can see, when an invalid number was passed in, this didn't cause an exception to happen within the declaration section, but only when the FOR loop was started, so the actual execution of the query (that would try to convert the parameter to a number) only happened then, not during the declaration.
    As your procedure is designed to run one FOR loop or the other depending on the parameter, only the one relevant query will be executed.

  • Mouse cursor question....

    On pages, how do i type where the mouse cursor is? On Word you can double click and start typing where the mouse cursor is. Anyone have any ideas??
    Thanks
    -Dave

    Dave,
    I haven't used Word for years, but it never worked that way for me, if I understand what you are getting at, and Pages doesn't work that way.
    If you want to type just anywhere on a blank page, Insert > Text Box and position the box so the upper left corner is where you want to start. Then begin typing.
    Jerry

  • Text cursor question

    Recently moved from OS9 to OSX 10.5.8... and I've having a devil of a time with the text cursor and effectively selecting text (releasing the mouse usually releases the selected text and I seem to have to select text way under the line to actually get it to stick consistently).
    Back in the day, cursors had a "hot spot", which was the actual active pixel within the cursor's image.
    Has the "hot spot" changed a bit in the OS X text cursor, compared to OS 9?
    I'm having the same problems in almost every app.
    Am I barking up the wrong tree here?
    If not, is there some utility that can allow me to adjust the "hot spot"?
    Thanks!

    Are you using a mouse with your Macbook Pro? Are you using the Mighty Mouse or a 3rd party mouse? Have you checked your mouse settings through System Preferences or if using a 3rd party mouse the Preference Pane within System Preferences?
    is there some utility that can allow me to adjust the "hot spot"?
    Check Versiontracker, Macupdate and Google.

  • Custom three part animated cursor

    Ok, I'm trying to see if I can set up a custom style cursor in a flash file.  The idea is to have the static image of a chicken bone (Don't ask) for the primary cursor, swaping to a movie clip of the bone with a fancy glowing effect when it mouses over specific objects, and finally movieclip of a short flash when the mouse clicks in the area.  Being less then expert with actionscript 3, I tried using code snipets, first to try swaping between the three clips (Which with a little tinkering worked allright with two, but adding the third messed everything up.)  However looking at the big mass of code and multiple symbols, I decided to instead make a symbol, and put each of the three cursors symbols into a different frame, then set the event handlers to simply move between frames in the symbol. On creating the test swf, I found that the glowing effect was looping prematurely creating a stuttering effect, and the click effect doesn't always trigger, and sometimes once triggered, it won't change back.
    Here's the code I was using, any thoughts on what I might be doing wrong?
    stage.addChild(BoneCursor);
    BoneCursor.mouseEnabled = false;
    BoneCursor.addEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor_4);
    function fl_CustomMouseCursor_4(event:Event)
         BoneCursor.x = stage.mouseX;
         BoneCursor.y = stage.mouseY;
    Mouse.hide();
    movieClip_1.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverHandler_2);
    function fl_MouseOverHandler_2(event:MouseEvent):void
    BoneCursor.gotoAndStop(2);
    movieClip_1.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
    function fl_MouseClickHandler(event:MouseEvent):void
    BoneCursor.gotoAndStop(3);
    movieClip_1.addEventListener(MouseEvent.MOUSE_OUT, fl_MouseOutHandler_3);
    function fl_MouseOutHandler_3(event:MouseEvent):void
    BoneCursor.gotoAndStop(1);

    Still working with the cursor question on and off, the problem seems to be that for some reason the goto command is being repeatedly exorcised in rapid succession.  I did try fixing it by adding a variable with a value of 1 or 2, and then surounding the gotoAndPlay command with an IF statement asking the value of the variable, then changing it after executing the gotoAndPlay.
    I also reworked a test cursor so that instead of three frames with three seperate movie clips forming the cursor movieclip Symbol, the cursor movieclip symbol had one frame(With a stop command) for the first cursor, then a tween for the animated portion.  Mainly made the change to try doing more of the animation inside flash instead of imported from aftereffects inc case that was where the trouble was coming from, but the end result still kept restarting the animation rather than letting it loop at full length.
    Any thoughts on where this problem could be arising from?

  • Repair in safe mode 10.5.8

    Hello, so I'm having some issues;
    My MacBook Pro 17" dual core 2.3 w/4gb ram (A1212) running 10.5.8 started acting up.
    I started getting 2" gray boxes and copying program pages when the window would close or move.
    I assumed that my graphics card gave out; because that seems to be the problem with these machines, and I'm a video editor and put a lot of stress on my "old girl"... cs4 suite, maya unlimited, zbrush, sometimes rendering all night. And of course I did not have Time Machine on because i needed to optemise ram, memory, processor speed...ect....
    For about a week I would just restart the Macbook and start over.
    Then it stopped starting all together. I would get the start up apple screen, then the cycle apple, then blue. It stayed blue for half an hour before i gave up
    I tried holding the start button until it made that horrible noise, resetted the pram, smc.. nothing
    Then as my last resort, I looked into starting up in "safe mode."
    I pushed power and held down select until the cycle apple came on and released; then after about a minute it went blue, then after about 5 minutes it started up in safe mode!
    There are no gray boxes, just some ghosting that looks like processing script under the cursor.
    questions-
    1) So being that its starting up, can I assume its not the graphics card?
    2) What do I do from here to repair computer so I can operate normal again?
    3) Will I be able to repair without any OS disks?
    4) If I take it into apple, can they save my programs?
    ...I don't really care about the adobe programs, but maya took a lot of effort to get on my mac(I lost my registration numbers), and I don't have the disks for zbrush and some other programs(I don't have any of the disks anymore, being that it's been almost 6 years)
    Thank you for your help!
    -ry

    Usually the data on a HDD can be retrieved.  Take it out of the MBP, install it in an enclosure and connect it to another Mac and you should be able to see all of your data unless the HDD is also part of your problems.
    I suggest that you take your MBP to an Apple store and get a diagnosis of what hardware problems exist and the costs involved in repairing them.  The diagnosis will be free, any repairs will not.
    Ciao.

Maybe you are looking for