(1) delete from a where b = c; if(SQL%ROWCOUNT > 0) then DBMS_OUTPUT.PUT_LINE('delete successfully ...' ); end if;
(2) update a set b = d where b = c; if(SQL%ROWCOUNT > 0) then DBMS_OUTPUT.PUT_LINE('update successfully ...' ); end if; sorry, typo.... I meant 'update successfully ...' in (2). I guess what I meant was if there is any thing in plsql language in *whateverhere* that would make the followings work: update a set b = d where b = c; delete from a where b = c; if(SQL%ROWCOUNT > 0) then if(*whateverhere*) then DBMS_OUTPUT.PUT_LINE('delete successfully ...' ); else DBMS_OUTPUT.PUT_LINE('update successfully ...' ); end if; end if; Thanks. On Apr 21, 4:56 pm, ddf <orat...@msn.com> wrote: > On Apr 21, 3:47 pm, student4life <student4li...@gmail.com> wrote: > > > > > On Apr 21, 1:09 pm, "Rob Wolfe" <rob.wo...@oraclegeeks.com> wrote: > > > > On Tue, April 21, 2009 11:59, student4life wrote: > > > > > could someone inform me how one can tell/differentiate whether a > > > > completed transaction was update or delete ? (for example, SQL > > > > %ROWCOUNT does NOT differentiate the two). TIA > > > > I think you have lost me completely. Can you give a concrete example of > > > when you would foresee needing to do this along with a short code snippet > > > showing what you mean? > > > > Rob > > > For example, > > > (1) delete from a where b = c; > > > if(SQL%ROWCOUNT > 0) then > > DBMS_OUTPUT.PUT_LINE('delete successfully ...' ); > > end if; > > > (2) update a set b = d where b = c; > > > if(SQL%ROWCOUNT > 0) then > > DBMS_OUTPUT.PUT_LINE('delete successfully ...' ); > > end if; > > > Is it possible to use only 1 if statement instead of 2? > > No, since you have two different transactions (an update and a delete) > and SQL%ROWCOUNT is reset when the next transaction begins so the > number of rows deleted will be lost when you start the update. And > simply because SQL%ROWCOUNT = 0 doesn't mean the delete or update > wasn't successful (which in my mind means didn't generate an error), > just that no rows met the criteria. > > David Fitzjarrell --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To post to this group, send email to Oracle-PLSQL@googlegroups.com To unsubscribe from this group, send email to oracle-plsql-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Oracle-PLSQL?hl=en -~----------~----~----~----~------~----~------~--~---