DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: use of trigger within in a procedure

  1. #1
    Join Date
    Oct 2001
    Location
    CANADA
    Posts
    9
    Hi all,
    Let say I have a table with data like this:

    id id2 id3
    100 12.5
    200 13.5
    300 15.4

    Now What I want to do is update the id column with a sequance(start from 1). I know I could write a trigger on this table but my question is I'm not updatating anything else in within the procedure only the id column. So I am not sure I could do this within a procedure. How can I achive this?

    Thanks,

  2. #2
    Join Date
    Jan 2002
    Posts
    148
    its real simple ...

    create ur desired trigger for update

    and update the table with id = id column..

    lol

    Jr.

  3. #3
    Join Date
    Apr 2002
    Posts
    4

    Wink

    Hi,
    Please user the following simple block, I have created test table having id columns as you have mentioned and also testseq sequence. Block was able to change the id with the sequence numbers.
    I have tested this block and working fine.
    begin
    for rec in
    (select id from test)
    loop
    update test set id=testseq.nextval
    where id=rec.id;
    commit;
    end loop;
    end;
    Dilesh

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width