This document discusses explicit cursors in PL/SQL. It defines implicit and explicit cursors, with implicit cursors being used for all DML statements and single-row queries, while explicit cursors are used for queries that return zero, one, or more rows. The document outlines how to declare, open, fetch from, and close an explicit cursor. It also covers using cursors with parameters, locking rows with FOR UPDATE, and updating the current row with WHERE CURRENT OF.
The document discusses various concepts related to using packages in PL/SQL, including overloading subprograms, forward declarations, package initialization blocks, persistent state of package variables, using PL/SQL tables of records in packages, wrapping PL/SQL code into a standalone utility, and utilizing Oracle-supplied packages like DBMS_OUTPUT and UTL_FILE for debugging and file processing.
07 Using Oracle-Supported Package in Application Developmentrehaniltifat
This document discusses using Oracle-supplied packages for application development. It describes the UTL_MAIL package for managing email, including procedures for sending messages with and without attachments. It also covers the DBMS_SCHEDULER package for automating jobs, including how to create, run, stop, and drop jobs. Finally, it discusses dynamic SQL and executing SQL statements programmatically using native dynamic SQL statements or the DBMS_SQL package.
This document discusses stored procedures and functions in Oracle databases. It covers:
- What procedures and functions are and how they can be created using PL/SQL syntax.
- Parameters for procedures and functions, including IN, OUT, and IN OUT parameter modes.
- Developing procedures and functions, including compiling, storing, and executing them.
- Benefits of using procedures and functions such as improved maintainability and performance.
Cursores en Oracle PL/SQL, en esta presentación se encuentra información sobre que son, cuando se debe usar, su creación, invocación y también su eliminación.
This document provides an overview of executable statements in PL/SQL blocks. It discusses lexical units like identifiers, delimiters, and literals. It describes PL/SQL block syntax and guidelines for writing executable code. It also covers commenting code, using SQL functions, data type conversion, and nested blocks. The document provides examples and best practices for writing readable and maintainable PL/SQL code.
Advanced PLSQL Optimizing for Better PerformanceZohar Elkayam
A Presentation from Oracle Week 2015 in Israel
Agenda:
• Developing PL/SQL:
o Composite Data Types: Records, Collections and Table type
o Advanced Cursors: Ref cursor, Cursor function, Cursor subquery in PL/SQL
o Bulk Binding
o Dynamic SQL – SQL Injection
o Tracing PL/SQL Execution
o Design patterns for PL/SQL: Autonomous Transactions, Invoker and Definer rights, serially_reusable code
o Triggers Improvements
• Compiling PL/SQL:
o PL/SQL Fine-Grain Dependency Management
o PLSQL_OPTIMIZE_LEVEL parameter
o PL/SQL Compile-Time Warnings and Using DBMS_WARNING package
• Tuning PL/SQL:
o Handling Packages in Memory
o Global Temporary Tables
o PL/SQL Function Result Cache and pitfalls
• Oracle Database 12c PL/SQL new features: What is new in Oracle 12c
o Language Usability Enhancements
o New Limitations
• Additional useful features, Tips and Tricks for better performance
03 Writing Control Structures, Writing with Compatible Data Types Using Expli...rehaniltifat
This document discusses composite data types in PL/SQL including records, collections like index by tables and nested tables, and using explicit cursors. It provides examples of declaring different composite data types like records and index by tables, using %ROWTYPE attribute, and controlling explicit cursors through open, fetch, close operations and cursor attributes. It also discusses using cursors with parameters and FOR UPDATE/WHERE CURRENT OF clauses for locking and updating rows.
This document discusses cursors in PL/SQL. It begins by defining cursors and their types, including implicit and explicit cursors. It then covers processing explicit cursors using declare, open, fetch, and close statements. The document also discusses cursor attributes, parameterized cursors, advanced cursor features like SELECT FOR UPDATE, and cursor variables including declaring REF cursor types and variables. The overall purpose is to explain how to work with different types of cursors in PL/SQL to retrieve and manipulate result sets.
The document discusses various concepts related to using packages in PL/SQL, including overloading subprograms, forward declarations, package initialization blocks, persistent state of package variables, using PL/SQL tables of records in packages, wrapping PL/SQL code into a standalone utility, and utilizing Oracle-supplied packages like DBMS_OUTPUT and UTL_FILE for debugging and file processing.
07 Using Oracle-Supported Package in Application Developmentrehaniltifat
This document discusses using Oracle-supplied packages for application development. It describes the UTL_MAIL package for managing email, including procedures for sending messages with and without attachments. It also covers the DBMS_SCHEDULER package for automating jobs, including how to create, run, stop, and drop jobs. Finally, it discusses dynamic SQL and executing SQL statements programmatically using native dynamic SQL statements or the DBMS_SQL package.
This document discusses stored procedures and functions in Oracle databases. It covers:
- What procedures and functions are and how they can be created using PL/SQL syntax.
- Parameters for procedures and functions, including IN, OUT, and IN OUT parameter modes.
- Developing procedures and functions, including compiling, storing, and executing them.
- Benefits of using procedures and functions such as improved maintainability and performance.
Cursores en Oracle PL/SQL, en esta presentación se encuentra información sobre que son, cuando se debe usar, su creación, invocación y también su eliminación.
This document provides an overview of executable statements in PL/SQL blocks. It discusses lexical units like identifiers, delimiters, and literals. It describes PL/SQL block syntax and guidelines for writing executable code. It also covers commenting code, using SQL functions, data type conversion, and nested blocks. The document provides examples and best practices for writing readable and maintainable PL/SQL code.
Advanced PLSQL Optimizing for Better PerformanceZohar Elkayam
A Presentation from Oracle Week 2015 in Israel
Agenda:
• Developing PL/SQL:
o Composite Data Types: Records, Collections and Table type
o Advanced Cursors: Ref cursor, Cursor function, Cursor subquery in PL/SQL
o Bulk Binding
o Dynamic SQL – SQL Injection
o Tracing PL/SQL Execution
o Design patterns for PL/SQL: Autonomous Transactions, Invoker and Definer rights, serially_reusable code
o Triggers Improvements
• Compiling PL/SQL:
o PL/SQL Fine-Grain Dependency Management
o PLSQL_OPTIMIZE_LEVEL parameter
o PL/SQL Compile-Time Warnings and Using DBMS_WARNING package
• Tuning PL/SQL:
o Handling Packages in Memory
o Global Temporary Tables
o PL/SQL Function Result Cache and pitfalls
• Oracle Database 12c PL/SQL new features: What is new in Oracle 12c
o Language Usability Enhancements
o New Limitations
• Additional useful features, Tips and Tricks for better performance
03 Writing Control Structures, Writing with Compatible Data Types Using Expli...rehaniltifat
This document discusses composite data types in PL/SQL including records, collections like index by tables and nested tables, and using explicit cursors. It provides examples of declaring different composite data types like records and index by tables, using %ROWTYPE attribute, and controlling explicit cursors through open, fetch, close operations and cursor attributes. It also discusses using cursors with parameters and FOR UPDATE/WHERE CURRENT OF clauses for locking and updating rows.
This document discusses cursors in PL/SQL. It begins by defining cursors and their types, including implicit and explicit cursors. It then covers processing explicit cursors using declare, open, fetch, and close statements. The document also discusses cursor attributes, parameterized cursors, advanced cursor features like SELECT FOR UPDATE, and cursor variables including declaring REF cursor types and variables. The overall purpose is to explain how to work with different types of cursors in PL/SQL to retrieve and manipulate result sets.
Triggers are stored PL/SQL blocks that are associated with a table, view, schema or database and execute automatically when a triggering event occurs. There are two types of triggers: application triggers that fire on application events and database triggers that fire on data or system events. Triggers can be used to centralize global operations, perform related actions, enforce complex integrity constraints and compute derived values automatically. The timing of a trigger determines whether it executes before or after the triggering event.
The document discusses the DBMS_METADATA package in Oracle, which provides a centralized way to extract, manipulate, and resubmit metadata. It allows fetching an object's metadata as XML, transforming the XML, and resubmitting it to recreate the object. The package includes subprograms for opening a metadata extraction, setting filters, fetching metadata in various formats, and closing the extraction. It also discusses browsing APIs and examples of using filters and transforms.
PL/SQL is Oracle's standard language for accessing and manipulating data in Oracle databases. It allows developers to integrate SQL statements with procedural constructs like variables, conditions, and loops. PL/SQL code is organized into blocks that define a declarative section for variable declarations and an executable section containing SQL and PL/SQL statements. Variables can be scalar, composite, reference, or LOB types and are declared in the declarative section before being used in the executable section.
pl/sql online Training|sql online Training | iTeknowledgeMasood Khan
This Course is designed by iTeknowledge.com experts to provide concrete and indepth knowledge of sql and pl/sql.100%practical and instructor led live training.
This document provides an introduction to Oracle Forms Builder, a tool used to develop data entry and query screens. It discusses Forms Builder in client/server mode using a 2-tier architecture and in web mode using a 3-tier architecture. The document outlines some key features of Forms Builder including rapid application development, reusable objects, and improved developer productivity. It also provides instructions on setting user preferences and starting Forms Builder.
After completing this lesson, you should be able to
do the following:
Describe the types of problem that subqueries can solve
Define subqueries
List the types of subqueries
Write single-row and multiple-row subqueries
http://phpexecutor.com
This document discusses handling exceptions in PL/SQL. It explains that exceptions can be raised implicitly by the Oracle server or explicitly in a program. Exceptions can be handled by trapping them with an exception handler or propagating them to the calling environment. It provides details and examples of trapping predefined Oracle exceptions, user-defined exceptions, and non-predefined Oracle exceptions. It also discusses exception handling in calling environments like procedures.
Single-Row Functions in orcale Data baseSalman Memon
This document provides an overview of single-row functions in SQL. It describes how single-row functions manipulate data on each row returned and can modify data types. The document outlines different categories of single-row functions including character, number, date, and general functions. It provides examples of how to use various single-row functions in SELECT statements.
Restricting and Sorting Data - Oracle Data BaseSalman Memon
This document discusses how to restrict and sort data retrieved by SQL queries. It describes how to limit rows using the WHERE clause with various comparison operators like equal to, greater than, between, in, like, and is null. Logical operators like AND, OR and NOT can be used with WHERE. Rows can be sorted using the ORDER BY clause, specifying columns and expressions to sort on in ascending or descending order. Multiple columns can be used in the ORDER BY to further refine the sorting.
Oracle SQL tuning involves optimizing SQL statements for better performance. Key aspects of SQL tuning include identifying SQL statements with high resource consumption or response times using tools like ADDM, AWR, and V$SQL. Statements can then be tuned by gathering accurate optimizer statistics, adjusting the execution plan using hints, rewriting the SQL, or changing indexes and tables. Tuning is done at both the design and execution stages.
This document discusses execution plans in Oracle Database. It begins by explaining what an execution plan is and how it shows the steps needed to execute a SQL statement. It then covers how to generate an execution plan using EXPLAIN PLAN or querying V$SQL_PLAN. The document discusses what the optimizer considers a "good" plan in terms of cost and performance. It also explores key elements of an execution plan like cardinality, access paths, join methods, and join order.
Displaying Data from Multiple Tables - Oracle Data BaseSalman Memon
This document discusses different types of joins in SQL for combining data from multiple tables, including:
- Inner joins, which return rows that match the join condition between two tables.
- Outer joins, which return all rows from one table and matched rows from the other table.
- Self joins, which join a table to itself to link records together such as employees and their managers.
The document provides examples of joins using both Oracle's proprietary syntax and the SQL:1999 standard syntax.
Aggregating Data Using Group FunctionsSalman Memon
After completing this lesson, you should be able to
do the following:
Identify the available group functions
Describe the use of group functions
Group data using the GROUP BY clause
Include or exclude grouped rows by using the HAVING clause
http://phpexecutor.com
PL/SQL is a combination of SQL along with the procedural features of programming languages.
It provides specific syntax for this purpose and supports exactly the same datatypes as SQL.
11 Understanding and Influencing the PL/SQL Compilarrehaniltifat
This document discusses normalization of a sales tax invoice database. It begins by showing an initial sales tax invoice table that is not normalized. It then shows the tables after normalization into first normal form (1NF), second normal form (2NF), and third normal form (3NF). The normalized tables separate the data into tables for the invoice, buyer, product, tax, and price details.
Collections are PL/SQL's approach to arrays. We have three types of collections (associative arrays, nested tables, varrays) and this presentation explores both the common features of these datatypes, and their differing characteristics. Copyright 2016 Oracle Corporation.
Oracle - Program with PL/SQL - Lession 09Thuan Nguyen
This document discusses procedures in PL/SQL, including:
1. How to create procedures using the CREATE PROCEDURE statement and define parameters.
2. The different parameter modes: IN, OUT, and IN OUT.
3. How to handle exceptions within procedures.
4. How to invoke procedures from other procedures, scripts, or applications.
5. Best practices for developing reusable procedures.
Producing Readable Output with iSQL*Plus - Oracle Data BaseSalman Memon
After completing this lesson, you should be able to
do the following:
Produce queries that require a substitution variable
Customize the iSQL*Plus environment
Produce more readable output
Create and execute script files
http://phpexecutor.com
This document discusses explicit cursors in PL/SQL. It begins by listing the objectives of the lesson, which include distinguishing between implicit and explicit cursors, describing when to use explicit cursors, listing guidelines for declaring and controlling explicit cursors, and demonstrating how to open a cursor, fetch data into variables, loop through multiple rows, and close a cursor. It then explains the purpose of explicit cursors when a SELECT statement may return multiple rows. It discusses context areas and cursors, the limitations of implicit cursors, and shows examples of declaring, opening, fetching from, and closing an explicit cursor.
After completing this lesson, you should be able to do the following:
Distinguish between an implicit and an explicit cursor
Use a PL/SQL record variable
Write a cursor FOR loop
Triggers are stored PL/SQL blocks that are associated with a table, view, schema or database and execute automatically when a triggering event occurs. There are two types of triggers: application triggers that fire on application events and database triggers that fire on data or system events. Triggers can be used to centralize global operations, perform related actions, enforce complex integrity constraints and compute derived values automatically. The timing of a trigger determines whether it executes before or after the triggering event.
The document discusses the DBMS_METADATA package in Oracle, which provides a centralized way to extract, manipulate, and resubmit metadata. It allows fetching an object's metadata as XML, transforming the XML, and resubmitting it to recreate the object. The package includes subprograms for opening a metadata extraction, setting filters, fetching metadata in various formats, and closing the extraction. It also discusses browsing APIs and examples of using filters and transforms.
PL/SQL is Oracle's standard language for accessing and manipulating data in Oracle databases. It allows developers to integrate SQL statements with procedural constructs like variables, conditions, and loops. PL/SQL code is organized into blocks that define a declarative section for variable declarations and an executable section containing SQL and PL/SQL statements. Variables can be scalar, composite, reference, or LOB types and are declared in the declarative section before being used in the executable section.
pl/sql online Training|sql online Training | iTeknowledgeMasood Khan
This Course is designed by iTeknowledge.com experts to provide concrete and indepth knowledge of sql and pl/sql.100%practical and instructor led live training.
This document provides an introduction to Oracle Forms Builder, a tool used to develop data entry and query screens. It discusses Forms Builder in client/server mode using a 2-tier architecture and in web mode using a 3-tier architecture. The document outlines some key features of Forms Builder including rapid application development, reusable objects, and improved developer productivity. It also provides instructions on setting user preferences and starting Forms Builder.
After completing this lesson, you should be able to
do the following:
Describe the types of problem that subqueries can solve
Define subqueries
List the types of subqueries
Write single-row and multiple-row subqueries
http://phpexecutor.com
This document discusses handling exceptions in PL/SQL. It explains that exceptions can be raised implicitly by the Oracle server or explicitly in a program. Exceptions can be handled by trapping them with an exception handler or propagating them to the calling environment. It provides details and examples of trapping predefined Oracle exceptions, user-defined exceptions, and non-predefined Oracle exceptions. It also discusses exception handling in calling environments like procedures.
Single-Row Functions in orcale Data baseSalman Memon
This document provides an overview of single-row functions in SQL. It describes how single-row functions manipulate data on each row returned and can modify data types. The document outlines different categories of single-row functions including character, number, date, and general functions. It provides examples of how to use various single-row functions in SELECT statements.
Restricting and Sorting Data - Oracle Data BaseSalman Memon
This document discusses how to restrict and sort data retrieved by SQL queries. It describes how to limit rows using the WHERE clause with various comparison operators like equal to, greater than, between, in, like, and is null. Logical operators like AND, OR and NOT can be used with WHERE. Rows can be sorted using the ORDER BY clause, specifying columns and expressions to sort on in ascending or descending order. Multiple columns can be used in the ORDER BY to further refine the sorting.
Oracle SQL tuning involves optimizing SQL statements for better performance. Key aspects of SQL tuning include identifying SQL statements with high resource consumption or response times using tools like ADDM, AWR, and V$SQL. Statements can then be tuned by gathering accurate optimizer statistics, adjusting the execution plan using hints, rewriting the SQL, or changing indexes and tables. Tuning is done at both the design and execution stages.
This document discusses execution plans in Oracle Database. It begins by explaining what an execution plan is and how it shows the steps needed to execute a SQL statement. It then covers how to generate an execution plan using EXPLAIN PLAN or querying V$SQL_PLAN. The document discusses what the optimizer considers a "good" plan in terms of cost and performance. It also explores key elements of an execution plan like cardinality, access paths, join methods, and join order.
Displaying Data from Multiple Tables - Oracle Data BaseSalman Memon
This document discusses different types of joins in SQL for combining data from multiple tables, including:
- Inner joins, which return rows that match the join condition between two tables.
- Outer joins, which return all rows from one table and matched rows from the other table.
- Self joins, which join a table to itself to link records together such as employees and their managers.
The document provides examples of joins using both Oracle's proprietary syntax and the SQL:1999 standard syntax.
Aggregating Data Using Group FunctionsSalman Memon
After completing this lesson, you should be able to
do the following:
Identify the available group functions
Describe the use of group functions
Group data using the GROUP BY clause
Include or exclude grouped rows by using the HAVING clause
http://phpexecutor.com
PL/SQL is a combination of SQL along with the procedural features of programming languages.
It provides specific syntax for this purpose and supports exactly the same datatypes as SQL.
11 Understanding and Influencing the PL/SQL Compilarrehaniltifat
This document discusses normalization of a sales tax invoice database. It begins by showing an initial sales tax invoice table that is not normalized. It then shows the tables after normalization into first normal form (1NF), second normal form (2NF), and third normal form (3NF). The normalized tables separate the data into tables for the invoice, buyer, product, tax, and price details.
Collections are PL/SQL's approach to arrays. We have three types of collections (associative arrays, nested tables, varrays) and this presentation explores both the common features of these datatypes, and their differing characteristics. Copyright 2016 Oracle Corporation.
Oracle - Program with PL/SQL - Lession 09Thuan Nguyen
This document discusses procedures in PL/SQL, including:
1. How to create procedures using the CREATE PROCEDURE statement and define parameters.
2. The different parameter modes: IN, OUT, and IN OUT.
3. How to handle exceptions within procedures.
4. How to invoke procedures from other procedures, scripts, or applications.
5. Best practices for developing reusable procedures.
Producing Readable Output with iSQL*Plus - Oracle Data BaseSalman Memon
After completing this lesson, you should be able to
do the following:
Produce queries that require a substitution variable
Customize the iSQL*Plus environment
Produce more readable output
Create and execute script files
http://phpexecutor.com
This document discusses explicit cursors in PL/SQL. It begins by listing the objectives of the lesson, which include distinguishing between implicit and explicit cursors, describing when to use explicit cursors, listing guidelines for declaring and controlling explicit cursors, and demonstrating how to open a cursor, fetch data into variables, loop through multiple rows, and close a cursor. It then explains the purpose of explicit cursors when a SELECT statement may return multiple rows. It discusses context areas and cursors, the limitations of implicit cursors, and shows examples of declaring, opening, fetching from, and closing an explicit cursor.
After completing this lesson, you should be able to do the following:
Distinguish between an implicit and an explicit cursor
Use a PL/SQL record variable
Write a cursor FOR loop
Oracle - Program with PL/SQL - Lession 06Thuan Nguyen
This document discusses explicit cursors in PL/SQL. It covers:
1) Declaring explicit cursors to query rows from a table and control the cursor through opening, fetching, and closing.
2) Using cursor attributes to check the status and number of rows fetched.
3) Processing cursor rows using a cursor FOR loop or fetching into a record variable.
PL/SQL allows developers to write blocks of code that can be stored and reused in the database. It provides procedural language capabilities like conditional statements and loops. Executing SQL statements as a PL/SQL block allows the database to process multiple statements simultaneously, improving performance by reducing network traffic. PL/SQL also handles errors during program execution.
This document discusses cursors in Oracle PL/SQL. It defines a cursor as a handle or pointer to a context area that allows a program to control how SQL statements are processed. There are two types of cursors - implicit cursors that are automatically created, and explicit cursors that are declared by the programmer. The processing of an explicit cursor involves declaring it, opening it to allocate memory, fetching rows from it one at a time, and closing it to free memory. Cursors can be used to retrieve and process rows from a query.
A cursor is a SELECT statement defined in PL/SQL code that points to an allocated memory area called the context area containing information needed to process rows returned by a query. Cursors are declared, opened to initialize the result set, rows are fetched from the result set into variables, and then the cursor is closed. There are explicit cursors defined and named by the user, and implicit cursors that Oracle handles automatically for DML statements. Cursor attributes provide information like whether a row was found, the number of rows affected, and whether a cursor is open.
The document discusses cursors in Oracle. It defines cursors as pointers that allow PL/SQL programs to control and process SQL statements that return multiple rows. There are two types of cursors: implicit cursors are automatically created for SQL statements while explicit cursors must be declared, opened, fetched from, and closed by the programmer for control over queries returning multiple rows. The key operations for explicit cursors are declaring them to initialize in memory, opening them to determine rows and set a pointer, fetching rows one by one into variables, and closing them to free resources.
PL/SQL extends SQL with procedural language capabilities. It allows variables, control structures like IF/THEN statements, and subprograms. The basic unit is a block that declares variables, contains an executable section, and can handle exceptions. Blocks can be anonymous, named, stored as subprograms or triggers. Cursors allow processing query result sets row by row. Variables and attributes simplify code maintenance. Packages and modularization improve program organization. Error handling uses exceptions to manage runtime errors gracefully.
This document provides an overview and introduction to advanced PL/SQL concepts. It covers fundamentals like data types, control structures, cursors, exceptions and error handling. It also discusses more advanced topics such as Oracle types and collections, interacting with Oracle databases using PL/SQL, creating subprograms and packages, and error handling. The document is presented by Vinay Kumar and intended to teach advanced PL/SQL concepts.
What is PL/SQL
Procedural Language – SQL
An extension to SQL with design features of programming languages (procedural and object oriented)
PL/SQL and Java are both supported as internal host languages within Oracle products.
PL/SQL provides two types of composite datatypes - records and collections. Records allow grouping of related data elements, while collections allow storing multiple values in a single variable. Collections include index-by tables, nested tables, and varrays. Cursors allow processing rows from a SQL query one by one. Explicit cursors must be declared, opened, fetched from, and closed. Implicit cursors are used for DML statements. Functions return a value and can be used in SQL expressions, while procedures perform actions without returning a value. Both can accept parameters.
Cursors allow PL/SQL to store SQL statements and results. There are implicit and explicit cursors, with explicit cursors requiring declaration, opening, fetching from, and closing. Explicit cursor attributes track status like whether it is open or if rows were found. Exceptions in PL/SQL are handled through exception blocks using WHEN clauses to specify handlers for predefined, nonpredefined, or user-defined exceptions. Procedures contain executable code between BEGIN and END, optionally including exception handling. Procedures are called through executable PL/SQL statements specifying the procedure name and any parameters.
After completing this lesson, you should be able to do the following:
Write a cursor that uses parameters
Determine when a FOR UPDATE clause in a cursor is required
Determine when to use the WHERE CURRENT OF clause
Write a cursor that uses a subquery
The document discusses cursors in Oracle databases. It defines cursors as temporary work areas for processing query results row by row. There are two main types of cursors - implicit and explicit. Explicit cursors provide more control and involve declaring, opening, fetching from, and closing the cursor. Examples demonstrate using explicit cursors to retrieve and process multiple rows in a PL/SQL block. The document also covers cursor attributes, cursor for loops, parameterized cursors, and comparisons of implicit and explicit cursors.
Lambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon RitterJAXLondon2014
This document provides an overview of lambdas and streams in Java 8. It discusses how lambdas allow for more functional-style programming by supporting anonymous functions. Streams provide a way to perform aggregate operations on collections in a declarative way, using internal iteration with lambdas rather than external iteration. Key aspects covered include lambda expression syntax and type inference, method and constructor references, default and static methods in interfaces, and functional interfaces.
This document provides an overview of lambdas and streams in Java 8. It discusses how lambdas allow for more functional-style programming by supporting anonymous functions. Streams provide a way to perform aggregate operations on collections in a declarative way, using internal iteration with lambdas rather than external iteration. Key aspects covered include lambda expression syntax and type inference, method and constructor references, default and static methods in interfaces, and functional interfaces.
PL/SQL is a programming language that combines the SQL operations of querying and manipulating data in an Oracle database with the procedural language constructs of variables, conditions, and loops. PL/SQL can be used for database-side programming as well as client-side application development. It provides advantages like better performance, portability, higher productivity, and integration with Oracle. PL/SQL supports various data types, control structures, exception handling, and object-oriented programming features. Cursors allow processing of multiple rows returned from a SQL statement and can be static, dynamic, or reference types. Procedures and functions are reusable program units that allow passing parameters and returning values.
The document discusses PL/SQL programming concepts like procedures, cursors, and how to build and use them. It provides examples of creating procedures that update employee salaries, using cursors to loop through database records, and controlling cursor flow. The seminar exercise asks students to create a procedure that increases employee salaries by £500 or £1000 depending on the employee's grade level using concepts covered in the document.
This document discusses cursors in PL/SQL. It defines a cursor as a pointer that is used to point to individual rows in a database table. It explains that there are two types of cursors: implicit cursors and explicit cursors. Implicit cursors are used automatically for SQL statements and have attributes like %FOUND and %ROWCOUNT to check the status of DML operations. Explicit cursors must be declared, opened, values fetched from them into variables, and then closed to access multiple rows from a table in a controlled manner using PL/SQL.
The document is an Acrolinx IQ report that summarizes the results of checking a document's spelling, grammar, style, terminology, reuse, and new terms. It found 1 spelling error, 1 grammar error, and 32 style issues. Details are provided on each error found, including the rule violated and context of the error. The report also provides administrative information like the user, file details, and checking details like date, time, and document statistics.
Temple of Asclepius in Thrace. Excavation resultsKrassimira Luka
The temple and the sanctuary around were dedicated to Asklepios Zmidrenus. This name has been known since 1875 when an inscription dedicated to him was discovered in Rome. The inscription is dated in 227 AD and was left by soldiers originating from the city of Philippopolis (modern Plovdiv).
Leveraging Generative AI to Drive Nonprofit InnovationTechSoup
In this webinar, participants learned how to utilize Generative AI to streamline operations and elevate member engagement. Amazon Web Service experts provided a customer specific use cases and dived into low/no-code tools that are quick and easy to deploy through Amazon Web Service (AWS.)
Chapter wise All Notes of First year Basic Civil Engineering.pptxDenish Jangid
Chapter wise All Notes of First year Basic Civil Engineering
Syllabus
Chapter-1
Introduction to objective, scope and outcome the subject
Chapter 2
Introduction: Scope and Specialization of Civil Engineering, Role of civil Engineer in Society, Impact of infrastructural development on economy of country.
Chapter 3
Surveying: Object Principles & Types of Surveying; Site Plans, Plans & Maps; Scales & Unit of different Measurements.
Linear Measurements: Instruments used. Linear Measurement by Tape, Ranging out Survey Lines and overcoming Obstructions; Measurements on sloping ground; Tape corrections, conventional symbols. Angular Measurements: Instruments used; Introduction to Compass Surveying, Bearings and Longitude & Latitude of a Line, Introduction to total station.
Levelling: Instrument used Object of levelling, Methods of levelling in brief, and Contour maps.
Chapter 4
Buildings: Selection of site for Buildings, Layout of Building Plan, Types of buildings, Plinth area, carpet area, floor space index, Introduction to building byelaws, concept of sun light & ventilation. Components of Buildings & their functions, Basic concept of R.C.C., Introduction to types of foundation
Chapter 5
Transportation: Introduction to Transportation Engineering; Traffic and Road Safety: Types and Characteristics of Various Modes of Transportation; Various Road Traffic Signs, Causes of Accidents and Road Safety Measures.
Chapter 6
Environmental Engineering: Environmental Pollution, Environmental Acts and Regulations, Functional Concepts of Ecology, Basics of Species, Biodiversity, Ecosystem, Hydrological Cycle; Chemical Cycles: Carbon, Nitrogen & Phosphorus; Energy Flow in Ecosystems.
Water Pollution: Water Quality standards, Introduction to Treatment & Disposal of Waste Water. Reuse and Saving of Water, Rain Water Harvesting. Solid Waste Management: Classification of Solid Waste, Collection, Transportation and Disposal of Solid. Recycling of Solid Waste: Energy Recovery, Sanitary Landfill, On-Site Sanitation. Air & Noise Pollution: Primary and Secondary air pollutants, Harmful effects of Air Pollution, Control of Air Pollution. . Noise Pollution Harmful Effects of noise pollution, control of noise pollution, Global warming & Climate Change, Ozone depletion, Greenhouse effect
Text Books:
1. Palancharmy, Basic Civil Engineering, McGraw Hill publishers.
2. Satheesh Gopi, Basic Civil Engineering, Pearson Publishers.
3. Ketki Rangwala Dalal, Essentials of Civil Engineering, Charotar Publishing House.
4. BCP, Surveying volume 1
The chapter Lifelines of National Economy in Class 10 Geography focuses on the various modes of transportation and communication that play a vital role in the economic development of a country. These lifelines are crucial for the movement of goods, services, and people, thereby connecting different regions and promoting economic activities.
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumMJDuyan
(𝐓𝐋𝐄 𝟏𝟎𝟎) (𝐋𝐞𝐬𝐬𝐨𝐧 𝟏)-𝐏𝐫𝐞𝐥𝐢𝐦𝐬
𝐃𝐢𝐬𝐜𝐮𝐬𝐬 𝐭𝐡𝐞 𝐄𝐏𝐏 𝐂𝐮𝐫𝐫𝐢𝐜𝐮𝐥𝐮𝐦 𝐢𝐧 𝐭𝐡𝐞 𝐏𝐡𝐢𝐥𝐢𝐩𝐩𝐢𝐧𝐞𝐬:
- Understand the goals and objectives of the Edukasyong Pantahanan at Pangkabuhayan (EPP) curriculum, recognizing its importance in fostering practical life skills and values among students. Students will also be able to identify the key components and subjects covered, such as agriculture, home economics, industrial arts, and information and communication technology.
𝐄𝐱𝐩𝐥𝐚𝐢𝐧 𝐭𝐡𝐞 𝐍𝐚𝐭𝐮𝐫𝐞 𝐚𝐧𝐝 𝐒𝐜𝐨𝐩𝐞 𝐨𝐟 𝐚𝐧 𝐄𝐧𝐭𝐫𝐞𝐩𝐫𝐞𝐧𝐞𝐮𝐫:
-Define entrepreneurship, distinguishing it from general business activities by emphasizing its focus on innovation, risk-taking, and value creation. Students will describe the characteristics and traits of successful entrepreneurs, including their roles and responsibilities, and discuss the broader economic and social impacts of entrepreneurial activities on both local and global scales.
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxEduSkills OECD
Iván Bornacelly, Policy Analyst at the OECD Centre for Skills, OECD, presents at the webinar 'Tackling job market gaps with a skills-first approach' on 12 June 2024
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.pptHenry Hollis
The History of NZ 1870-1900.
Making of a Nation.
From the NZ Wars to Liberals,
Richard Seddon, George Grey,
Social Laboratory, New Zealand,
Confiscations, Kotahitanga, Kingitanga, Parliament, Suffrage, Repudiation, Economic Change, Agriculture, Gold Mining, Timber, Flax, Sheep, Dairying,
Objectives You have learned about implicit cursors that are automatically created by PL/SQL when you execute a SQL SELECT or DML statement. In this lesson, you learn about explicit cursors. You learn to differentiate between implicit and explicit cursors. You also learn to declare and control simple cursors, as well as cursors with parameters. Oracle Database: PL/SQL Fundamentals 7 -
Oracle Database: PL/SQL Fundamentals 7 -
Cursors The Oracle Server uses work areas (called private SQL areas ) to execute SQL statements and to store processing information. You can use explicit cursors to name a private SQL area and to access its stored information. The Oracle Server implicitly opens a cursor to process each SQL statement that is not associated with an explicitly declared cursor. Using PL/SQL, you can refer to the most recent implicit cursor as the SQL cursor. Oracle Database: PL/SQL Fundamentals 7 -
Explicit Cursor Operations You declare explicit cursors in PL/SQL when you have a SELECT statement that returns multiple rows. You can process each row returned by the SELECT statement. The set of rows returned by a multiple-row query is called the active set . Its size is the number of rows that meet your search criteria. The diagram in the slide shows how an explicit cursor “points” to the current row in the active set . This enables your program to process the rows one at a time. Explicit cursor functions: Can perform row-by-row processing beyond the first row returned by a query Keep track of the row that is currently being processed Enable the programmer to manually control explicit cursors in the PL/SQL block Oracle Database: PL/SQL Fundamentals 7 -
Controlling Explicit Cursors Now that you have a conceptual understanding of cursors, review the steps to use them. 1. In the declarative section of a PL/SQL block, declare the cursor by naming it and defining the structure of the query to be associated with it. 2. Open the cursor. The OPEN statement executes the query and binds any variables that are referenced. Rows identified by the query are called the active set and are now available for fetching. 3. Fetch data from the cursor. In the flow diagram shown in the slide, after each fetch, you test the cursor for any existing row. If there are no more rows to process, you must close the cursor. 4. Close the cursor. The CLOSE statement releases the active set of rows. It is now possible to reopen the cursor to establish a fresh active set. Oracle Database: PL/SQL Fundamentals 7 -
Controlling Explicit Cursors (continued) A PL/SQL program opens a cursor, processes rows returned by a query, and then closes the cursor. The cursor marks the current position in the active set. 1. The OPEN statement executes the query associated with the cursor, identifies the active set, and positions the cursor at the first row. 2. The FETCH statement retrieves the current row and advances the cursor to the next row until there are no more rows or a specified condition is met. 3. The CLOSE statement releases the cursor. Oracle Database: PL/SQL Fundamentals 7 -
Oracle Database: PL/SQL Fundamentals 7 -
Declaring the Cursor The syntax to declare a cursor is shown in the slide. In the syntax: cursor_name Is a PL/SQL identifier select_statement Is a SELECT statement without an INTO clause The active set of a cursor is determined by the SELECT statement in the cursor declaration. It is mandatory to have an INTO clause for a SELECT statement in PL/SQL. However, note that the SELECT statement in the cursor declaration cannot have an INTO clause. That is because you are only defining a cursor in the declarative section and not retrieving any rows into the cursor. Note Do not include the INTO clause in the cursor declaration because it appears later in the FETCH statement. If you want the rows to be processed in a specific sequence, use the ORDER BY clause in the query. The cursor can be any valid SELECT statement, including joins, subqueries, and so on. Oracle Database: PL/SQL Fundamentals 7 -
Declaring the Cursor (continued) The c_emp_cursor cursor is declared to retrieve the employee_id and last_name columns for those employees working in the department with department_id 30. The c_dept_cursor cursor is declared to retrieve all the details for the department with the location_id 1700. Note that a variable is used while declaring the cursor. These variables are considered bind variables, which must be visible when you are declaring the cursor. These variables are examined only once at the time the cursor opens. You have learned that explicit cursors are used when you have to retrieve and operate on multiple rows in PL/SQL. However, this example shows that you can use the explicit cursor even if your SELECT statement returns only one row. Oracle Database: PL/SQL Fundamentals 7 -
Opening the Cursor The OPEN statement executes the query associated with the cursor, identifies the active set, and positions the cursor pointer at the first row. The OPEN statement is included in the executable section of the PL/SQL block. OPEN is an executable statement that performs the following operations: 1. Dynamically allocates memory for a context area 2. Parses the SELECT statement 3. Binds the input variables (sets the values for the input variables by obtaining their memory addresses) 4. Identifies the active set (the set of rows that satisfy the search criteria). Rows in the active set are not retrieved into variables when the OPEN statement is executed. Rather, the FETCH statement retrieves the rows from the cursor to the variables. 5. Positions the pointer to the first row in the active set Note: If a query returns no rows when the cursor is opened, PL/SQL does not raise an exception. You can find out the number of rows returned with an explicit cursor by using the <cursor_name>%ROWCOUNT attribute. Oracle Database: PL/SQL Fundamentals 7 -
Fetching Data from the Cursor The FETCH statement retrieves the rows from the cursor one at a time. After each fetch, the cursor advances to the next row in the active set. You can use the %NOTFOUND attribute to determine whether the entire active set has been retrieved. Consider the example shown in the slide. Two variables, empno and lname , are declared to hold the fetched values from the cursor. Examine the FETCH statement. You have successfully fetched the values from the cursor to the variables. However, there are six employees in department 30, but only one row was fetched. To fetch all rows, you must use loops. In the next slide, you see how a loop is used to fetch all the rows. The FETCH statement performs the following operations: 1. Reads the data for the current row into the output PL/SQL variables 2. Advances the pointer to the next row in the active set Oracle Database: PL/SQL Fundamentals 7 -
Fetching Data from the Cursor (continued) You can include the same number of variables in the INTO clause of the FETCH statement as there are columns in the SELECT statement; be sure that the data types are compatible. Match each variable to correspond to the columns positionally. Alternatively, you can also define a record for the cursor and reference the record in the FETCH INTO clause. Finally, test to see whether the cursor contains rows. If a fetch acquires no values, there are no rows left to process in the active set and no error is recorded. Oracle Database: PL/SQL Fundamentals 7 -
Fetching Data from the Cursor (continued) Observe that a simple LOOP is used to fetch all the rows. Also, the cursor attribute %NOTFOUND is used to test for the exit condition. The output of the PL/SQL block is: Oracle Database: PL/SQL Fundamentals 7 -
Closing the Cursor The CLOSE statement disables the cursor, releases the context area, and “undefines” the active set. Close the cursor after completing the processing of the FETCH statement. You can reopen the cursor if required. A cursor can be reopened only if it is closed. If you attempt to fetch data from a cursor after it is closed, an INVALID_CURSOR exception is raised. Note: Although it is possible to terminate the PL/SQL block without closing cursors, you should make it a habit to close any cursor that you declare explicitly to free resources. There is a maximum limit on the number of open cursors per session, which is determined by the OPEN_CURSORS parameter in the database parameter file. ( OPEN_CURSORS = 50 by default.) Oracle Database: PL/SQL Fundamentals 7 -
Cursors and Records You have already seen that you can define records that have the structure of columns in a table. You can also define a record based on the selected list of columns in an explicit cursor. This is convenient for processing the rows of the active set, because you can simply fetch into the record. Therefore, the values of the rows are loaded directly into the corresponding fields of the record. Oracle Database: PL/SQL Fundamentals 7 -
Cursor FOR Loops You learned to fetch data from cursors by using simple loops. You now learn to use a cursor FOR loop, which processes rows in an explicit cursor. It is a shortcut because the cursor is opened, a row is fetched once for each iteration in the loop, the loop exits when the last row is processed, and the cursor is closed automatically. The loop itself is terminated automatically at the end of the iteration where the last row is fetched. In the syntax: record_name Is the name of the implicitly declared record cursor_name Is a PL/SQL identifier for the previously declared cursor Guidelines Do not declare the record that controls the loop; it is declared implicitly. Test the cursor attributes during the loop if required. Supply the parameters for a cursor, if required, in parentheses following the cursor name in the FOR statement. Oracle Database: PL/SQL Fundamentals 7 -
Cursor FOR Loops (continued) The example that was used to demonstrate the usage of a simple loop to fetch data from cursors is rewritten to use the cursor FOR loop. emp_record is the record that is implicitly declared. You can access the fetched data with this implicit record (as shown in the slide). Observe that no variables are declared to hold the fetched data using the INTO clause. The code does not have the OPEN and CLOSE statements to open and close the cursor, respectively. Oracle Database: PL/SQL Fundamentals 7 -
Explicit Cursor Attributes As with implicit cursors, there are four attributes for obtaining the status information of a cursor. When appended to the cursor variable name, these attributes return useful information about the execution of a cursor manipulation statement. Note: You cannot reference cursor attributes directly in a SQL statement. Oracle Database: PL/SQL Fundamentals 7 -
%ISOPEN Attribute You can fetch rows only when the cursor is open. Use the %ISOPEN cursor attribute to determine whether the cursor is open. Fetch rows in a loop. Use cursor attributes to determine when to exit the loop. Use the %ROWCOUNT cursor attribute to do the following: Process an exact number of rows. Fetch the rows in a loop and determine when to exit the loop. Note: %ISOPEN returns the status of the cursor: TRUE if open and FALSE if not. Oracle Database: PL/SQL Fundamentals 7 -
%ROWCOUNT and %NOTFOUND : Example The example in the slide retrieves the first 10 employees one by one. This example shows how the %ROWCOUNT and %NOTFOUND attributes can be used for exit conditions in a loop. Oracle Database: PL/SQL Fundamentals 7 -
Cursor FOR Loops Using Subqueries Note that there is no declarative section in this PL/SQL block. The difference between the cursor FOR loops using subqueries and the cursor FOR loop lies in the cursor declaration. If you are writing cursor FOR loops using subqueries, you need not declare the cursor in the declarative section. You have to provide the SELECT statement that determines the active set in the loop itself. The example that was used to illustrate a cursor FOR loop is rewritten to illustrate a cursor FOR loop using subqueries. Note: You cannot reference explicit cursor attributes if you use a subquery in a cursor FOR loop because you cannot give the cursor an explicit name. Oracle Database: PL/SQL Fundamentals 7 -
Oracle Database: PL/SQL Fundamentals 7 -
Cursors with Parameters You can pass parameters to a cursor. This means that you can open and close an explicit cursor several times in a block, returning a different active set on each occasion. For each execution, the previous cursor is closed and reopened with a new set of parameters. Each formal parameter in the cursor declaration must have a corresponding actual parameter in the OPEN statement. Parameter data types are the same as those for scalar variables, but you do not give them sizes. The parameter names are for reference in the query expression of the cursor. In the syntax: The parameter notation does not offer greater functionality; it simply allows you to specify input values easily and clearly. This is particularly useful when the same cursor is referenced repeatedly. cursor_name Is a PL/SQL identifier for the declared cursor parameter_name Is the name of a parameter datatype Is the scalar data type of the parameter select_statement Is a SELECT statement without the INTO clause Oracle Database: PL/SQL Fundamentals 7 -
Cursors with Parameters (continued) Parameter data types are the same as those for scalar variables, but you do not give them sizes. The parameter names are for reference in the cursor’s query. In the following example, a cursor is declared and is defined with one parameter: DECLARE CURSOR c_emp_cursor(deptno NUMBER) IS SELECT ... The following statements open the cursor and return different active sets: OPEN c_emp_cursor(10); OPEN c_emp_cursor(20); You can pass parameters to the cursor that is used in a cursor FOR loop: DECLARE CURSOR c_emp_cursor(p_deptno NUMBER, p_job VARCHAR2)IS SELECT ... BEGIN FOR emp_record IN c_emp_cursor(10, ' Sales ' ) LOOP ... Oracle Database: PL/SQL Fundamentals 7 -
Oracle Database: PL/SQL Fundamentals 7 -
FOR UPDATE Clause If there are multiple sessions for a single database, there is the possibility that the rows of a particular table were updated after you opened your cursor. You see the updated data only when you reopen the cursor. Therefore, it is better to have locks on the rows before you update or delete rows. You can lock the rows with the FOR UPDATE clause in the cursor query. In the syntax: The FOR UPDATE clause is the last clause in a SELECT statement, even after ORDER BY (if it exists). When you want to query multiple tables, you can use the FOR UPDATE clause to confine row locking to particular tables. FOR UPDATE OF col_name(s) locks rows only in tables that contain col_name(s) . column_reference Is a column in the table against which the query is performed (A list of columns may also be used.) NOWAIT Returns an Oracle Server error if the rows are locked by another session Oracle Database: PL/SQL Fundamentals 7 -
FOR UPDATE Clause (continued) The SELECT ... FOR UPDATE statement identifies the rows that are to be updated or deleted, and then locks each row in the result set. This is useful when you want to base an update on the existing values in a row. In that case, you must make sure that the row is not changed by another session before the update. The optional NOWAIT keyword tells the Oracle Server not to wait if the requested rows have been locked by another user. Control is immediately returned to your program so that it can do other work before trying again to acquire the lock. If you omit the NOWAIT keyword, the Oracle Server waits until the rows are available. Example: DECLARE CURSOR c_emp_cursor IS SELECT employee_id, last_name, FROM employees WHERE department_id = 80 FOR UPDATE OF salary NOWAIT; ... If the Oracle Server cannot acquire the locks on the rows it needs in a SELECT FOR UPDATE operation, it waits indefinitely. Use NOWAIT to handle such situations. If the rows are locked by another session and you have specified NOWAIT , opening the cursor results in an error. You can try to open the cursor later. You can use WAIT instead of NOWAIT , specify the number of seconds to wait, and then determine whether the rows are unlocked. If the rows are still locked after n seconds, an error is returned. It is not mandatory for the FOR UPDATE OF clause to refer to a column, but it is recommended for better readability and maintenance. Oracle Database: PL/SQL Fundamentals 7 -
WHERE CURRENT OF Clause The WHERE CURRENT OF clause is used in conjunction with the FOR UPDATE clause to refer to the current row in an explicit cursor. The WHERE CURRENT OF clause is used in the UPDATE or DELETE statement, whereas the FOR UPDATE clause is specified in the cursor declaration. You can use the combination for updating and deleting the current row from the corresponding database table. This enables you to apply updates and deletes to the row currently being addressed, without the need to explicitly reference the row ID. You must include the FOR UPDATE clause in the cursor query so that the rows are locked on OPEN . In the syntax: cursor Is the name of a declared cursor (The cursor must have been declared with the FOR UPDATE clause.) Oracle Database: PL/SQL Fundamentals 7 -
Answer: a Oracle Database: PL/SQL Fundamentals 7 -
Summary The Oracle Server uses work areas to execute SQL statements and store processing information. You can use a PL/SQL construct called a cursor to name a work area and access its stored information. There are two kinds of cursors: implicit and explicit. PL/SQL implicitly declares a cursor for all SQL data manipulation statements, including queries that return only one row. For queries that return multiple rows, you must explicitly declare a cursor to process the rows individually. Every explicit cursor and cursor variable has four attributes: %FOUND , %ISOPEN , %NOTFOUND , and %ROWCOUNT . When appended to the cursor variable name, these attributes return useful information about the execution of a SQL statement. You can use cursor attributes in procedural statements but not in SQL statements. Use simple loops or cursor FOR loops to operate on the multiple rows fetched by the cursor. If you are using simple loops, you have to open, fetch, and close the cursor; however, cursor FOR loops do this implicitly. If you are updating or deleting rows, lock the rows by using a FOR UPDATE clause. This ensures that the data you are using is not updated by another session after you open the cursor. Use a WHERE CURRENT OF clause in conjunction with the FOR UPDATE clause to reference the current row fetched by the cursor. Oracle Database: PL/SQL Fundamentals 7 -
Practice 7: Overview In this practice, you apply your knowledge of cursors to process a number of rows from a table and populate another table with the results using a cursor FOR loop. You also write a cursor with parameters. Oracle Database: PL/SQL Fundamentals 7 -