DML Statement in Function ! [message #39871] |
Tue, 20 August 2002 02:04 |
LuLu
Messages: 4 Registered: June 2001
|
Junior Member |
|
|
Can I add Insert statement in a function
Ex:
CREATE OR REPLACE FUNCTION GET_DATE RETURN NUMBER IS
BEGIN
INSERT INTO TEST VALUES(1);
RETURN 1;
END;
/
|
|
|
Re: DML Statement in Function ! [message #39875 is a reply to message #39871] |
Tue, 20 August 2002 09:09 |
Todd Barry
Messages: 4819 Registered: August 2001
|
Senior Member |
|
|
You can perform DML in a function, although some (myself included) would never do it because of a belief that a function should only return a value and not ever change the data.
If you do include DML in the function, you will not be able to use that function in a SQL statement unless you convert the function to an autonomous transaction.
|
|
|