The document provides an introduction and overview of PL/SQL programming concepts including:
- Declaring variables and exceptions
- Using IF/THEN conditional statements and loops for repetition (LOOP-EXIT-END, WHILE-LOOP-END, FOR-IN-LOOP-END)
- Selecting data into variables from tables and displaying output
- Examples of inserting, updating and selecting records from tables
It discusses key PL/SQL concepts and provides code examples to demonstrate how to declare variables, use conditional logic and loops, perform CRUD operations on database tables, and handle exceptions. The document appears to be part of a series of introductory lessons on learning PL/SQL programming fundamentals.
I present four design patterns that make your development easier and better. Design patterns are a fantastic way to make more readable code, as they make use of common ideas that many developers know and use. These patterns are tried and tested in the enterprise world.
The first one is dependency injection. This covers putting the variables that a class needs to function preferably inside a constructor.
The second one is the factory pattern. A factory moves the responsibility of instantiating an object to a third-party class.
The third one is dependency injection. This allows us to place a class' dependencies at one time, making it easy to come back and see what the class needs to survive.
Finally, we discuss the chain of responsibility. This allows complex operations to be handled by a chain of classes. Each class in the chain determines whether it is capable of handling the request and, if so, it returns the result.
The C is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis M. Ritchie at the Bell Telephone Laboratories to develop the UNIX operating system.
The C is the most widely used computer language, it keeps fluctuating at number one scale of popularity along with Java programming language, which is also equally popular and most widely used among modern software programmers.
I present four design patterns that make your development easier and better. Design patterns are a fantastic way to make more readable code, as they make use of common ideas that many developers know and use. These patterns are tried and tested in the enterprise world.
The first one is dependency injection. This covers putting the variables that a class needs to function preferably inside a constructor.
The second one is the factory pattern. A factory moves the responsibility of instantiating an object to a third-party class.
The third one is dependency injection. This allows us to place a class' dependencies at one time, making it easy to come back and see what the class needs to survive.
Finally, we discuss the chain of responsibility. This allows complex operations to be handled by a chain of classes. Each class in the chain determines whether it is capable of handling the request and, if so, it returns the result.
The C is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis M. Ritchie at the Bell Telephone Laboratories to develop the UNIX operating system.
The C is the most widely used computer language, it keeps fluctuating at number one scale of popularity along with Java programming language, which is also equally popular and most widely used among modern software programmers.
PL/SQL is a procedural language designed specifically to embrace SQL statements within its syntax. PL/SQL program units are compiled by the Oracle Database server and stored inside the database.
Oracle 11g new features for developersScott Wesley
Abstract: There are a wealth of new features available in the 11g database release. This presentation touches on SQL & PL/SQL features I found of interest, and concentrates particularly on virtual columns.
Relevant scripts found at my blog
http://grassroots-oracle.com/2009/07/presentations.html#11gNewFeatures
Exception Handling - The Good, the Bad and the Maybe (APEXCONN23)Maik Becker
APEX Connect 2023 - Berlin, 3 & 4 May 2023
Exception Handling - The Good, the Bad and the Maybe
About Exception Handling in Oracle Databases, PL/SQL and APEX. Good- and Bad-Practice.
This presentation aims to teach the concept of SQL Injection and illustrate in practical examples how such an attack can damage a system.
Examples in Python
Esta apresentação objetiva ensinar o conceito de SQL Injection, bem como ilustrar em exemplos práticos como um ataque desse tipo pode danificar um sistema.
Exemplos em Python.
PL/SQL is a procedural language designed specifically to embrace SQL statements within its syntax. PL/SQL program units are compiled by the Oracle Database server and stored inside the database.
Oracle 11g new features for developersScott Wesley
Abstract: There are a wealth of new features available in the 11g database release. This presentation touches on SQL & PL/SQL features I found of interest, and concentrates particularly on virtual columns.
Relevant scripts found at my blog
http://grassroots-oracle.com/2009/07/presentations.html#11gNewFeatures
Exception Handling - The Good, the Bad and the Maybe (APEXCONN23)Maik Becker
APEX Connect 2023 - Berlin, 3 & 4 May 2023
Exception Handling - The Good, the Bad and the Maybe
About Exception Handling in Oracle Databases, PL/SQL and APEX. Good- and Bad-Practice.
This presentation aims to teach the concept of SQL Injection and illustrate in practical examples how such an attack can damage a system.
Examples in Python
Esta apresentação objetiva ensinar o conceito de SQL Injection, bem como ilustrar em exemplos práticos como um ataque desse tipo pode danificar um sistema.
Exemplos em Python.
Safalta Digital marketing institute in Noida, provide complete applications that encompass a huge range of virtual advertising and marketing additives, which includes search engine optimization, virtual communication advertising, pay-per-click on marketing, content material advertising, internet analytics, and greater. These university courses are designed for students who possess a comprehensive understanding of virtual marketing strategies and attributes.Safalta Digital Marketing Institute in Noida is a first choice for young individuals or students who are looking to start their careers in the field of digital advertising. The institute gives specialized courses designed and certification.
for beginners, providing thorough training in areas such as SEO, digital communication marketing, and PPC training in Noida. After finishing the program, students receive the certifications recognised by top different universitie, setting a strong foundation for a successful career in digital marketing.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
25. declare
v_salary employees.salary %type;
begin
select salary into v_salary
from employees
where employee_id=150;
if v_salary > 10000 then
dbms_output.put_line('VIP');
end if ;
end;
v_salary
employee_id
VIP
SQL - PL دسٔط 25
27. declare
v_salary employees.salary %type;
begin
select salary into v_salary
from employees
where employee_id=102;
if v_salary > 10000 then
dbms_output.put_line('VIP');
else
dbms_output.put_line('normal');
end if ;
end;
normal
SQL - PL دسٔط 27
29. declare
v_salary employees.salary%type;
begin
select salary into v_salary
from employees
where employee_id=150;
if v_salary > 10000 then
dbms_output.put_line('VIP');
elsif (v_salary >=3000 and v_salary <=10000) then
dbms_output.put_line('normal');
else
dbms_output.put_line('low');
end if;
end;
SQL - PL دسٔط 29
30. declare
v_salary employees.salary%type;
begin
select salary into v_salary
from employees
where employee_id=150;
if v_salary > 10000 then
dbms_output.put_line('VIP');
elsif (v_salary >=3000 and v_salary <=10000) then
dbms_output.put_line('normal');
else
dbms_output.put_line('low');
end if;
end;
SQL - PL دسٔط 30
32. declare
v_salary employees.salary%type;
begin
select salary into v_salary
from employees
where employee_id=150;
if v_salary > 10000 then
dbms_output.put_line('VIP');
elsif (v_salary between 3000 and 10000) then
dbms_output.put_line('normal');
else
dbms_output.put_line('low');
end if;
end;
SQL - PL دسٔط 32
38. declare
v_counter number := 1;
begin v_counter
loop
dbms_output.put_line(v_counter);
v_counter:=v_counter+1;
exit when v_counter>10;
end loop;
end ;
SQL - PL دسٔط 38
39. declare
v_counter number :=10;
begin v_counter
loop
dbms_output.put_line(v_counter);
v_counter:=v_counter-1;
exit when v_counter=0;
end loop;
end ;
SQL - PL دسٔط 39
42. declare v_counter
v_counter number :=1;
begin
while v_counter <=10 loop
dbms_output.put_line(v_counter);
v_counter:=v_counter+1;
end loop;
end ;
SQL - PL دسٔط 42
43. declare v_counter
v_counter number :=10;
begin
while v_counter >=1 loop
dbms_output.put_line(v_counter);
v_counter:=v_counter-1;
end loop;
end ;
SQL - PL دسٔط 43
44. declare
v_sal employees.salary %type;
v_counter number :=0;
begin
select salary into v_sal
from employees
where employee_id=106;
while v_sal <10000 loop
v_sal :=v_sal*1.2;
v_counter :=v_counter+1;
end loop;
dbms_output.put_line('The number of monthes is : '||v_counter);
end;
SQL - PL دسٔط 44
57. declare
v_id employees.employee_id%type;
v_fname employees.first_name%type;
v_lname employees.last_name%type;
v_sal employees.salary%type;
cursor c is select employee_id,first_name,last_name,salary
from employees where department_id=50;
begin
open c;
loop
fetch c into v_id,v_fname,v_lname,v_sal;
exit when c % notfound;
dbms_output.put_line(v_id||' '||v_fname||' '||v_lname||' '||v_sal);
end loop;
close c;
end ;
SQL - PL دسٔط 57
58. declare
v_id employees.employee_id%type;
v_fname employees.first_name%type;
v_lname employees.last_name%type;
v_sal employees.salary%type;
cursor c is select employee_id,first_name,last_name,salary
from employees
where department_id=50;
SQL - PL دسٔط 58
59. •جلب
begin
open c;
loop
fetch c into v_id,v_fname,v_lname,v_sal;
exit when c % notfound;
dbms_output.put_line(v_id||' '||v_fname||' '||v_lname||' '||v_sal);
end loop;
close c;
end ;
SQL - PL دسٔط 59
62. declare
v_id employees.employee_id%type;
v_fname employees.first_name%type;
v_lname employees.last_name%type;
v_sal employees.salary%type;
cursor c is select employee_id,first_name,last_name,salary
from employees where department_id=50;
begin
open c;
fetch c into v_id,v_fname,v_lname,v_sal;
while c %found loop
dbms_output.put_line(v_id||' '||v_fname||' '||v_lname||' '||v_sal);
fetch c into v_id,v_fname,v_lname,v_sal;
end loop;
close c;
end ;
SQL - PL دسٔط 62
63. begin
open c;
fetch c into v_id,v_fname,v_lname,v_sal;
while c %found loop
dbms_output.put_line(v_id||' '||v_fname||' '||v_lname||' '||v_sal);
fetch c into v_id,v_fname,v_lname,v_sal;
end loop;
close c;
end ;
SQL - PL دسٔط 63
64. declare
cursor c is select employee_id,first_name,last_name,salary
from employees where department_id=50;
v_rec c %rowtype;
begin
open c;
fetch c into v_rec;
while c %found loop
dbms_output.put_line(v_rec.employee_id||' '||v_rec.first_name||'
'||v_rec.last_name||' '||v_rec.salary);
fetch c into v_rec;
end loop;
close c;
end ;
SQL - PL دسٔط 64
66. declare
cursor c is select employee_id,first_name,last_name,salary
from employees
where department_id=50;
begin
for v_rec in c loop
dbms_output.put_line(v_rec.employee_id||' '||v_rec.first_name||'
'||v_rec.last_name||' '||v_rec.salary);
end loop;
end;
SQL - PL دسٔط 66
68. declare
v_job employees.job_id%type;
v_id employees.employee_id%type;
cursor c is select employee_id,job_id from employees;
begin
open c;
loop
fetch c into v_id,v_job;
exit when c%notfound;
if v_job='ST_CLERK' then
delete from employees where employee_id=v_id;
elsif v_job='IT_PROG' then
update employees set department_id=50 where employee_id=v_id;
else
dbms_output.put_line('No Changes');
end if;
end loop;
close c;
end ;
SQL - PL دسٔط 68
71. declare
v_sal employees.salary%type;
v_id employees.employee_id%type;
cursor c is select employee_id,salary from employees;
begin
open c;
loop
fetch c into v_id,v_sal;
exit when c%notfound;
if v_sal < 3000 then
update employees set salary=salary*1.2 where employee_id=v_id;
elsif v_sal between 3000 and 10000 then
update employees set salary=salary*1.15 where employee_id=v_id;
else
update employees set salary=salary*1.1 where employee_id=v_id;
end if;
end loop;
close c;
end ;
SQL - PL دسٔط 71
72. Used Conditions
One Fetch & ( % notFound ) Loop
If
Two Fetch & ( % Found ) While
Don’t use Fetch For
SQL - PL دسٔط 72
75. Exception
:: ذٕمسُ األخطاء إٌى
1. Too many rows
2. No data found
3. Zero divide
4. Others
SQL - PL دسٔط 75
76. Exception
1. Too many rows
declare
v_lname employees.last_name%type;
begin
dbms_output.put_line('Before Exception');
select last_name into v_lname
from employees;
dbms_output.put_line(v_lname);
exception
when too_many_rows then
dbms_output.put_line('Pleae set Comndition in sql statement');
end;
SQL - PL دسٔط 76
77. Exception
2. No data found
declare
v_lname employees.last_name%type;
begin
select last_name into v_lname
from employees
where employee_id=101;
dbms_output.put_line(v_lname);
exception
when no_data_found then
dbms_output.put_line('No data returned from sql statement');
end;
SQL - PL دسٔط 77
78. Exception
3. Zero divide
declare
v_lname employees.last_name%type;
begin
select last_name into v_lname
from employees
where employee_id=101;
dbms_output.put_line(50/0);
exception
when zero_divide then
dbms_output.put_line('Cant division on zero');
end;
SQL - PL دسٔط 78
79. Exception
create table error
(
title varchar2(25),
err_date date
) Title
خاص تؼٕٛاْ اٌخطأ
err_date
خاص تراسيخ اٌخطأ
SQL - PL دسٔط 79
80. Exception
declare
v_lname employees.last_name%type;
begin
select last_name into v_lname from employees ;
dbms_output.put_line(v_lname);
dbms_output.put_line(50/0);
exception
when too_many_rows then
dbms_output.put_line('Pleae set Comndition in sql statement');
insert into error values('Too many rows',sysdate);
when no_data_found then
dbms_output.put_line('No data returned from sql statement');
insert into error values('no data found',sysdate);
when zero_divide then
dbms_output.put_line('Cant division on zero');
insert into error values('Zero Divide',sysdate);
end;
SQL - PL دسٔط 80
81. exception
when too_many_rows then
dbms_output.put_line('Pleae set Comndition in sql statement');
insert into error values('Too many rows',sysdate);
when no_data_found then
dbms_output.put_line('No data returned from sql statement');
insert into error values('no data found', sysdate);
when zero_divide then
dbms_output.put_line('Cant division on zero');
insert into error values('Zero Divide',sysdate);
end;
SQL - PL دسٔط 81
82. Exception
4. Others
declare
v_lname employees.last_name%type;
begin
select last_name into v_lname from employees ;
dbms_output.put_line(v_lname);
dbms_output.put_line(50/0);
exception
when too_many_rows then
dbms_output.put_line('Pleae set Comndition in sql statement');
insert into error values('Too many rows',sysdate);
when no_data_found then
dbms_output.put_line('No data returned from sql statement');
insert into error values('no data found',sysdate);
when zero_divide then
dbms_output.put_line('Cant division on zero');
insert into error values('Zero Divide',sysdate);
when others then
dbms_output.put_line('Error');
end;
SQL - PL دسٔط 82
83. exception
when too_many_rows then
dbms_output.put_line('Pleae set Comndition in sql statement');
insert into error values('Too many rows',sysdate);
when no_data_found then
dbms_output.put_line('No data returned from sql statement');
insert into error values('no data found',sysdate);
when zero_divide then
dbms_output.put_line('Cant division on zero');
insert into error values('Zero Divide',sysdate);
when others then
dbms_output.put_line('Error');
SQL - PL دسٔط 83
85. Exception
declare
v_sal employees.salary%type;
my_exp exception;
begin
update employees set salary=salary*1.7 where employee_id=200;
select salary into v_sal from employees where employee_id=200;
if v_sal >5500 then
raise my_exp;
else
dbms_output.put_line('The salary is updated');
commit;
end if;
exception
when my_exp then
dbms_output.put_line('The salary is more than 7500');
rollback;
end;
SQL - PL دسٔط 85
88. ** Commit
else
dbms_output.put_line('The salary is updated');
commit;
end if;
data base ٍ) إرا خشخُا يcommit( ٔظٍفت
ٌـحـخـفع بدًٍع انخحذٌثاث ٔ انقٍى
SQL - PL دسٔط 88
89. ** Rollback
exception
when my_exp then
dbms_output.put_line('The salary is more than 7500');
rollback;
end;
data base ٍ) إرا خشخُا يrollback( ٔظٍفت
ٌخشاخع عٍ خًٍع انخحذٌثاث ٔ انقٍى
SQL - PL دسٔط 89
95. Function
تحدثنا في الشريحة السابقة عن اإلجراءات المخزنة و اآلن نتحدث عن الوظائف المخزنة
لكن الفرق أن الوظائف المخزنة ترجع قيمة
الصيغة العامة كما يلي :
دسٔط SQL - PL 59
97. Procedure
create or replace procedure print_all_emp( p_did
employees.department_id%type)
as
cursor c is select first_name,last_name,salary
from employees
where department_id=p_did;
begin
for v_rec in c loop
dbms_output.put_line(v_rec.first_name||'
'||v_rec.last_name||' '||v_rec.salary);
end loop;
end print_all_emp;
SQL - PL دسٔط 97
99. Procedure
create table circle
( id number,
r number);
create or replace procedure circle_proc (p_id number)
is
v_r number;
begin
select r into v_r
from circle where id=p_id;
dbms_output.put_line('Muhit : '||(2*3.14*v_r));
dbms_output.put_line('Area : '||(v_r*v_r*3.14));
exception
when no_data_found then
dbms_output.put_line('The circle you selected
no exists');
end circle_proc;
SQL - PL دسٔط 99
100. create or replace procedure circle_proc (p_id number)
is
v_r number;
begin
select r into v_r
from circle where id=p_id;
dbms_output.put_line(‘ Muhit : '||(2*3.14*v_r));
dbms_output.put_line('Area : '||(v_r*v_r*3.14));
exception
when no_data_found then
dbms_output.put_line('The circle you selected no exists');
end circle_proc;
SQL - PL دسٔط 100
101. Function
create or replace function getR(p_id number)
return number
is
v_r number;
begin
select r into v_r
from circle
where id=p_id;
return v_r;
exception
when no_data_found then
return 0;
end getR;
SQL - PL دسٔط 101
102. Procedure
create or replace procedure circle_proc( p_id number)
is
v_r number;
begin
v_r := getR( p_id );
dbms_output.put_line('Muhit : '||(2*3.14*v_r));
dbms_output.put_line('Area : '||(v_r*v_r*3.14));
end ;
) Function ( ) إنىv_r ( قًُا بئعُاد قًٍت انًخغٍش اندذٌذ
) Example 30 ( ًانغابقت انخً قًُا بخعشٌفٓا ف
SQL - PL دسٔط 102
103. Function
create or replace function getDid (p_eid number)
return number
is
v_did number;
begin
select department_id into v_did
from employees
where employee_id=p_eid;
return v_did;
exception
when no_data_found then
return 0;
end getDid;
SQL - PL دسٔط 103
104. Procedure
create or replace procedure updateEmpSal(p_eid number)
is
v_did number;
begin
v_did :=getDid(p_eid);
if v_did!=0 then
if(v_did=50) then
update employees set salary=salary*1.5 where employee_id=p_eid;
else
update employees set salary=salary*1.2 where employee_id=p_eid;
end if;
else
dbms_output.put_line('Employee not found');
end if;
end updateEmpSal;
SQL - PL دسٔط 104