Home » SQL & PL/SQL » SQL & PL/SQL » DML Statement in Function !
DML Statement in Function ! [message #39871] Tue, 20 August 2002 02:04 Go to next message
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 Go to previous message
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.
Previous Topic: Parallel Query Option
Next Topic: Diff. Procedure & Stored Procedure ?
Goto Forum:
  


Current Time: Thu Apr 25 09:56:45 CDT 2024