Monday, 15 April 2024

Dynamic sql

Retrieving DML Results into a Collection with the RETURNING INTO Clause

http://docs.oracle.com/cd/B19306_01/appdev.102/b14261/tuning.htm


sql_stmt := 'UPDATE Scott.emp
SET sal = (sal+ sal * :a)
where empno = :b
RETURNING sal
INTO :c';

/* Executing a Dynamic SQL for Oracle Version 8.1.7 onwards */

EXECUTE IMMEDIATE sql_stmt USING VarSalPercentage,VarEmpno RETURNING INTO UpdatedSalary;

/* You can use this way als0
EXECUTE IMMEDIATE sql_stmt USING VarSalPercentage,VarEmpno,OUT UpdatedSalary; */

------------------------------------------------------------------------------
COPY is Undead: copy data from one database to another.

Copy command is obsolete now, but still useful when you need to copy large amount of data (espcially LONG datatype)  without filling the undo/rollback segments.

http://docs.oracle.com/cd/B10500_01/server.920/a90842/apb.htm

--------------------------------------------------------
Dont Forget: http://www.oracle.com/technetwork/articles/sql/11g-misc-091388.html

No comments:

Post a Comment