SlideShare a Scribd company logo
2
Most read
4
Most read
11
Most read
Data Blocks on Different Data Sources
Objectives
• Base a data block on FROM clause sub query
• Base a data block on a stored procedure
• Return a REF cursor from a stored procedure
• Return a table of records from a stored procedure
• Select the appropriate data source for a
data block
Data source Types
A/C No:
Branch:
Balance:
A/C No:
Branch:
Balance:
TableTable
Transactional
trigger
Transactional
trigger
FROM clause
query
Stored
procedure
Query DML
Stored
procedure
Basing Data Block on a From Clause Query
SELECT deptno, Total_salary
FROM (SELECT deptno,
sum(sal) Total_salary
FROM emp
GROUP BY deptno)
WHERE total_salary>=8000
Why Form Clause Query?
Perform joins, lookups, and calculations on the server (thus avoiding
multiple network trips) without having to define a view every time.
• Improves developer productivity
• Reduces the burden on the DBA
• Improves performance
Basing a Data block on Stored Procedure for
Query Operation
Return data by way of:
• REF cursor
• A Table of records
Procedure
MARTIN
Empno Ename Job
7369 SMITH CLERK
7499 ALLEN SALESMAN
7521 WARD SALESMAN
7566 JONES ANAGER
7654 SALESMAN
7698 BLAKE MANAGER
7782 CLARK MANAGER
Querying
Emp No
Name
Job
Data Block
Basing a Data block on Stored Procedure for
DML Operations
• Return data by way of a table of records
Procedure
MARTIN
Empno Ename Job
7369 SMITH CLERK
7499 ALLEN SALESMAN
7521 WARD SALESMAN
7566 JONES ANAGER
7654 SALESMAN
7698 BLAKE MANAGER
7782 CLARK MANAGER
Updating
Emp No
Name
Job
Data Block
REF Cursor Procedure for Query
Define a package specification with:
• The objects returned by the REF cursor
• The REF cursor
• The query procedure: Data returned
through the first argument (IN OUT)
Define a package body: Write the code for
the query procedure
Table of Records Procedure for Query
Define a package specification with:
• The structure of each row of the table
• The table of records
• The query procedure: Data returned through the first argument (IN
OUT)
Define a package body: Write the code for the
query procedure
Table of Records Procedure for DML
Define a package specification with:
• The structure of each row of the table
• The table of records
• A procedure to insert rows
• A procedure to update rows
• A procedure to delete rows
• A procedure to lock rows
Define a package body by writing the code for
each DML procedure
Returning a Ref Cursor
Query
Fetched rows
REF cursor
REF cursor
Procedure
SQL
SELECT
21
3
4
Emp No
Name
Job
Returning Table of Records
Query
Table of Records
Cursor
Cursor
Procedure
Any
PL/SQL
Code
21
3
4
Emp No
Name
Job
Data Block Wizard
Use the Data Block Wizard to specify the following:
• Data source type
• Query procedure
• Insert procedure
• Update procedure
• Delete procedure
• Lock procedure
Data Source Guidelines
Base a data block on a FROM clause query to:
• Create a “dynamic” view
Base a data block on a stored procedure to:
• Increase control and security
• Specify a SELECT statement at run time
• Query or update multiple tables
• Perform complex computations
• Perform validation and DML on the
server side
Data Source Guidelines
Query
YES
YES
YES
YES
YES
YES
Data Source
Table
View
FROM Clause
Proc-Ref Cur
Proc-Table Rec
Transac. Trigger
DML
YES
YES
NO
NO
YES
YES
Summary
• Base data blocks on new data sources:
– FROM clause query (query only)
– Stored procedure (query and DML)
• Exploit features of stored procedures :
– REF cursors
limited to a single SELECT statement
– Table of records
can be a complex procedure
Ad

Recommended

Oracle Forms: Messages
Oracle Forms: Messages
Sekhar Byna
 
Oracle Form material
Oracle Form material
Rajesh Ch
 
Oracle Forms: Master Detail form
Oracle Forms: Master Detail form
Sekhar Byna
 
Oracle Forms : Transnational Triggers
Oracle Forms : Transnational Triggers
Sekhar Byna
 
Oracle Forms Mouse triggers
Oracle Forms Mouse triggers
Sekhar Byna
 
Oracle Forms Creation
Oracle Forms Creation
Sekhar Byna
 
Oracle Forms: Introduction to multiple Forms
Oracle Forms: Introduction to multiple Forms
Sekhar Byna
 
Oracle Forms- key triggers
Oracle Forms- key triggers
Sekhar Byna
 
Oracle Forms Creation-List of Values (LOV)
Oracle Forms Creation-List of Values (LOV)
Sekhar Byna
 
Oracle Forms Triggers
Oracle Forms Triggers
Sekhar Byna
 
Oracle Forms Tutorial (www.aboutoracleapps.com)
Oracle Forms Tutorial (www.aboutoracleapps.com)
magupta26
 
Oracle Forms: create debug triggers
Oracle Forms: create debug triggers
Sekhar Byna
 
Oracle Apps INVENTORY
Oracle Apps INVENTORY
Manu MK
 
Oracle EBS R 12 Core hr user manual
Oracle EBS R 12 Core hr user manual
Feras Ahmad
 
Oracle Apps - Forms
Oracle Apps - Forms
Bhaskara Reddy Sannapureddy
 
Configuring Parallel Approvers Notification
Configuring Parallel Approvers Notification
Feras Ahmad
 
P2 p and o2c
P2 p and o2c
venugopalram
 
Oracle Forms : Reusable Components
Oracle Forms : Reusable Components
Sekhar Byna
 
Oracle R12 Apps - Order Management Tables & Descriptions
Oracle R12 Apps - Order Management Tables & Descriptions
Boopathy CS
 
Forms 6i guide
Forms 6i guide
Vinay Kumar
 
Oracle Forms : Validation Triggers
Oracle Forms : Validation Triggers
Sekhar Byna
 
Inventory in Oracle apps
Inventory in Oracle apps
gbalagee
 
Oracle apps-interview-questions
Oracle apps-interview-questions
Pakeera Mekala
 
Oracle R12 Apps – Short Notes on Request Group and Request Set
Oracle R12 Apps – Short Notes on Request Group and Request Set
Boopathy CS
 
11 Understanding and Influencing the PL/SQL Compilar
11 Understanding and Influencing the PL/SQL Compilar
rehaniltifat
 
Oracle Forms-Canvas types
Oracle Forms-Canvas types
Sekhar Byna
 
Oracle Quality setup
Oracle Quality setup
Mina Lotfy
 
Oracle Inventory – Inventory Controls
Oracle Inventory – Inventory Controls
Boopathy CS
 
Oracle Forms : Query Triggers
Oracle Forms : Query Triggers
Sekhar Byna
 
Oracle Forms: Menu
Oracle Forms: Menu
Sekhar Byna
 

More Related Content

What's hot (20)

Oracle Forms Creation-List of Values (LOV)
Oracle Forms Creation-List of Values (LOV)
Sekhar Byna
 
Oracle Forms Triggers
Oracle Forms Triggers
Sekhar Byna
 
Oracle Forms Tutorial (www.aboutoracleapps.com)
Oracle Forms Tutorial (www.aboutoracleapps.com)
magupta26
 
Oracle Forms: create debug triggers
Oracle Forms: create debug triggers
Sekhar Byna
 
Oracle Apps INVENTORY
Oracle Apps INVENTORY
Manu MK
 
Oracle EBS R 12 Core hr user manual
Oracle EBS R 12 Core hr user manual
Feras Ahmad
 
Oracle Apps - Forms
Oracle Apps - Forms
Bhaskara Reddy Sannapureddy
 
Configuring Parallel Approvers Notification
Configuring Parallel Approvers Notification
Feras Ahmad
 
P2 p and o2c
P2 p and o2c
venugopalram
 
Oracle Forms : Reusable Components
Oracle Forms : Reusable Components
Sekhar Byna
 
Oracle R12 Apps - Order Management Tables & Descriptions
Oracle R12 Apps - Order Management Tables & Descriptions
Boopathy CS
 
Forms 6i guide
Forms 6i guide
Vinay Kumar
 
Oracle Forms : Validation Triggers
Oracle Forms : Validation Triggers
Sekhar Byna
 
Inventory in Oracle apps
Inventory in Oracle apps
gbalagee
 
Oracle apps-interview-questions
Oracle apps-interview-questions
Pakeera Mekala
 
Oracle R12 Apps – Short Notes on Request Group and Request Set
Oracle R12 Apps – Short Notes on Request Group and Request Set
Boopathy CS
 
11 Understanding and Influencing the PL/SQL Compilar
11 Understanding and Influencing the PL/SQL Compilar
rehaniltifat
 
Oracle Forms-Canvas types
Oracle Forms-Canvas types
Sekhar Byna
 
Oracle Quality setup
Oracle Quality setup
Mina Lotfy
 
Oracle Inventory – Inventory Controls
Oracle Inventory – Inventory Controls
Boopathy CS
 
Oracle Forms Creation-List of Values (LOV)
Oracle Forms Creation-List of Values (LOV)
Sekhar Byna
 
Oracle Forms Triggers
Oracle Forms Triggers
Sekhar Byna
 
Oracle Forms Tutorial (www.aboutoracleapps.com)
Oracle Forms Tutorial (www.aboutoracleapps.com)
magupta26
 
Oracle Forms: create debug triggers
Oracle Forms: create debug triggers
Sekhar Byna
 
Oracle Apps INVENTORY
Oracle Apps INVENTORY
Manu MK
 
Oracle EBS R 12 Core hr user manual
Oracle EBS R 12 Core hr user manual
Feras Ahmad
 
Configuring Parallel Approvers Notification
Configuring Parallel Approvers Notification
Feras Ahmad
 
Oracle Forms : Reusable Components
Oracle Forms : Reusable Components
Sekhar Byna
 
Oracle R12 Apps - Order Management Tables & Descriptions
Oracle R12 Apps - Order Management Tables & Descriptions
Boopathy CS
 
Oracle Forms : Validation Triggers
Oracle Forms : Validation Triggers
Sekhar Byna
 
Inventory in Oracle apps
Inventory in Oracle apps
gbalagee
 
Oracle apps-interview-questions
Oracle apps-interview-questions
Pakeera Mekala
 
Oracle R12 Apps – Short Notes on Request Group and Request Set
Oracle R12 Apps – Short Notes on Request Group and Request Set
Boopathy CS
 
11 Understanding and Influencing the PL/SQL Compilar
11 Understanding and Influencing the PL/SQL Compilar
rehaniltifat
 
Oracle Forms-Canvas types
Oracle Forms-Canvas types
Sekhar Byna
 
Oracle Quality setup
Oracle Quality setup
Mina Lotfy
 
Oracle Inventory – Inventory Controls
Oracle Inventory – Inventory Controls
Boopathy CS
 

Viewers also liked (14)

Oracle Forms : Query Triggers
Oracle Forms : Query Triggers
Sekhar Byna
 
Oracle Forms: Menu
Oracle Forms: Menu
Sekhar Byna
 
the cb model
the cb model
welcometofacebook
 
Oracle Forms :Object Features In forms
Oracle Forms :Object Features In forms
Sekhar Byna
 
database-canvas with multiple datablocks(database)
database-canvas with multiple datablocks(database)
welcometofacebook
 
Five Keys for Performance Management of Oracle Forms and E-Business Suite
Five Keys for Performance Management of Oracle Forms and E-Business Suite
Correlsense
 
New Approaches to Faster Oracle Forms System Performance
New Approaches to Faster Oracle Forms System Performance
Correlsense
 
Oracle Forms Creation part 3
Oracle Forms Creation part 3
Sekhar Byna
 
Oracle Forms : Coding ..
Oracle Forms : Coding ..
Sekhar Byna
 
Principles and parameters of grammar report
Principles and parameters of grammar report
Aubrey Expressionista
 
Oracle 10g Forms Lesson 9
Oracle 10g Forms Lesson 9
KAMA3
 
Oracle Forms Triggers
Oracle Forms Triggers
Sekhar Byna
 
Oracle canvas 140604 2
Oracle canvas 140604 2
Javier Ordozgoiti
 
Smart forms and information templates in Oracle iProcurement
Smart forms and information templates in Oracle iProcurement
Prithis Das, PMP, OCS ☁️
 
Oracle Forms : Query Triggers
Oracle Forms : Query Triggers
Sekhar Byna
 
Oracle Forms: Menu
Oracle Forms: Menu
Sekhar Byna
 
Oracle Forms :Object Features In forms
Oracle Forms :Object Features In forms
Sekhar Byna
 
database-canvas with multiple datablocks(database)
database-canvas with multiple datablocks(database)
welcometofacebook
 
Five Keys for Performance Management of Oracle Forms and E-Business Suite
Five Keys for Performance Management of Oracle Forms and E-Business Suite
Correlsense
 
New Approaches to Faster Oracle Forms System Performance
New Approaches to Faster Oracle Forms System Performance
Correlsense
 
Oracle Forms Creation part 3
Oracle Forms Creation part 3
Sekhar Byna
 
Oracle Forms : Coding ..
Oracle Forms : Coding ..
Sekhar Byna
 
Principles and parameters of grammar report
Principles and parameters of grammar report
Aubrey Expressionista
 
Oracle 10g Forms Lesson 9
Oracle 10g Forms Lesson 9
KAMA3
 
Oracle Forms Triggers
Oracle Forms Triggers
Sekhar Byna
 
Smart forms and information templates in Oracle iProcurement
Smart forms and information templates in Oracle iProcurement
Prithis Das, PMP, OCS ☁️
 
Ad

Similar to Oracle Forms: Data Blocks on Different Sources (20)

PL_SQL - II.pptx
PL_SQL - II.pptx
priyaprakash11
 
PL_SQL_1.pptx fvbxcfbhxdfgh .
PL_SQL_1.pptx fvbxcfbhxdfgh .
RAMIROENRIQUERAMALLO
 
PL/SQL TRIGGERS
PL/SQL TRIGGERS
Lakshman Basnet
 
Introduction to PL/SQL
Introduction to PL/SQL
Kailash N
 
Plsql task
Plsql task
Nawaz Sk
 
Packages - PL/SQL
Packages - PL/SQL
Esmita Gupta
 
BBarters_PL_SQL gives cdemo details.pptx
BBarters_PL_SQL gives cdemo details.pptx
shailesh patil
 
plsql tutorialhub....
plsql tutorialhub....
Abhiram Vijay
 
PL/SQL Fundamentals I
PL/SQL Fundamentals I
Nick Buytaert
 
08 Dynamic SQL and Metadata
08 Dynamic SQL and Metadata
rehaniltifat
 
Plsql guide 2
Plsql guide 2
Vinay Kumar
 
Pl sql guide
Pl sql guide
Vinay Kumar
 
SQl
SQl
sarankumarv
 
Unit 3(rdbms)
Unit 3(rdbms)
Jay Patel
 
Unit 3(rdbms)
Unit 3(rdbms)
Jay Patel
 
10gplsqlslide-120704232925-phJKKJJKKJpapp01.ppt
10gplsqlslide-120704232925-phJKKJJKKJpapp01.ppt
Noorien3
 
Plsql
Plsql
fika sweety
 
PL/SQL Stored Procedures And Cursors.ppt
PL/SQL Stored Procedures And Cursors.ppt
sonaligaikwad281110
 
PL-SQL.pdf
PL-SQL.pdf
Anas Nakash
 
SQL / PL
SQL / PL
srijanani2030
 
Introduction to PL/SQL
Introduction to PL/SQL
Kailash N
 
Plsql task
Plsql task
Nawaz Sk
 
BBarters_PL_SQL gives cdemo details.pptx
BBarters_PL_SQL gives cdemo details.pptx
shailesh patil
 
plsql tutorialhub....
plsql tutorialhub....
Abhiram Vijay
 
PL/SQL Fundamentals I
PL/SQL Fundamentals I
Nick Buytaert
 
08 Dynamic SQL and Metadata
08 Dynamic SQL and Metadata
rehaniltifat
 
Unit 3(rdbms)
Unit 3(rdbms)
Jay Patel
 
Unit 3(rdbms)
Unit 3(rdbms)
Jay Patel
 
10gplsqlslide-120704232925-phJKKJJKKJpapp01.ppt
10gplsqlslide-120704232925-phJKKJJKKJpapp01.ppt
Noorien3
 
PL/SQL Stored Procedures And Cursors.ppt
PL/SQL Stored Procedures And Cursors.ppt
sonaligaikwad281110
 
Ad

More from Sekhar Byna (11)

Oracle Applications R12 architecture
Oracle Applications R12 architecture
Sekhar Byna
 
oracle APPS: Weekly Update
oracle APPS: Weekly Update
Sekhar Byna
 
Oracle APPS :Receivables Auto Invoice
Oracle APPS :Receivables Auto Invoice
Sekhar Byna
 
Oracle apps online training
Oracle apps online training
Sekhar Byna
 
Oracle Forms : Timers
Oracle Forms : Timers
Sekhar Byna
 
Oracle Forms: Oracle Server features
Oracle Forms: Oracle Server features
Sekhar Byna
 
Oracle Forms : Multiple Forms
Oracle Forms : Multiple Forms
Sekhar Byna
 
Oracle Forms: Record Groups
Oracle Forms: Record Groups
Sekhar Byna
 
Oracle Forms :Window and Canvases
Oracle Forms :Window and Canvases
Sekhar Byna
 
Oracle Forms: Non input Items
Oracle Forms: Non input Items
Sekhar Byna
 
Oracle Forms Introduction
Oracle Forms Introduction
Sekhar Byna
 
Oracle Applications R12 architecture
Oracle Applications R12 architecture
Sekhar Byna
 
oracle APPS: Weekly Update
oracle APPS: Weekly Update
Sekhar Byna
 
Oracle APPS :Receivables Auto Invoice
Oracle APPS :Receivables Auto Invoice
Sekhar Byna
 
Oracle apps online training
Oracle apps online training
Sekhar Byna
 
Oracle Forms : Timers
Oracle Forms : Timers
Sekhar Byna
 
Oracle Forms: Oracle Server features
Oracle Forms: Oracle Server features
Sekhar Byna
 
Oracle Forms : Multiple Forms
Oracle Forms : Multiple Forms
Sekhar Byna
 
Oracle Forms: Record Groups
Oracle Forms: Record Groups
Sekhar Byna
 
Oracle Forms :Window and Canvases
Oracle Forms :Window and Canvases
Sekhar Byna
 
Oracle Forms: Non input Items
Oracle Forms: Non input Items
Sekhar Byna
 
Oracle Forms Introduction
Oracle Forms Introduction
Sekhar Byna
 

Recently uploaded (20)

How Automation in Claims Handling Streamlined Operations
How Automation in Claims Handling Streamlined Operations
Insurance Tech Services
 
Download Adobe Illustrator Crack free for Windows 2025?
Download Adobe Illustrator Crack free for Windows 2025?
grete1122g
 
Complete WordPress Programming Guidance Book
Complete WordPress Programming Guidance Book
Shabista Imam
 
Automated Testing and Safety Analysis of Deep Neural Networks
Automated Testing and Safety Analysis of Deep Neural Networks
Lionel Briand
 
HYBRIDIZATION OF ALKANES AND ALKENES ...
HYBRIDIZATION OF ALKANES AND ALKENES ...
karishmaduhijod1
 
Advance Doctor Appointment Booking App With Online Payment
Advance Doctor Appointment Booking App With Online Payment
AxisTechnolabs
 
Streamlining CI/CD with FME Flow: A Practical Guide
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
 
Microsoft-365-Administrator-s-Guide1.pdf
Microsoft-365-Administrator-s-Guide1.pdf
mazharatknl
 
Simplify Insurance Regulations with Compliance Management Software
Simplify Insurance Regulations with Compliance Management Software
Insurance Tech Services
 
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
2nd Sight Lab
 
IObit Driver Booster Pro 12 Crack Latest Version Download
IObit Driver Booster Pro 12 Crack Latest Version Download
pcprocore
 
Y - Recursion The Hard Way GopherCon EU 2025
Y - Recursion The Hard Way GopherCon EU 2025
Eleanor McHugh
 
Why Edge Computing Matters in Mobile Application Tech.pdf
Why Edge Computing Matters in Mobile Application Tech.pdf
IMG Global Infotech
 
Canva Pro Crack Free Download 2025-FREE LATEST
Canva Pro Crack Free Download 2025-FREE LATEST
grete1122g
 
Best Practice for LLM Serving in the Cloud
Best Practice for LLM Serving in the Cloud
Alluxio, Inc.
 
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
BradBedford3
 
Decipher SEO Solutions for your startup needs.
Decipher SEO Solutions for your startup needs.
mathai2
 
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
IFI Techsolutions
 
arctitecture application system design os dsa
arctitecture application system design os dsa
za241967
 
A Guide to Telemedicine Software Development.pdf
A Guide to Telemedicine Software Development.pdf
Olivero Bozzelli
 
How Automation in Claims Handling Streamlined Operations
How Automation in Claims Handling Streamlined Operations
Insurance Tech Services
 
Download Adobe Illustrator Crack free for Windows 2025?
Download Adobe Illustrator Crack free for Windows 2025?
grete1122g
 
Complete WordPress Programming Guidance Book
Complete WordPress Programming Guidance Book
Shabista Imam
 
Automated Testing and Safety Analysis of Deep Neural Networks
Automated Testing and Safety Analysis of Deep Neural Networks
Lionel Briand
 
HYBRIDIZATION OF ALKANES AND ALKENES ...
HYBRIDIZATION OF ALKANES AND ALKENES ...
karishmaduhijod1
 
Advance Doctor Appointment Booking App With Online Payment
Advance Doctor Appointment Booking App With Online Payment
AxisTechnolabs
 
Streamlining CI/CD with FME Flow: A Practical Guide
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
 
Microsoft-365-Administrator-s-Guide1.pdf
Microsoft-365-Administrator-s-Guide1.pdf
mazharatknl
 
Simplify Insurance Regulations with Compliance Management Software
Simplify Insurance Regulations with Compliance Management Software
Insurance Tech Services
 
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
2nd Sight Lab
 
IObit Driver Booster Pro 12 Crack Latest Version Download
IObit Driver Booster Pro 12 Crack Latest Version Download
pcprocore
 
Y - Recursion The Hard Way GopherCon EU 2025
Y - Recursion The Hard Way GopherCon EU 2025
Eleanor McHugh
 
Why Edge Computing Matters in Mobile Application Tech.pdf
Why Edge Computing Matters in Mobile Application Tech.pdf
IMG Global Infotech
 
Canva Pro Crack Free Download 2025-FREE LATEST
Canva Pro Crack Free Download 2025-FREE LATEST
grete1122g
 
Best Practice for LLM Serving in the Cloud
Best Practice for LLM Serving in the Cloud
Alluxio, Inc.
 
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
BradBedford3
 
Decipher SEO Solutions for your startup needs.
Decipher SEO Solutions for your startup needs.
mathai2
 
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
IFI Techsolutions
 
arctitecture application system design os dsa
arctitecture application system design os dsa
za241967
 
A Guide to Telemedicine Software Development.pdf
A Guide to Telemedicine Software Development.pdf
Olivero Bozzelli
 

Oracle Forms: Data Blocks on Different Sources

  • 1. Data Blocks on Different Data Sources
  • 2. Objectives • Base a data block on FROM clause sub query • Base a data block on a stored procedure • Return a REF cursor from a stored procedure • Return a table of records from a stored procedure • Select the appropriate data source for a data block
  • 3. Data source Types A/C No: Branch: Balance: A/C No: Branch: Balance: TableTable Transactional trigger Transactional trigger FROM clause query Stored procedure Query DML Stored procedure
  • 4. Basing Data Block on a From Clause Query SELECT deptno, Total_salary FROM (SELECT deptno, sum(sal) Total_salary FROM emp GROUP BY deptno) WHERE total_salary>=8000
  • 5. Why Form Clause Query? Perform joins, lookups, and calculations on the server (thus avoiding multiple network trips) without having to define a view every time. • Improves developer productivity • Reduces the burden on the DBA • Improves performance
  • 6. Basing a Data block on Stored Procedure for Query Operation Return data by way of: • REF cursor • A Table of records Procedure MARTIN Empno Ename Job 7369 SMITH CLERK 7499 ALLEN SALESMAN 7521 WARD SALESMAN 7566 JONES ANAGER 7654 SALESMAN 7698 BLAKE MANAGER 7782 CLARK MANAGER Querying Emp No Name Job Data Block
  • 7. Basing a Data block on Stored Procedure for DML Operations • Return data by way of a table of records Procedure MARTIN Empno Ename Job 7369 SMITH CLERK 7499 ALLEN SALESMAN 7521 WARD SALESMAN 7566 JONES ANAGER 7654 SALESMAN 7698 BLAKE MANAGER 7782 CLARK MANAGER Updating Emp No Name Job Data Block
  • 8. REF Cursor Procedure for Query Define a package specification with: • The objects returned by the REF cursor • The REF cursor • The query procedure: Data returned through the first argument (IN OUT) Define a package body: Write the code for the query procedure
  • 9. Table of Records Procedure for Query Define a package specification with: • The structure of each row of the table • The table of records • The query procedure: Data returned through the first argument (IN OUT) Define a package body: Write the code for the query procedure
  • 10. Table of Records Procedure for DML Define a package specification with: • The structure of each row of the table • The table of records • A procedure to insert rows • A procedure to update rows • A procedure to delete rows • A procedure to lock rows Define a package body by writing the code for each DML procedure
  • 11. Returning a Ref Cursor Query Fetched rows REF cursor REF cursor Procedure SQL SELECT 21 3 4 Emp No Name Job
  • 12. Returning Table of Records Query Table of Records Cursor Cursor Procedure Any PL/SQL Code 21 3 4 Emp No Name Job
  • 13. Data Block Wizard Use the Data Block Wizard to specify the following: • Data source type • Query procedure • Insert procedure • Update procedure • Delete procedure • Lock procedure
  • 14. Data Source Guidelines Base a data block on a FROM clause query to: • Create a “dynamic” view Base a data block on a stored procedure to: • Increase control and security • Specify a SELECT statement at run time • Query or update multiple tables • Perform complex computations • Perform validation and DML on the server side
  • 15. Data Source Guidelines Query YES YES YES YES YES YES Data Source Table View FROM Clause Proc-Ref Cur Proc-Table Rec Transac. Trigger DML YES YES NO NO YES YES
  • 16. Summary • Base data blocks on new data sources: – FROM clause query (query only) – Stored procedure (query and DML) • Exploit features of stored procedures : – REF cursors limited to a single SELECT statement – Table of records can be a complex procedure

Editor's Notes

  • #12: Queries with Stored Procedure Returning a REF Cursor Executing queries using a stored procedure that returns a REF cursor takes One round trip to execute the stored procedure(1,2), plus one round trip (3,4) per array size of rows returned. Performance Implications The no of records fetched depends on the Array Fetch property value
  • #13: Queries or DML with Stored Procedure Using PL/SQL Tables of Records Executing queries or DML with stored procedures using PL/SQL tables of Records takes one round trip to execute the stored procedure (1,2) plus one Round trip (3,4) for all rows. Performance Implications All records are fetched.