if I use a statement as follows in a procedure.
update tablename set a = 'aa' where c='dd';
How can I know how many rows were updated?
Please help.
thanks.
Printable View
if I use a statement as follows in a procedure.
update tablename set a = 'aa' where c='dd';
How can I know how many rows were updated?
Please help.
thanks.
I always have seen after the update:
n files updated
Regards
Angel
Here is how according to Metalink note 97874.1:
DECLARE
updt_count NUMBER;
BEGIN
UPDATE updt_rec
SET col1 = 500,
col2 = 'Y'
WHERE col1 <= 25;
SELECT COUNT(*)
INTO updt_count
FROM updt_rec
WHERE col1 <= 25;
DBMS_OUTPUT.PUT_LINE('No of records updated = '|| updt_count);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(' Program failed');
END;
/
If you mean a PL/SQL procedure then use the ROWCOUNT implicit cursor attribut:Code:...
update tablename set a = 'aa' where c='dd';
dbms_ouput.put_line(sql%ROWCOUNT||' rows updated');
...
thanks ales.
the sql%rowcount in oracle is eaqul to @@rowcount in sql server.
thanks very much.
Sorry, I think I was a little bit sleep :-)Quote:
Originally posted by aarroyob
I always have seen after the update:
n files updated
Regards
Angel
Regards
Angel
I'd better say "@@rowcount in sql server is equal to the sql%rowcount in oracle" ;-)Quote:
Originally posted by oceanju
the sql%rowcount in oracle is eaqul to @@rowcount in sql server.