I've always thought that user defined functions could not upate the database unless they were autonomous at least thats what i read in my plsql book. Yet i find i can do the following, here i find my function 'change_emp' is able to update the emp_ids of the table 'EMP'. What have i misunderstood?
Cheers Gus

CREATE TABLE EMP(emp_id NUMBER(3), NAME VARCHAR2(30), job VARCHAR2(50));

CREATE OR REPLACE FUNCTION change_emp
RETURN VARCHAR2
IS
--PRAGMA autonomous_transaction;
BEGIN
UPDATE EMP
SET emp_id = emp_id + 5;
RETURN 'Latest entry';
END;

INSERT INTO EMP VALUES(1, 'John Mills', 'Writer');

INSERT INTO EMP VALUES(2, 'David Gray', 'Singer/song writer');


Now if i use my user-defined function it makes changes to the DB??

INSERT INTO EMP VALUES(3, 'Blue Nile', change_emp);