SlideShare una empresa de Scribd logo
1 de 3
Descargar para leer sin conexión
Enhancements in Oracle 23c: Introducing the New/Old
Returning Clause
Oracle 23c brings a host of new features aimed at simplifying application development. One
standout feature is the enhanced Returning Clause for Data Manipulation Language (DML)
operations, which now includes the ability to work with both NEW and OLD values. This addition
empowers developers to streamline their code, boost productivity, and enhance performance.
Understanding the Returning Clause:
The RETURNING INTO clause for INSERT, UPDATE, and DELETE statements has undergone
signi
fi
cant improvements. It now provides a comprehensive report on the OLD and NEW values
a
ff
ected by the respective statement.
This means that developers can employ the same logic for all DML types to retrieve values before
and after the execution of a statement.
It’s important to note that old and new values are only applicable to UPDATE statements.
INSERT statements exclusively return new values, while DELETE statements only report old
values.
The Evolution from the Previous Norm:
Previously, Oracle’s returning clause primarily focused on providing new values. For example, in
cases where an application inserted data into a table, it would return an auto-generated ID for the
row. In the context of updates, developers could return the ID along with the updated row and
other relevant columns. While it was possible to retrieve old column values for updates through
some workarounds, it was by no means straightforward. Oracle’s commitment to simplifying the
process for application developers led to the introduction of this feature as a SQL clause.
Utilizing the New Returning Clause:
This newly enhanced feature allows developers to retrieve either a single row/value or multiple
rows/values, o
ff
ering a
fl
exible and dynamic approach to data manipulation. Let’s delve into a
example:
set serveroutput on
DROP table if exists TEST_TAB purge;
CREATE TABLE TEST_TAB (columnA VARCHAR2(10), columnB number);
INSERT INTO TEST_TAB(columnA, columnB) VALUES ('Test', 10);
INSERT INTO TEST_TAB(columnA, columnB) VALUES ('Row 2', 20);
CREATE TABLE IF not exists audit_table1(col_new VARCHAR2(10),col_old VARCHAR2(10),
columnB number);
DECLARE
TYPE columnA_TYPE IS TABLE OF TEST_TAB.columnA%TYPE;
OLD_columnA columnA_TYPE;
NEW_columnA columnA_TYPE;
BEGIN
UPDATE TEST_TAB AA
SET AA.columnA = 'NEW_VALUE'
WHERE AA.columnB < 30
RETURNING OLD columnA, NEW columnA
BULK COLLECT INTO OLD_columnA, NEW_columnA;
FOR I IN 1 .. OLD_columnA.COUNT LOOP
DBMS_OUTPUT.PUT_LINE('Old.columnA = ' || OLD_columnA(I));
DBMS_OUTPUT.PUT_LINE('New.columnA = ' || NEW_columnA(I));
--insert into audit_table1 values ( NEW_columnA, OLD_columnA);
END LOOP;
END;
Output
-------------------
Old.columnA = Test
New.columnA = NEW_VALUE
Old.columnA = Row 2
New.columnA = NEW_VALUE
Oracle 23c’s enhanced RETURNING clause can come in handy in application auditing,
Application level Change Data Capture, and many application-driven logic.
This powerful feature promises to be a game-changer for developers seeking code e
ffi
ciency,
precision, and performance in their applications.
Insert and Delete
The NEW and OLD keywords can be used on INSERT and DELETE also, but they don't bring
anything new to the table. For inserts we have no old values, and for deletes we have no new
values.
set serveroutput on
declare
l_old_code t1.code%type;
l_old_description t1.description%type;
l_new_code t1.code%type;
l_new_description t1.description%type;
begin
insert into t1 (id, code, description)
values (5, 'FIVE', 'Description for FIVE')
returning old code , old description, new code, new description
into l_old_code, l_old_description, l_new_code, l_new_description;
dbms_output.put_line('l_old_code = ' || l_old_code);
dbms_output.put_line('l_old_description = ' || l_old_description);
dbms_output.put_line('l_new_code = ' || l_new_code);
dbms_output.put_line('l_new_description = ' || l_new_description);
rollback;
END;
/
------------------
l_old_code =
l_old_description =
l_new_code = FIVE
l_new_description = Description for FIVE
PL/SQL procedure successfully completed.
SQL>
--------------------------
set serveroutput on
declare
l_old_code t1.code%type;
l_old_description t1.description%type;
l_new_code t1.code%type;
l_new_description t1.description%type;
begin
delete from t1
where id = 2
returning old code , old description, new code, new description
into l_old_code, l_old_description, l_new_code, l_new_description;
dbms_output.put_line('l_old_code = ' || l_old_code);
dbms_output.put_line('l_old_description = ' || l_old_description);
dbms_output.put_line('l_new_code = ' || l_new_code);
dbms_output.put_line('l_new_description = ' || l_new_description);
rollback;
END;
/
l_old_code = TWO
l_old_description = Description for TWO
l_new_code =
l_new_description =
PL/SQL procedure successfully completed.
SQL>
Also you can use this feature instead of Golden gate to achieve xhange data capture (CDC) using
some manually scripts.
Alireza Kamrani.

Más contenido relacionado

Similar a Enhancements in Oracle 23c Introducing the NewOld Returning Clause

Oracle_Analytical_function.pdf
Oracle_Analytical_function.pdfOracle_Analytical_function.pdf
Oracle_Analytical_function.pdfKalyankumarVenkat1
 
Les08 (manipulating data)
Les08 (manipulating data)Les08 (manipulating data)
Les08 (manipulating data)Achmad Solichin
 
L9 l10 server side programming
L9 l10  server side programmingL9 l10  server side programming
L9 l10 server side programmingRushdi Shams
 
The Ultimate Guide to Oracle solaris 11 advanced system administration 1 z0 822
The Ultimate Guide to Oracle solaris 11 advanced system administration  1 z0 822The Ultimate Guide to Oracle solaris 11 advanced system administration  1 z0 822
The Ultimate Guide to Oracle solaris 11 advanced system administration 1 z0 822SoniaSrivastva
 
SQL – The Natural Language for Analysis - Oracle - Whitepaper - 2431343
SQL – The Natural Language for Analysis - Oracle - Whitepaper - 2431343SQL – The Natural Language for Analysis - Oracle - Whitepaper - 2431343
SQL – The Natural Language for Analysis - Oracle - Whitepaper - 2431343Edgar Alejandro Villegas
 
Cursors, triggers, procedures
Cursors, triggers, proceduresCursors, triggers, procedures
Cursors, triggers, proceduresVaibhav Kathuria
 
Scalar user defined function in sap hana
Scalar user defined function in sap hanaScalar user defined function in sap hana
Scalar user defined function in sap hanakabilarasan R
 
Les18[1]Interacting with the Oracle Server
Les18[1]Interacting with  the Oracle ServerLes18[1]Interacting with  the Oracle Server
Les18[1]Interacting with the Oracle Serversiavosh kaviani
 

Similar a Enhancements in Oracle 23c Introducing the NewOld Returning Clause (20)

Oracle_Analytical_function.pdf
Oracle_Analytical_function.pdfOracle_Analytical_function.pdf
Oracle_Analytical_function.pdf
 
Les08 (manipulating data)
Les08 (manipulating data)Les08 (manipulating data)
Les08 (manipulating data)
 
Les08
Les08Les08
Les08
 
L9 l10 server side programming
L9 l10  server side programmingL9 l10  server side programming
L9 l10 server side programming
 
The Ultimate Guide to Oracle solaris 11 advanced system administration 1 z0 822
The Ultimate Guide to Oracle solaris 11 advanced system administration  1 z0 822The Ultimate Guide to Oracle solaris 11 advanced system administration  1 z0 822
The Ultimate Guide to Oracle solaris 11 advanced system administration 1 z0 822
 
Oracle etl openworld
Oracle etl openworldOracle etl openworld
Oracle etl openworld
 
PL/SQL 3 DML
PL/SQL 3 DMLPL/SQL 3 DML
PL/SQL 3 DML
 
DOODB_LAB.pptx
DOODB_LAB.pptxDOODB_LAB.pptx
DOODB_LAB.pptx
 
Sql DML
Sql DMLSql DML
Sql DML
 
Sql DML
Sql DMLSql DML
Sql DML
 
SQL – The Natural Language for Analysis - Oracle - Whitepaper - 2431343
SQL – The Natural Language for Analysis - Oracle - Whitepaper - 2431343SQL – The Natural Language for Analysis - Oracle - Whitepaper - 2431343
SQL – The Natural Language for Analysis - Oracle - Whitepaper - 2431343
 
Cursors, triggers, procedures
Cursors, triggers, proceduresCursors, triggers, procedures
Cursors, triggers, procedures
 
plsql Les08
plsql Les08 plsql Les08
plsql Les08
 
Chapter09
Chapter09Chapter09
Chapter09
 
Scalar user defined function in sap hana
Scalar user defined function in sap hanaScalar user defined function in sap hana
Scalar user defined function in sap hana
 
SQL Procedures & Functions
SQL Procedures & FunctionsSQL Procedures & Functions
SQL Procedures & Functions
 
New features of SQL 2012
New features of SQL 2012New features of SQL 2012
New features of SQL 2012
 
Cursores.ppt
Cursores.pptCursores.ppt
Cursores.ppt
 
Les08
Les08Les08
Les08
 
Les18[1]Interacting with the Oracle Server
Les18[1]Interacting with  the Oracle ServerLes18[1]Interacting with  the Oracle Server
Les18[1]Interacting with the Oracle Server
 

Más de Alireza Kamrani

Oracle database maximum performance on Exadata
Oracle database maximum performance on ExadataOracle database maximum performance on Exadata
Oracle database maximum performance on ExadataAlireza Kamrani
 
Clone_a_remote_PDB_in_Data_Guard_Environments_19c_1698741799.pdf
Clone_a_remote_PDB_in_Data_Guard_Environments_19c_1698741799.pdfClone_a_remote_PDB_in_Data_Guard_Environments_19c_1698741799.pdf
Clone_a_remote_PDB_in_Data_Guard_Environments_19c_1698741799.pdfAlireza Kamrani
 
Flashback time travel vs Flash back Data Archive.pdf
Flashback time travel  vs Flash back Data Archive.pdfFlashback time travel  vs Flash back Data Archive.pdf
Flashback time travel vs Flash back Data Archive.pdfAlireza Kamrani
 
Import option in Oracle Database : tip & trick🧶.pdf
Import option in Oracle Database : tip & trick🧶.pdfImport option in Oracle Database : tip & trick🧶.pdf
Import option in Oracle Database : tip & trick🧶.pdfAlireza Kamrani
 
🔴Oracle ASM Filter Driver & ASMLIB & UDEV🔴.pdf
🔴Oracle ASM Filter Driver & ASMLIB & UDEV🔴.pdf🔴Oracle ASM Filter Driver & ASMLIB & UDEV🔴.pdf
🔴Oracle ASM Filter Driver & ASMLIB & UDEV🔴.pdfAlireza Kamrani
 
Recovering a Oracle datafile without backup.pdf
Recovering a Oracle datafile without backup.pdfRecovering a Oracle datafile without backup.pdf
Recovering a Oracle datafile without backup.pdfAlireza Kamrani
 
♨️How To Use DataPump (EXPDP) To Export From Physical Standby….pdf
♨️How To Use DataPump (EXPDP) To Export From Physical Standby….pdf♨️How To Use DataPump (EXPDP) To Export From Physical Standby….pdf
♨️How To Use DataPump (EXPDP) To Export From Physical Standby….pdfAlireza Kamrani
 
♨️CPU limitation per Oracle database instance
♨️CPU limitation per Oracle database instance♨️CPU limitation per Oracle database instance
♨️CPU limitation per Oracle database instanceAlireza Kamrani
 
Out-of-Place Oracle Database Patching and Provisioning Golden Images
Out-of-Place Oracle Database Patching and Provisioning Golden ImagesOut-of-Place Oracle Database Patching and Provisioning Golden Images
Out-of-Place Oracle Database Patching and Provisioning Golden ImagesAlireza Kamrani
 
IO Schedulers (Elevater) concept and its affection on database performance
IO Schedulers (Elevater) concept and its affection on database performanceIO Schedulers (Elevater) concept and its affection on database performance
IO Schedulers (Elevater) concept and its affection on database performanceAlireza Kamrani
 
The Fundamental Characteristics of Storage concepts for DBAs
The Fundamental Characteristics of Storage concepts for DBAsThe Fundamental Characteristics of Storage concepts for DBAs
The Fundamental Characteristics of Storage concepts for DBAsAlireza Kamrani
 
What is Scalability and How can affect on overall system performance of database
What is Scalability and How can affect on overall system performance of databaseWhat is Scalability and How can affect on overall system performance of database
What is Scalability and How can affect on overall system performance of databaseAlireza Kamrani
 
🏗️Improve database performance with connection pooling and load balancing tec...
🏗️Improve database performance with connection pooling and load balancing tec...🏗️Improve database performance with connection pooling and load balancing tec...
🏗️Improve database performance with connection pooling and load balancing tec...Alireza Kamrani
 
Oracle Database 23c–Fine Grained locking features
Oracle Database 23c–Fine Grained locking featuresOracle Database 23c–Fine Grained locking features
Oracle Database 23c–Fine Grained locking featuresAlireza Kamrani
 
Store non-structured data in JSON column types and enhancements of JSON
Store non-structured data in JSON column types and enhancements of JSONStore non-structured data in JSON column types and enhancements of JSON
Store non-structured data in JSON column types and enhancements of JSONAlireza Kamrani
 
PostgreSQL vs Oracle a brief comparison
PostgreSQL vs Oracle a brief  comparisonPostgreSQL vs Oracle a brief  comparison
PostgreSQL vs Oracle a brief comparisonAlireza Kamrani
 
How to take a dump from a Wal file PostgreSQL
How to take a dump from a Wal file PostgreSQLHow to take a dump from a Wal file PostgreSQL
How to take a dump from a Wal file PostgreSQLAlireza Kamrani
 

Más de Alireza Kamrani (17)

Oracle database maximum performance on Exadata
Oracle database maximum performance on ExadataOracle database maximum performance on Exadata
Oracle database maximum performance on Exadata
 
Clone_a_remote_PDB_in_Data_Guard_Environments_19c_1698741799.pdf
Clone_a_remote_PDB_in_Data_Guard_Environments_19c_1698741799.pdfClone_a_remote_PDB_in_Data_Guard_Environments_19c_1698741799.pdf
Clone_a_remote_PDB_in_Data_Guard_Environments_19c_1698741799.pdf
 
Flashback time travel vs Flash back Data Archive.pdf
Flashback time travel  vs Flash back Data Archive.pdfFlashback time travel  vs Flash back Data Archive.pdf
Flashback time travel vs Flash back Data Archive.pdf
 
Import option in Oracle Database : tip & trick🧶.pdf
Import option in Oracle Database : tip & trick🧶.pdfImport option in Oracle Database : tip & trick🧶.pdf
Import option in Oracle Database : tip & trick🧶.pdf
 
🔴Oracle ASM Filter Driver & ASMLIB & UDEV🔴.pdf
🔴Oracle ASM Filter Driver & ASMLIB & UDEV🔴.pdf🔴Oracle ASM Filter Driver & ASMLIB & UDEV🔴.pdf
🔴Oracle ASM Filter Driver & ASMLIB & UDEV🔴.pdf
 
Recovering a Oracle datafile without backup.pdf
Recovering a Oracle datafile without backup.pdfRecovering a Oracle datafile without backup.pdf
Recovering a Oracle datafile without backup.pdf
 
♨️How To Use DataPump (EXPDP) To Export From Physical Standby….pdf
♨️How To Use DataPump (EXPDP) To Export From Physical Standby….pdf♨️How To Use DataPump (EXPDP) To Export From Physical Standby….pdf
♨️How To Use DataPump (EXPDP) To Export From Physical Standby….pdf
 
♨️CPU limitation per Oracle database instance
♨️CPU limitation per Oracle database instance♨️CPU limitation per Oracle database instance
♨️CPU limitation per Oracle database instance
 
Out-of-Place Oracle Database Patching and Provisioning Golden Images
Out-of-Place Oracle Database Patching and Provisioning Golden ImagesOut-of-Place Oracle Database Patching and Provisioning Golden Images
Out-of-Place Oracle Database Patching and Provisioning Golden Images
 
IO Schedulers (Elevater) concept and its affection on database performance
IO Schedulers (Elevater) concept and its affection on database performanceIO Schedulers (Elevater) concept and its affection on database performance
IO Schedulers (Elevater) concept and its affection on database performance
 
The Fundamental Characteristics of Storage concepts for DBAs
The Fundamental Characteristics of Storage concepts for DBAsThe Fundamental Characteristics of Storage concepts for DBAs
The Fundamental Characteristics of Storage concepts for DBAs
 
What is Scalability and How can affect on overall system performance of database
What is Scalability and How can affect on overall system performance of databaseWhat is Scalability and How can affect on overall system performance of database
What is Scalability and How can affect on overall system performance of database
 
🏗️Improve database performance with connection pooling and load balancing tec...
🏗️Improve database performance with connection pooling and load balancing tec...🏗️Improve database performance with connection pooling and load balancing tec...
🏗️Improve database performance with connection pooling and load balancing tec...
 
Oracle Database 23c–Fine Grained locking features
Oracle Database 23c–Fine Grained locking featuresOracle Database 23c–Fine Grained locking features
Oracle Database 23c–Fine Grained locking features
 
Store non-structured data in JSON column types and enhancements of JSON
Store non-structured data in JSON column types and enhancements of JSONStore non-structured data in JSON column types and enhancements of JSON
Store non-structured data in JSON column types and enhancements of JSON
 
PostgreSQL vs Oracle a brief comparison
PostgreSQL vs Oracle a brief  comparisonPostgreSQL vs Oracle a brief  comparison
PostgreSQL vs Oracle a brief comparison
 
How to take a dump from a Wal file PostgreSQL
How to take a dump from a Wal file PostgreSQLHow to take a dump from a Wal file PostgreSQL
How to take a dump from a Wal file PostgreSQL
 

Último

{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...Pooja Nehwal
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts ServiceCall Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Servicejennyeacort
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...soniya singh
 
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts ServiceSapana Sha
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998YohFuh
 
Data Warehouse , Data Cube Computation
Data Warehouse   , Data Cube ComputationData Warehouse   , Data Cube Computation
Data Warehouse , Data Cube Computationsit20ad004
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubaihf8803863
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiSuhani Kapoor
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystSamantha Rae Coolbeth
 
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...shivangimorya083
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingNeil Barnes
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPramod Kumar Srivastava
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSAishani27
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfRachmat Ramadhan H
 

Último (20)

Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
 
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts ServiceCall Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
 
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts Service
 
E-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptxE-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptx
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998
 
Data Warehouse , Data Cube Computation
Data Warehouse   , Data Cube ComputationData Warehouse   , Data Cube Computation
Data Warehouse , Data Cube Computation
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data Analyst
 
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data Storytelling
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICS
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
 

Enhancements in Oracle 23c Introducing the NewOld Returning Clause

  • 1. Enhancements in Oracle 23c: Introducing the New/Old Returning Clause Oracle 23c brings a host of new features aimed at simplifying application development. One standout feature is the enhanced Returning Clause for Data Manipulation Language (DML) operations, which now includes the ability to work with both NEW and OLD values. This addition empowers developers to streamline their code, boost productivity, and enhance performance. Understanding the Returning Clause: The RETURNING INTO clause for INSERT, UPDATE, and DELETE statements has undergone signi fi cant improvements. It now provides a comprehensive report on the OLD and NEW values a ff ected by the respective statement. This means that developers can employ the same logic for all DML types to retrieve values before and after the execution of a statement. It’s important to note that old and new values are only applicable to UPDATE statements. INSERT statements exclusively return new values, while DELETE statements only report old values. The Evolution from the Previous Norm: Previously, Oracle’s returning clause primarily focused on providing new values. For example, in cases where an application inserted data into a table, it would return an auto-generated ID for the row. In the context of updates, developers could return the ID along with the updated row and other relevant columns. While it was possible to retrieve old column values for updates through some workarounds, it was by no means straightforward. Oracle’s commitment to simplifying the process for application developers led to the introduction of this feature as a SQL clause. Utilizing the New Returning Clause: This newly enhanced feature allows developers to retrieve either a single row/value or multiple rows/values, o ff ering a fl exible and dynamic approach to data manipulation. Let’s delve into a example: set serveroutput on DROP table if exists TEST_TAB purge; CREATE TABLE TEST_TAB (columnA VARCHAR2(10), columnB number); INSERT INTO TEST_TAB(columnA, columnB) VALUES ('Test', 10); INSERT INTO TEST_TAB(columnA, columnB) VALUES ('Row 2', 20); CREATE TABLE IF not exists audit_table1(col_new VARCHAR2(10),col_old VARCHAR2(10), columnB number); DECLARE TYPE columnA_TYPE IS TABLE OF TEST_TAB.columnA%TYPE; OLD_columnA columnA_TYPE; NEW_columnA columnA_TYPE; BEGIN UPDATE TEST_TAB AA SET AA.columnA = 'NEW_VALUE' WHERE AA.columnB < 30
  • 2. RETURNING OLD columnA, NEW columnA BULK COLLECT INTO OLD_columnA, NEW_columnA; FOR I IN 1 .. OLD_columnA.COUNT LOOP DBMS_OUTPUT.PUT_LINE('Old.columnA = ' || OLD_columnA(I)); DBMS_OUTPUT.PUT_LINE('New.columnA = ' || NEW_columnA(I)); --insert into audit_table1 values ( NEW_columnA, OLD_columnA); END LOOP; END; Output ------------------- Old.columnA = Test New.columnA = NEW_VALUE Old.columnA = Row 2 New.columnA = NEW_VALUE Oracle 23c’s enhanced RETURNING clause can come in handy in application auditing, Application level Change Data Capture, and many application-driven logic. This powerful feature promises to be a game-changer for developers seeking code e ffi ciency, precision, and performance in their applications. Insert and Delete The NEW and OLD keywords can be used on INSERT and DELETE also, but they don't bring anything new to the table. For inserts we have no old values, and for deletes we have no new values. set serveroutput on declare l_old_code t1.code%type; l_old_description t1.description%type; l_new_code t1.code%type; l_new_description t1.description%type; begin insert into t1 (id, code, description) values (5, 'FIVE', 'Description for FIVE') returning old code , old description, new code, new description into l_old_code, l_old_description, l_new_code, l_new_description; dbms_output.put_line('l_old_code = ' || l_old_code); dbms_output.put_line('l_old_description = ' || l_old_description); dbms_output.put_line('l_new_code = ' || l_new_code); dbms_output.put_line('l_new_description = ' || l_new_description); rollback; END; / ------------------ l_old_code = l_old_description = l_new_code = FIVE l_new_description = Description for FIVE PL/SQL procedure successfully completed.
  • 3. SQL> -------------------------- set serveroutput on declare l_old_code t1.code%type; l_old_description t1.description%type; l_new_code t1.code%type; l_new_description t1.description%type; begin delete from t1 where id = 2 returning old code , old description, new code, new description into l_old_code, l_old_description, l_new_code, l_new_description; dbms_output.put_line('l_old_code = ' || l_old_code); dbms_output.put_line('l_old_description = ' || l_old_description); dbms_output.put_line('l_new_code = ' || l_new_code); dbms_output.put_line('l_new_description = ' || l_new_description); rollback; END; / l_old_code = TWO l_old_description = Description for TWO l_new_code = l_new_description = PL/SQL procedure successfully completed. SQL> Also you can use this feature instead of Golden gate to achieve xhange data capture (CDC) using some manually scripts. Alireza Kamrani.