Can we call dml statement in function?
Answer / 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 |
What is PL/SQL Records?
how to drop an existing table in mysql? : Sql dba
Mention what does plvtab enables you to do when you showthe contents of pl/sql tables?
What is rtm in testing?
package specification-3 procedures package body-4 procedures how can i write for other procedure in package body
Describe the Index, Types of index, At what situation we have used? Which one s better than others?
What is oracle sql called?
What is the difference between UNIQUE CONSTRAINT and PRIMARY KEY? 1. There is no difference. 2. A PRIMARY KEY cannot be declared on multiple columns. 3. A UNIQUE CONSTRAINT cannot be declared on multiple columns. 4. A table can have multiple PRIMARY KEYS but only one UNIQUE CONSTRAINT. 5. A table can have multiple UNIQUE CONSTRAINTs but only one PRIMARY KEY.
Which join is like an inner join?
what is a join? : Sql dba
What is a loop in sql?
How to display the contents of a current record fetched in a reference cursor?
Oracle (3253)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)