Can possible write as a insert without update

Hi,
I'm inserting values of first 5 coulmns like below
INSERT INTO SS_ITEM_STAT_OPN(
        REP_ID, ITEM_ID, REPORT_COLUMN_DISPLAY, REPORT_COLUMN_SEQ_NO, BEGIN_VALUE, END_VALUE)
        SELECT
        LN_SEQ_REP_ID, ITEM_ID, REPORT_COLUMN_DISPLAY, REPORT_COLUMN_SEQ_NO, BEGIN_VALUE, END_VALUE
        FROM VW_SCALE_SCORE_CONFIG CROSS JOIN REP_ITEM_STAT_OPN
        WHERE REP_ID = LN_SEQ_REP_ID;and i'm updating next 3 columns based on below statement.Can i write insert statement without update.
FOR LN_SSI_OPN IN NVL(TV_SS_ITEM_STAT_OPN.FIRST,1)..NVL(TV_SS_ITEM_STAT_OPN.LAST,0)
        LOOP
            UPDATE SS_ITEM_STAT_OPN SET
            (TOT_STUD_ITEM_SS,TOT_STUD_CORR_ANS_ITEM_SS ) =  (SELECT COUNT(*) TOT_STUD_ITEM_SS ,
                                                             Count(Case When RESPONSE_IS_CORRECT = 1 Then 1 End) As TOT_STUD_CORR_ANS_ITEM_SS
                                                             FROM PSYCHOMETRIC_ITEM_STAT_OPN A, VW_SCALE_SCORE_CONFIG B
                                                             WHERE    SS_ITEM_STAT_OPN.ITEM_ID=TV_SS_ITEM_STAT_OPN(LN_SSI_OPN).ITEM_ID
                                                             AND     (SS_ITEM_STAT_OPN.BEGIN_VALUE=TV_SS_ITEM_STAT_OPN(LN_SSI_OPN).BEGIN_VALUE
                                                             AND    SS_ITEM_STAT_OPN.END_VALUE=TV_SS_ITEM_STAT_OPN(LN_SSI_OPN).END_VALUE)
                                                              AND     SS_ITEM_STAT_OPN.ITEM_ID = A.ITEM_ID
                                                              AND SS_ITEM_STAT_OPN.END_VALUE = B.END_VALUE
                                                              AND ROUND(A.SCALE_SCORE) > BEGIN_VALUE
                                                              AND ROUND(A.SCALE_SCORE) <= END_VALUE
                                                              AND CONDITION_COLUMN= 'SCALE_SCORE'
                                                              GROUP BY ITEM_ID,END_VALUE
            TOT_STUD_SS                 =  NVL((SELECT COUNT(*) FROM
                                            (SELECT A.TEST_SESSION_DETAIL_ID
                                            FROM PSYCHOMETRIC_ITEM_STAT_OPN A, VW_SCALE_SCORE_CONFIG B,SS_ITEM_STAT_OPN
                                            WHERE SS_ITEM_STAT_OPN.ITEM_ID=TV_SS_ITEM_STAT_OPN(LN_SSI_OPN).ITEM_ID
                                            AND     (SS_ITEM_STAT_OPN.BEGIN_VALUE=TV_SS_ITEM_STAT_OPN(LN_SSI_OPN).BEGIN_VALUE
                                            AND    SS_ITEM_STAT_OPN.END_VALUE=TV_SS_ITEM_STAT_OPN(LN_SSI_OPN).END_VALUE)
                                            AND SS_ITEM_STAT_OPN.END_VALUE = B.END_VALUE
                                            AND ROUND(A.SCALE_SCORE) >B.BEGIN_VALUE
                                            AND ROUND(A.SCALE_SCORE) <= B.END_VALUE
                                            AND CONDITION_COLUMN= 'SCALE_SCORE'
                                            AND A.TEST_DETAIL_ID=TV_TEST_DET(LN_TEST_CNT).TEST_DETAIL_ID
                                            GROUP BY A.TEST_SESSION_DETAIL_ID),VW_SCALE_SCORE_CONFIG
                                            WHERE END_VALUE=TV_SS_ITEM_STAT_OPN(LN_SSI_OPN).END_VALUE
                                            GROUP BY END_VALUE),0)
            WHERE    TEST_DETAIL_ID = TV_TEST_DET(LN_TEST_CNT).TEST_DETAIL_ID
            AND     SS_ITEM_STAT_OPN.ITEM_ID=TV_SS_ITEM_STAT_OPN(LN_SSI_OPN).ITEM_ID
            AND     (SS_ITEM_STAT_OPN.BEGIN_VALUE=TV_SS_ITEM_STAT_OPN(LN_SSI_OPN).BEGIN_VALUE
                    AND    SS_ITEM_STAT_OPN.END_VALUE=TV_SS_ITEM_STAT_OPN(LN_SSI_OPN).END_VALUE);
           -- COMMIT;
end loop;

have a look at the MERGE statement!
P;

Similar Messages

  • How can I use multiple row insert or update into DB in JSP?

    Hi all,
    pls help for my question.
    "How can I use multiple rows insert or update into DB in JSP?"
    I mean I will insert or update the multiple records like grid component. All the data I enter will go into the DB.
    With thanks,

    That isn't true. Different SQL databases have
    different capabilities and use different syntax, That's true - every database has its own quirks and extensions. No disagreement there. But they all follow ANSI SQL for CRUD operations. Since the OP said they wanted to do INSERTs and UPDATEs in batches, I assumed that ANSI SQL was sufficient.
    I'd argue that it's best to use ANSI SQL as much as possible, especially if you want your JDBC code to be portable between databases.
    and there are also a lot of different ways of talking to
    SQL databases that are possible in JSP, from using
    plain old java.sql.* in scriptlets to using the
    jstlsql taglib. I've done maintenance on both, and
    they are as different as night and day.Right, because you don't maintain JSP and Java classes the same way. No news there. Both java.sql and JSTL sql taglib are both based on SQL and JDBC. Same difference, except that one uses tags and the other doesn't. Both are Java JDBC code in the end.
    Well, sure. As long as you only want to update rows
    with the same value in column 2. I had the impression
    he wanted to update a whole table. If he only meant
    update all rows with the same value in a given column
    with the same value, that's trivial. All updates do
    that. But as far as I know there's know way to update
    more than one row where the values are different.I used this as an example to demonstrate that it's possible to UPDATE more than one row at a time. If I have 1,000 rows, and each one is a separate UPDATE statement that's unique from all the others, I guess I'd have to write 1,000 UPDATE statements. It's possible to have them all either succeed or fail as a single unit of work. I'm pointing out transaction, because they weren't coming up in the discussion.
    Unless you're using MySQL, for instance. I only have
    experience with MySQL and M$ SQL Server, so I don't
    know what PostgreSQL, Oracle, Sybase, DB2 and all the
    rest are capable of, but I know for sure that MySQL
    can insert multiple rows while SQL Server can't (or at
    least I've never seen the syntax for doing it if it
    does).Right, but this syntax seems to be specific to MySQL The moment you use it, you're locked into MySQL. There are other ways to accomplish the same thing with ANSI SQL.
    Don't assume that all SQL databases are the same.
    They're not, and it can really screw you up badly if
    you assume you can deploy a project you've developed
    with one database in an environment where you have to
    use a different one. Even different versions of the
    same database can have huge differences. I recommend
    you get a copy of the O'Reilly book, SQL in a
    Nutshell. It covers the most common DBMSes and does a
    good job of pointing out the differences.Yes, I understand that.
    It's funny that you're telling me not to assume that all SQL databases are the same. You're the one who's proposing that the OP use a MySQL-specific extension.
    I haven't looked at the MySQL docs to find out how the syntax you're suggesting works. What if one value set INSERT succeeds and the next one fails? Does MySQL roll back the successful INSERT? Is the unit of work under the JDBC driver's control with autoCommit?
    The OP is free to follow your suggestion. I'm pointing out that there are transactions for units of work and ANSI SQL ways to accomplish the same thing.

  • Can u write the following query without using group by clause

    select sp.sid, p.pid, p.name from product p, supp_prod sp
    where sp.pid= p.pid and
    sp.sid = ( select sid from supp_prod group by sid
    having count(*) =(select count(*) from product));
    thru this, we retrieving all the products delivered by the supplier.
    Can you write the following query without using the group by clause

      select sp.sid, p.pid, p.name
        from product p, supp_prod sp
       where sp.pid= p.pid the above query will still retrieve all the products supplied by the supplier. sub-query is not necessary.
    maybe if you can post some sample data and output will help us understand what you want to achieve.

  • Can you write an avi file without using imaq

    Just curious if anybody has tried to write an avi file without using imaq vi's? So far I have only found sketchy info on the file format and am looking for some help on the file structure etc. Any references or example avi files with explanations of format would be most helpfull. Thanks in advance -

    Absolutely.......
    An AVI video file is actually structured in the same way as most Windows media files or RIFF files as they are generically known, thus the description below is applicable to for example WAV files etc.
    Thus the file always begins with the four byte code RIFF and continues to use this generic four byte coding known as FOURCC, four-character code or FCC throughout.
    There are then specific requirements for each different media content and the sections that must be included to define a valid file structure of the desired meadia type.
    Each section or 'CHUNK' is defined by an FCC (RIFF being the first) with facility to include additional FCC's as required. The FCC is followed by a length descriptor and then the data (just for fun the odd CHUNK does not quite fit this very general overview). These chunks then align to even word boundries so padding zeros are often inserted at the end of a CHUNK to make it all nice and neat.
    It is a requirement that software that does not recognise an additional custom CHUNK should ignore it, this is very easy as all you have to do is use the length descriptor to 'jump' over the CHUNK concerned.
    The following is an example from the 'CLOCK.AVI' found on windows computers for a number of years...
    RIFFjB AVI LISTΠhdrlavih8
    Here you can see the RIFF followed by a four byte length descriptor (4 Gigabytes), followed by various sub CHUNKS in this example the sub CHUNK is an AVI (note that it is actually 'AVI ' to conform to the FCC).
    So the CHUNK structure looks a bit like this:-
    RIFF ('AVI '
    LIST ('hdrl'
    'avih'()
    LIST ('strl'
    'strh'()
    'strf'()
    'strd'()
    'strn'()
    LIST ('movi'
    {SubChunk | LIST ('rec '
    SubChunk1
    SubChunk2
    ['idx1']
    For more information on all this you need to read the RIFF specification documentation on the MSDN website or on the MSDN Technet materials. Most of the stuff you will immediately locate will refer to the AVI file format as that is where most of the recent effort has been focused.

  • How can I write an iBook review without using iTunes?

    I have a problem on how can I write a review on an iPad book or iBook without using iTunes. Some of my friends are also asking me on how can I write a review on an iBook without using iTunes. I am on dilemma and I need your help to solve this problem. I hope you can respond soon if possible. Thanks.

    Simple, you cannot.  You can only post reviews through the store front gateway.
    Well, actually, you can write the review in any editor or tool you wish to use, but to post it, you have to login to the store account.  If you do not have an AppleID and store account, you cannot post a review.

  • How can you create a simple insert or update trigger

    I am trying to create a simple insert or update trigger to timestamp an xml document when I load it into my XML DB repository but I always get an error trying to compile the trigger.
    "ORA-25003: cannot change NEW values for this column type in trigger"
    Here is my PL/SQL:
    CREATE OR REPLACE TRIGGER "PLCSYSADM"."PLCSYSLOG_TIMESTAMP"
    BEFORE
    INSERT
    OR UPDATE ON "PLCSYSADM"."PLCSYSLOG"
    FOR EACH ROW BEGIN
    :new.sys_nc_rowinfo$ := xmltype('<datestamp>' || SYSDATE || '</datestamp>');
    END;
    Does anyone have an example that works ?
    Thanks in advance
    Niels Montanana

    http://developer.apple.com/referencelibrary/HardwareDrivers/idxUSB-date.html

  • Can't write to mounted HDD after updates. (SOLVED)

    Im using XFCE as my DE.
    I can no longer write to mounted HDD. Neither the 2nd HDD in my computer or my USB backup drive. I can't write to them as root either?!
    I can read them just fine, even drag files from them but nothing at all will write to them.
    Any ideas??
    Last edited by ashlee84 (2011-09-29 17:50:24)

    This is the output of the above command.
    proc              on  /proc                     type    proc                   (rw,nosuid,nodev,noexec,relatime)
    sys               on  /sys                      type    sysfs                  (rw,nosuid,nodev,noexec,relatime)
    udev              on  /dev                      type    devtmpfs               (rw,nosuid,relatime,size=10240k,nr_inodes=256944,mode=755)
    run               on  /run                      type    tmpfs                  (rw,nosuid,nodev,noexec,relatime,size=10240k,mode=755)
    /dev/sdb1         on  /                         type    ext3                   (rw,commit=0)
    devpts            on  /dev/pts                  type    devpts                 (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
    shm               on  /dev/shm                  type    tmpfs                  (rw,nosuid,nodev,relatime)
    tmpfs             on  /tmp                      type    tmpfs                  (rw,nosuid,nodev)
    /dev/sdb2         on  /var                      type    ext3                   (rw,commit=0)
    /dev/sdb4         on  /home                     type    ext3                   (rw,commit=0)
    fusectl           on  /sys/fs/fuse/connections  type    fusectl                (rw)
    gvfs-fuse-daemon  on  /home/ash/.gvfs           type    fuse.gvfs-fuse-daemon  (rw,nosuid,nodev,user=ash)
    /dev/sdc1         on  /media/FreeAgent          GoFlex  Drive                  type                                                                     ntfs  (ro,nosuid,nodev,uid=1000,gid=100,dmask=0077,fmask=0177,uhelper=udisks)
    /dev/sda2         on  /media/4A2026C32026B63B   type    ntfs                   (rw,nosuid,nodev,uid=1000,gid=100,dmask=0077,fmask=0177,uhelper=udisks)
    SDC1 is my removable drive, which for some reason i can see straight away it says RO?
    SDA2 is my other HDD, my Windows drive, i can't right to that either.
    I will have a proper look at the above articles after work, i thought i would quickly post this up to see if someone spots anything obvious.
    Thank you.

  • Can't download itunes 10.7 without updating to Mac OS X 10.6.8

    I downloaded itunes 10.7 but cant install it unless i update my software to Mac OS X 10.6.8. I just got the iphone 5 and need to activate but am not able to due to that error message.
    When i check software updates thats not available to not sure what to do.

    I am am having the same problem.  My macbook is from 2009 and recently stopped updating to the latest software.  Apparently my license agreement or whatever has run out and in order to get the latest software I have to pay for it.  However my mac has been running so slow lately I fear paying to update for fear that my mac will just die.  So sad, my mac has always been so good until recently.  My itunes kept saying it was up to date and it wouldn't update my iphone, so I went to the website and downloaded 10.7 only to find out that I can't install it.  So sad, my computer is officially so outdated that I can't do anything now without paying!  ****....whats a girl to do.  I feel you on this.  Im running on Mac 10.5.8 too, and yep...were just that outdated.

  • Can new windows drivers be installed without updating to leopard?

    I was wondering if the new windows drivers on the leopard install disc can be installed in windows without upgrading tiger on the other partition?
    I want to upgrade tiger to leopard but want to wait till i have more time to complete the process, but i do want to check out the new windows drivers now.

    How would you extract the drivers from the Leopard disk?
    Normally, you create/install the Boot Camp assistant, which extracts the drivers.
    Anyone with Leopard installed can always supply anyone else with a new drivers disk, and, I would expect in time that the Windows system itself would be capable of obtaining the drivers. After all the main problem is that manufacturers have not yet written drivers for Windows on a Mac. Once the Mac hardware becomes "standard" there should be no problem using Windows update directly to get new drivers.
    This is what I am expecting to happen with my 64-bit Vista install on this box.

  • Using AOL and Firefox. My e-mail replies are halted mid-sentence. How can I write longer e-mails without cut-off?

    As I write a reply to an e-mail, my input stops. I must press Enter and go down three or four lines before my typing will again be accepted. What is causing this glitch and how might I eliminate it?

    Hello,
    Many site issues can be caused by corrupt cookies or cache. In order to try to fix these problems, the first step is to clear both cookies and the cache.
    Note: ''This will temporarily log you out of all sites you're logged in to.''
    To clear cache and cookies do the following:
    #Go to Firefox > History > Clear recent history or (if no Firefox button is shown) go to Tools > Clear recent history.
    #Under "Time range to clear", select "Everything".
    #Now, click the arrow next to Details to toggle the Details list active.
    #From the details list, check ''Cache'' and ''Cookies'' and uncheck everything else.
    #Now click the ''Clear now'' button.
    Further information can be found in the [[Clear your cache, history and other personal information in Firefox]] article.
    Did this fix your problems? Please report back to us!
    Thank you.

  • I can't install iTunes 10.7 without updating MAC OS, not sure which version to install

    I just bought the iPhone 5, trying to synch with iTunes to get settings, contacts, photos etc. installed. Got a message that iTunes version 10.7 or later is required. Went to www.itunes.com and downloaded the update, got a message that it requires MAC OSX version 10.6.8 or later. My MAC (Intel based) is currently running 10.5.8. When I select Software Update, it tells me that all software is up to date. I'm not sure what to do next. After some searching, I found:
    Mac OS X 10.6.8 Update Combo v1.1
    Is this ok to install on my machine?

    There's no fine print to it. In fact, the print is just as big as everything else on the page...
    Look here: http://www.apple.com/iphone/specs.html
    Under System Requirements:
    Apple ID (required for some features)
    Internet access5
    Syncing with iTunes on a Mac or PC requires:
    Mac: OS X v10.6.8 or later
    PC: Windows 7; Windows Vista; or Windows XP Home or Professional with Service Pack 3 or later
    iTunes 10.7 or later (free download from www.itunes.com/download)

  • Warning reads:can't write to/from iPod (wont update my iPod)

    After downloading purchased music, I recv the above message ... can't figure anything I can do to fix this. Going crazy!

    Hi Jeff,
    try 'authorizing' your computer, then you might be able to copy bought music?
    Regards,
    Peter.

  • Can we use both INSERT and UPDATE at the same time in JDBC Receiver

    Hi All,
    I would like to know is it possible to use both INSERT and UPDATE at the same time in one interface because I have a requirement in which I have to perform both the task.
    user send the file which contains both new and old record and I need to save those in MS SQL database.
    If the record exist then use UPDATE otherwise use INSERT.
    I looked on sdn but didn't find any blog which perform both the things at the same time.
    Interface Requirement
    FILE -
    > PI -
    > JDBC(INSERT & UPDATE)
    I am thinking to use JDBC Lookup but not sure if it good to use for bulk record.
    Can somebody please suggest me something or send me the link of any blog or anything to solve this problem.
    Thanks,

    Hi ,
              If I have understood properly the scenario properly,you are not performing insert and update together. As you posted
    "If the record exist then use UPDATE otherwise use INSERT."
    Thus you are performing either an insert or an update which depends on outcome of a search if the records already exist in database or not. Obviously to search the tables you need " select * from ...  where ...." query. If your query returns some results you proceed with update since this means there are some old records already in database. If your query returns no rows  you proceed with "insert into tablename....." since there are no old records present in database.
      Now perhaps the best method to do the searching, taking a decision to insert or update, and finally insert or update operation is to be done by a stored procedure in MS SQL database.  A stored procedure is a subroutine available to applications accessing a relational database system. Here the application is PI server.   If you need further help on how to write and call stored procedure in MS SQL you can look into these links
    http://www.daniweb.com/web-development/databases/ms-sql/threads/146829
    http://www.sqlteam.com/article/stored-procedures-parameters-inserts-and-updates
    [ This part you can ignore, Since its not sure that you will face this situation
        Still you might face some problems while your scenario runs. Lets consider this scenario, after the stored procedure searches the database it found no rows. Thus you proceed with an insert operation. If your database table is being accessed by multiple applications (or users) other than yours then it is very well possible that after the search operation completed with a null result, an insert/update operation has been performed by some other application with the same primary key. Now when you are trying to insert another row with same primary key you get an error message like "duplicate entry not possible for same primary key value". Thus you need to be careful in this respect. MS SQL has a feature called "exclusive locks ". Look into these links for more details on the subject
    http://msdn.microsoft.com/en-us/library/aa213039(v=sql.80).aspx
    http://www.mssqlcity.com/Articles/Adm/SQL70Locks.htm
    http://www.faqs.org/docs/ppbook/r27479.htm
    http://msdn.microsoft.com/en-US/library/ms187373.aspx
    http://msdn.microsoft.com/en-US/library/ms173763.aspx
    http://msdn.microsoft.com/en-us/library/e7z8d5hf(v=vs.80).aspx
    http://mssqlserver.wordpress.com/2006/11/08/locks-in-sql/
    http://www.mollerus.net/tom/blog/2008/03/using_mssqls_nolock_for_faster_queries.html
        There must be other methods to avoid this problem. But the point is you need to be sure that all access to database for insert/update operations are isolated.
    regards
    Anupam

  • Single Page Spry Tabbed Insert - Delete - Update

    Hi Guys
    I like to make a page with three Spry Tabs.
    * Using ( PHP - Mysql )
    * Example ( Table of "Users" Fields ID, Name, Age )
    ( First Tab )
    List of all people with navigation dividing table by ten rows
    each time.
    On each row Delete & Update This person.
    When Clicked on Delete [ Delete This Person and update the
    list ]
    When clicked on Update [ Go to third tab and update this
    exact person ]
    ( Second Tab )
    Insert new person to Mysql
    ( Third Tab )
    Update the person who was send here to be updated from tab
    one
    Can I have all list - Insert - Delete - Update in one page
    under different Spry Tabs? How can I send these info from one tap
    to another. How should I go about this?

    It was never possible to have more than one of those
    behaviours on a page
    using the standard behaviours in previous versions. You
    always had to write
    your own scripts.
    Paul Whitham
    Certified Dreamweaver MX2004 Professional
    Adobe Community Expert - Dreamweaver
    Valleybiz Internet Design
    www.valleybiz.net
    "Sanj" <[email protected]> wrote in message
    news:enjulr$qma$[email protected]..
    > Hi,
    >
    > Prior to Dreamweaver 8.02 it was possible to have more
    than 1
    > Insert/delete/update however this is no longer the case
    - is there a way
    > around this?
    >
    > Thanks!
    >
    > Sanj
    >

  • Reset Field Sequence Value based on Insert OR update on that field

    Hi Experts,
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> WITH TAB AS
      2  (
      3      SELECT 1 ID,2 SEQ FROM DUAL UNION ALL
      4      SELECT 2 ID,1 SEQ FROM DUAL UNION ALL
      5      SELECT 3 ID,4 SEQ FROM DUAL UNION ALL
      6      SELECT 4 ID,3 SEQ FROM DUAL
      7  )SELECT * FROM TAB ORDER BY SEQ
      8  ;
            ID        SEQ
             2          1
             1          2
             4          3
             3          4
    SQL>If i insert or update any of the existing field (SEQ) value, the other values in the field (SEQ) has to
    be resetted, like
    INSERT INTO TAB VALUES(5,1);
    Expected Result:
            ID        SEQ
          5         1     
             2          2
             1          3
             4          4
             3          5
    SQL>
    How can i achieve this?
    Thanks,

    looks like you might be looking for a custom sequence manager.
    you might want to consider using a trigger to do this.
    unfortunately if you use just one trigger you will probably get a mutating exception.
    so you may need to do a multiple trigger approach
    make a place to hold the rows you want to look at
    i called mine tad_mgr
    CREATE OR REPLACE PACKAGE TAD_MGR IS
    *  This package spec holds the row ids of the tad table to be  used in the 3 trigger approach
    type ridArray is table of tab.ID%type index by binary_integer;
    newRows ridArray;
    empty ridArray;
    END;
    /your 1st trigger clears out any left over rows you have.
    CREATE OR REPLACE TRIGGER TAB_1ST
        before INSERT  of ID ON TAB
    declare
    *  This is the 1st trigger in 3 trigger approach to manage seq cds on the tad table
    begin
                    TAD_MGR.newRows :=  TAD_MGR.empty;
    end;
    /your second triggers puts your new or updated row into the container
    CREATE OR REPLACE TRIGGER TAB_2ND
    BEFORE INSERT
    OF ID ON TAB  REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    declare
    This is the 2nd trigger in 3 trigger approach to manage seq cds on the tad table
    begin
                 TAD_MGR.newRows( TAD_MGR.newRows.count+1 ) := :new.id;
    end;
    /finally your last trigger does the updates.
    CREATE OR REPLACE TRIGGER TAB_3RD
    AFTER INSERT OF ID ON TAB
    declare
    This is the 3RD trigger in 3 trigger approach to manage seq cds on the tad table
    aSEQ  tab.seq%type;
    aId   tab.id%type;
    begin
      for i in 1 ..TAD_mgr.newRows.count loop
        select ID, SEQ into aId, aSeq from tab where id = taD_mgr.newRows(i);
        for c in (select  id, seq  FROM tab where seq >= aSeq and id != aid ) loop
            update tab
            set seq = c.seq + 1
            where id = c.id;
        end loop;
    end loop;
               taD_mgr.newRows := taD_mgr.empty;
       end;
    /I just did this for the insert just as an example but you can change the triggers to insert or update and change the logic accordingly
    Edited by: pollywog on Apr 12, 2010 7:14 AM

Maybe you are looking for