SlideShare a Scribd company logo
1 of 5
Oracle – PL/SQL
                                          Code for Sample Projects
I.   Use of multiple cursors and parameters to create reports.
           DECLARE
            CURSOR c_region IS SELECT * FROM wf_world_regions WHERE region_name LIKE '%America%' ORDER BY region_name;
            CURSOR c_country (p_regionId NUMBER) IS
              SELECT * FROM wf_countries WHERE region_id = p_regionId ORDER BY country_name;
            CURSOR c_language (p_countryID NUMBER) IS Select l.language_id, language_name, country_id
                         FROM wf_spoken_languagessl, wf_languages l
                         WHERE sl.language_id = l.language_id
                         AND country_id = p_countryID ORDER BY language_name;
           BEGIN
                 FOR v_regionRec IN c_region
                 LOOP
                  DBMS_OUTPUT.PUT_LINE(v_regionRec.region_id ||' '|| v_regionRec.region_name);
                  DBMS_OUTPUT.PUT_LINE('----------');
                  FOR v_countryRec IN c_country (v_regionRec.region_id)
                    LOOP
                      DBMS_OUTPUT.PUT_LINE(v_countryRec.country_name||' '||v_countryRec.area||' '|| v_countryRec.population);
                        FOR v_languageRec IN c_language (v_countryRec.country_id)
                         LOOP
                           DBMS_OUTPUT.PUT_LINE('-----'||v_languageRec.language_name);
                         END LOOP;
                    END LOOP;
                  DBMS_OUTPUT.PUT_LINE(' ');
                 END LOOP;
           END;
II.   Handling User Defined Exceptions.
           DECLARE
           v_dept_idexcep_emps.department_id%TYPE;
           v_count NUMBER;
           BEGIN
           v_dept_id := 40;
           SELECT COUNT(*) INTO v_count
           FROM excep_emps
           WHERE department_id = v_dept_id;
           IF v_count = 0 THEN
           RAISE_APPLICATION_ERROR(-20203,'There are no employees in this department');
           END IF;
           DBMS_OUTPUT.PUT_LINE('There are ' || v_count || ' employees');
           DELETE FROM excep_emps
           WHERE department_id = v_dept_id;
           IF SQL%ROWCOUNT = 0 THEN
           RAISE_APPLICATION_ERROR(-20204, 'No employees were deleted');
           END IF;
           DBMS_OUTPUT.PUT_LINE(SQL%ROWCOUNT ||
           ' employees were deleted');
           ROLLBACK;
           END;
III.   Creating Functions.
IV.   Creating Packages with Overloaded Procedures.
V.   Creating Triggers to maintain data integrity where check constraints would be ineffective.

More Related Content

What's hot

2 ways to get total sum of interactive grid column oracle apex ontoor blogs
2 ways to get total sum of interactive grid column oracle apex   ontoor blogs2 ways to get total sum of interactive grid column oracle apex   ontoor blogs
2 ways to get total sum of interactive grid column oracle apex ontoor blogssulimankareem
 
Sql queries questions and answers
Sql queries questions and answersSql queries questions and answers
Sql queries questions and answersMichael Belete
 
Group By, Order By, and Aliases in SQL
Group By, Order By, and Aliases in SQLGroup By, Order By, and Aliases in SQL
Group By, Order By, and Aliases in SQLMSB Academy
 
Procedure and Functions in pl/sql
Procedure and Functions in pl/sqlProcedure and Functions in pl/sql
Procedure and Functions in pl/sqlÑirmal Tatiwal
 
Abstraction in java
Abstraction in javaAbstraction in java
Abstraction in javasawarkar17
 
11 Understanding and Influencing the PL/SQL Compilar
11 Understanding and Influencing the PL/SQL Compilar11 Understanding and Influencing the PL/SQL Compilar
11 Understanding and Influencing the PL/SQL Compilarrehaniltifat
 
05 Creating Stored Procedures
05 Creating Stored Procedures05 Creating Stored Procedures
05 Creating Stored Proceduresrehaniltifat
 
Job Control Language
Job Control LanguageJob Control Language
Job Control Languagekapa rohit
 
02 Writing Executable Statments
02 Writing Executable Statments02 Writing Executable Statments
02 Writing Executable Statmentsrehaniltifat
 

What's hot (20)

Sql operators & functions 3
Sql operators & functions 3Sql operators & functions 3
Sql operators & functions 3
 
Oracle: PLSQL Introduction
Oracle: PLSQL IntroductionOracle: PLSQL Introduction
Oracle: PLSQL Introduction
 
2 ways to get total sum of interactive grid column oracle apex ontoor blogs
2 ways to get total sum of interactive grid column oracle apex   ontoor blogs2 ways to get total sum of interactive grid column oracle apex   ontoor blogs
2 ways to get total sum of interactive grid column oracle apex ontoor blogs
 
Sql queries questions and answers
Sql queries questions and answersSql queries questions and answers
Sql queries questions and answers
 
Group By, Order By, and Aliases in SQL
Group By, Order By, and Aliases in SQLGroup By, Order By, and Aliases in SQL
Group By, Order By, and Aliases in SQL
 
Sql oracle
Sql oracleSql oracle
Sql oracle
 
Procedure and Functions in pl/sql
Procedure and Functions in pl/sqlProcedure and Functions in pl/sql
Procedure and Functions in pl/sql
 
Abstraction in java
Abstraction in javaAbstraction in java
Abstraction in java
 
11 Understanding and Influencing the PL/SQL Compilar
11 Understanding and Influencing the PL/SQL Compilar11 Understanding and Influencing the PL/SQL Compilar
11 Understanding and Influencing the PL/SQL Compilar
 
05 Creating Stored Procedures
05 Creating Stored Procedures05 Creating Stored Procedures
05 Creating Stored Procedures
 
All questions
All questionsAll questions
All questions
 
SQL Functions
SQL FunctionsSQL Functions
SQL Functions
 
SQL BASIC QUERIES SOLUTION ~hmftj
SQL BASIC QUERIES SOLUTION ~hmftjSQL BASIC QUERIES SOLUTION ~hmftj
SQL BASIC QUERIES SOLUTION ~hmftj
 
Job Control Language
Job Control LanguageJob Control Language
Job Control Language
 
Best sql plsql material
Best sql plsql materialBest sql plsql material
Best sql plsql material
 
SQL JOINS
SQL JOINSSQL JOINS
SQL JOINS
 
Oraclesql
OraclesqlOraclesql
Oraclesql
 
02 Writing Executable Statments
02 Writing Executable Statments02 Writing Executable Statments
02 Writing Executable Statments
 
PL/SQL
PL/SQLPL/SQL
PL/SQL
 
Introduction to-sql
Introduction to-sqlIntroduction to-sql
Introduction to-sql
 

Similar to PL/SQL Code for Sample Projects

Beginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeksBeginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeksJinTaek Seo
 
PostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and GotchasPostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and GotchasJim Mlodgenski
 
Oracle - Program with PL/SQL - Lession 07
Oracle - Program with PL/SQL - Lession 07Oracle - Program with PL/SQL - Lession 07
Oracle - Program with PL/SQL - Lession 07Thuan Nguyen
 
PLSQLmy Updated (1).pptx
PLSQLmy Updated (1).pptxPLSQLmy Updated (1).pptx
PLSQLmy Updated (1).pptxvamsiyadav39
 
Strategy and best practice for modern RPG
Strategy and best practice for modern RPGStrategy and best practice for modern RPG
Strategy and best practice for modern RPGAlemanalfredo
 
Oracle - Program with PL/SQL - Lession 03
Oracle - Program with PL/SQL - Lession 03Oracle - Program with PL/SQL - Lession 03
Oracle - Program with PL/SQL - Lession 03Thuan Nguyen
 
Design and develop secured oracle applications
Design and develop secured oracle applicationsDesign and develop secured oracle applications
Design and develop secured oracle applicationsdyahalom
 
Updates from Cassandra Summit 2016 & SASI Indexes
Updates from Cassandra Summit 2016 & SASI IndexesUpdates from Cassandra Summit 2016 & SASI Indexes
Updates from Cassandra Summit 2016 & SASI IndexesJim Hatcher
 
Fpga 06-data-types-system-tasks-compiler-directives
Fpga 06-data-types-system-tasks-compiler-directivesFpga 06-data-types-system-tasks-compiler-directives
Fpga 06-data-types-system-tasks-compiler-directivesMalik Tauqir Hasan
 
Apache Drill with Oracle, Hive and HBase
Apache Drill with Oracle, Hive and HBaseApache Drill with Oracle, Hive and HBase
Apache Drill with Oracle, Hive and HBaseNag Arvind Gudiseva
 
CDM SynPuf OMOP CDM library(rodbc) library(ggplot2) library(jsonlite) 180403
CDM SynPuf OMOP CDM library(rodbc) library(ggplot2) library(jsonlite) 180403CDM SynPuf OMOP CDM library(rodbc) library(ggplot2) library(jsonlite) 180403
CDM SynPuf OMOP CDM library(rodbc) library(ggplot2) library(jsonlite) 180403Min-hyung Kim
 
2013 Collaborate - OAUG - Presentation
2013 Collaborate - OAUG - Presentation2013 Collaborate - OAUG - Presentation
2013 Collaborate - OAUG - PresentationBiju Thomas
 
Love Your Database Railsconf 2017
Love Your Database Railsconf 2017Love Your Database Railsconf 2017
Love Your Database Railsconf 2017gisborne
 

Similar to PL/SQL Code for Sample Projects (20)

SQL- Introduction to PL/SQL
SQL- Introduction to  PL/SQLSQL- Introduction to  PL/SQL
SQL- Introduction to PL/SQL
 
Plsql
PlsqlPlsql
Plsql
 
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeksBeginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeks
 
PostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and GotchasPostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and Gotchas
 
sas aeroplan sample
sas aeroplan samplesas aeroplan sample
sas aeroplan sample
 
Oracle - Program with PL/SQL - Lession 07
Oracle - Program with PL/SQL - Lession 07Oracle - Program with PL/SQL - Lession 07
Oracle - Program with PL/SQL - Lession 07
 
4. plsql 1
4. plsql 14. plsql 1
4. plsql 1
 
Sql pl
Sql plSql pl
Sql pl
 
SQL-PL
SQL-PLSQL-PL
SQL-PL
 
PLSQLmy Updated (1).pptx
PLSQLmy Updated (1).pptxPLSQLmy Updated (1).pptx
PLSQLmy Updated (1).pptx
 
Strategy and best practice for modern RPG
Strategy and best practice for modern RPGStrategy and best practice for modern RPG
Strategy and best practice for modern RPG
 
Oracle - Program with PL/SQL - Lession 03
Oracle - Program with PL/SQL - Lession 03Oracle - Program with PL/SQL - Lession 03
Oracle - Program with PL/SQL - Lession 03
 
Design and develop secured oracle applications
Design and develop secured oracle applicationsDesign and develop secured oracle applications
Design and develop secured oracle applications
 
Updates from Cassandra Summit 2016 & SASI Indexes
Updates from Cassandra Summit 2016 & SASI IndexesUpdates from Cassandra Summit 2016 & SASI Indexes
Updates from Cassandra Summit 2016 & SASI Indexes
 
Fpga 06-data-types-system-tasks-compiler-directives
Fpga 06-data-types-system-tasks-compiler-directivesFpga 06-data-types-system-tasks-compiler-directives
Fpga 06-data-types-system-tasks-compiler-directives
 
Cursors
CursorsCursors
Cursors
 
Apache Drill with Oracle, Hive and HBase
Apache Drill with Oracle, Hive and HBaseApache Drill with Oracle, Hive and HBase
Apache Drill with Oracle, Hive and HBase
 
CDM SynPuf OMOP CDM library(rodbc) library(ggplot2) library(jsonlite) 180403
CDM SynPuf OMOP CDM library(rodbc) library(ggplot2) library(jsonlite) 180403CDM SynPuf OMOP CDM library(rodbc) library(ggplot2) library(jsonlite) 180403
CDM SynPuf OMOP CDM library(rodbc) library(ggplot2) library(jsonlite) 180403
 
2013 Collaborate - OAUG - Presentation
2013 Collaborate - OAUG - Presentation2013 Collaborate - OAUG - Presentation
2013 Collaborate - OAUG - Presentation
 
Love Your Database Railsconf 2017
Love Your Database Railsconf 2017Love Your Database Railsconf 2017
Love Your Database Railsconf 2017
 

More from jwjablonski

Amazing Books Database Objects, Reports and Forms
Amazing Books Database Objects, Reports and FormsAmazing Books Database Objects, Reports and Forms
Amazing Books Database Objects, Reports and Formsjwjablonski
 
Study Skills Project
Study Skills ProjectStudy Skills Project
Study Skills Projectjwjablonski
 
Java Code For Sample Projects I/O
Java Code For Sample Projects I/OJava Code For Sample Projects I/O
Java Code For Sample Projects I/Ojwjablonski
 
Java Code for Sample Projects Loops
Java Code for Sample Projects LoopsJava Code for Sample Projects Loops
Java Code for Sample Projects Loopsjwjablonski
 
Java Code for Sample Projects Methods
Java Code for Sample Projects MethodsJava Code for Sample Projects Methods
Java Code for Sample Projects Methodsjwjablonski
 
Java Code for Sample Projects Inheritance
Java Code for Sample Projects InheritanceJava Code for Sample Projects Inheritance
Java Code for Sample Projects Inheritancejwjablonski
 
VBA Final Project
VBA Final ProjectVBA Final Project
VBA Final Projectjwjablonski
 
Animal Shelter Database Presentation
Animal Shelter Database PresentationAnimal Shelter Database Presentation
Animal Shelter Database Presentationjwjablonski
 

More from jwjablonski (11)

Portfolio
PortfolioPortfolio
Portfolio
 
Amazing Books Database Objects, Reports and Forms
Amazing Books Database Objects, Reports and FormsAmazing Books Database Objects, Reports and Forms
Amazing Books Database Objects, Reports and Forms
 
Study Skills Project
Study Skills ProjectStudy Skills Project
Study Skills Project
 
Java Code For Sample Projects I/O
Java Code For Sample Projects I/OJava Code For Sample Projects I/O
Java Code For Sample Projects I/O
 
Java Code for Sample Projects Loops
Java Code for Sample Projects LoopsJava Code for Sample Projects Loops
Java Code for Sample Projects Loops
 
Java Code for Sample Projects Methods
Java Code for Sample Projects MethodsJava Code for Sample Projects Methods
Java Code for Sample Projects Methods
 
Java Code for Sample Projects Inheritance
Java Code for Sample Projects InheritanceJava Code for Sample Projects Inheritance
Java Code for Sample Projects Inheritance
 
VBA Final Project
VBA Final ProjectVBA Final Project
VBA Final Project
 
Animal Shelter Database Presentation
Animal Shelter Database PresentationAnimal Shelter Database Presentation
Animal Shelter Database Presentation
 
Hangman Program
Hangman ProgramHangman Program
Hangman Program
 
Cents Add Up
Cents Add Up Cents Add Up
Cents Add Up
 

Recently uploaded

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 

Recently uploaded (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

PL/SQL Code for Sample Projects

  • 1. Oracle – PL/SQL Code for Sample Projects I. Use of multiple cursors and parameters to create reports. DECLARE CURSOR c_region IS SELECT * FROM wf_world_regions WHERE region_name LIKE '%America%' ORDER BY region_name; CURSOR c_country (p_regionId NUMBER) IS SELECT * FROM wf_countries WHERE region_id = p_regionId ORDER BY country_name; CURSOR c_language (p_countryID NUMBER) IS Select l.language_id, language_name, country_id FROM wf_spoken_languagessl, wf_languages l WHERE sl.language_id = l.language_id AND country_id = p_countryID ORDER BY language_name; BEGIN FOR v_regionRec IN c_region LOOP DBMS_OUTPUT.PUT_LINE(v_regionRec.region_id ||' '|| v_regionRec.region_name); DBMS_OUTPUT.PUT_LINE('----------'); FOR v_countryRec IN c_country (v_regionRec.region_id) LOOP DBMS_OUTPUT.PUT_LINE(v_countryRec.country_name||' '||v_countryRec.area||' '|| v_countryRec.population); FOR v_languageRec IN c_language (v_countryRec.country_id) LOOP DBMS_OUTPUT.PUT_LINE('-----'||v_languageRec.language_name); END LOOP; END LOOP; DBMS_OUTPUT.PUT_LINE(' '); END LOOP; END;
  • 2. II. Handling User Defined Exceptions. DECLARE v_dept_idexcep_emps.department_id%TYPE; v_count NUMBER; BEGIN v_dept_id := 40; SELECT COUNT(*) INTO v_count FROM excep_emps WHERE department_id = v_dept_id; IF v_count = 0 THEN RAISE_APPLICATION_ERROR(-20203,'There are no employees in this department'); END IF; DBMS_OUTPUT.PUT_LINE('There are ' || v_count || ' employees'); DELETE FROM excep_emps WHERE department_id = v_dept_id; IF SQL%ROWCOUNT = 0 THEN RAISE_APPLICATION_ERROR(-20204, 'No employees were deleted'); END IF; DBMS_OUTPUT.PUT_LINE(SQL%ROWCOUNT || ' employees were deleted'); ROLLBACK; END;
  • 3. III. Creating Functions.
  • 4. IV. Creating Packages with Overloaded Procedures.
  • 5. V. Creating Triggers to maintain data integrity where check constraints would be ineffective.