adspace
Answer Posted / Dheeraj Kumar Jha
Yes, DML (Data Manipulation Language) statements can be called inside functions in PL/SQL. Here's an example of a simple function that performs an INSERT statement:
CREATE OR REPLACE FUNCTION insert_record(p_column1 VARCHAR2, p_column2 NUMBER) RETURN NUMBER AS
v_return NUMBER;
BEGIN
INSERT INTO table_name (column1, column2) VALUES (p_column1, p_column2);
COMMIT; -- Assuming AUTOCOMMIT is OFF.
SELECT LAST_INSERT_ID INTO v_return FROM dual;
RETURN v_return;
END;/
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
what are all the common sql function? : Sql dba
how to use regular expression in pattern match conditions? : Sql dba
what is collation? : Sql dba
define sql insert statement ? : Sql dba
what is dbms? : Sql dba
how to escape special characters in sql statements? : Sql dba
Do we need to rebuild index after truncate?
What is your daily office routine?
what are aggregate and scalar functions? : Sql dba
what is sql server agent? : Sql dba
Can we use distinct and group by together?
Does group by remove duplicates?
how to start mysql server? : Sql dba
what are the advantages of sql ? : Sql dba
Is primary key clustered index?