際際滷

際際滷Share a Scribd company logo
Sad脹qov Xyyam
Prosedurlar, Funksiyalar v Paketler
http://www.azeroug.org
http://www.azeroug.org
2/
z端m haqqda
nb, 14 Sentyabr 2013
Sad脹qov Xyyam
Azerfon LLC
Billing and VAS Engineer
SQL and PL/SQL Trainer
Sad脹gov Xyyam
http://www.azeroug.org
3/
PL/SQL
nb, 14 Sentyabr 2013 Sad脹gov Xyyam
http://www.azeroug.org
4/
Procedurlar v Functionlar ndi ?
nb, 14 Sentyabr 2013
 PL/SQL bloklar
 PL/SQL subprogram adlan脹rlar
 Anonym bloklar kimi blok strukturlar脹 var
 K旦n端ll端 deklarativ b旦lm (DECLARE -siz)
 Mcburi ilyn b旦lm
 Istisnalar idar etmk 端c端n k旦n端ll端 b旦lm
Sad脹gov Xyyam
http://www.azeroug.org
5/
Anonym bloklar脹n ve Subprogramlar脹n
frqi nedi ?
nb, 14 Sentyabr 2013 Sad脹gov Xyyam
http://www.azeroug.org
6/
Anonym bloklar脹n ve Subprogramlar脹n
frqi nedi ?
nb, 14 Sentyabr 2013 Sad脹gov Xyyam
http://www.azeroug.org
7/
Subprogramlarin 端st端nl端klri
nb, 14 Sentyabr 2013
 Easy maintenance
 Code Reuse
 Improved data security
 Improved performance
 Improved code clarity
Sad脹gov Xyyam
http://www.azeroug.org
8/
Procedure
nb, 14 Sentyabr 2013 Sad脹gov Xyyam
CREATE [OR REPLACE] PROCEDURE procedure_name
[(argument1 [mode1] datatype1,
argument2 [mode2] datatype2,
. . .)]
[ AUTHID DEFINER | CURRENT_USER ]
IS|AS
procedure_body;
http://www.azeroug.org
9/
Procedure
nb, 14 Sentyabr 2013 Sad脹gov Xyyam
...
CREATE TABLE dept AS SELECT * FROM departments;
CREATE PROCEDURE add_dept IS
v_dept_id dept.department_id%TYPE;
v_dept_name dept.department_name%TYPE;
BEGIN
v_dept_id:=280;
v_dept_name:='ST-Curriculum';
INSERT INTO dept(department_id,department_name)
VALUES(v_dept_id,v_dept_name);
DBMS_OUTPUT.PUT_LINE(' Inserted '|| SQL%ROWCOUNT
||' row ');
END;
http://www.azeroug.org
10/
Procedure parameterler
nb, 14 Sentyabr 2013
 Formal v Faktiki
 聴N  read-only
 OUT  write-only
 聴N OUT  read-write
Sad脹gov Xyyam
http://www.azeroug.org
11/
Procedure
nb, 14 Sentyabr 2013 Sad脹gov Xyyam
http://www.azeroug.org
12/
Invoking Procedures
nb, 14 Sentyabr 2013
Haradan proceduru execute ede bilersiz:
 Anonim blok
 Baqa procedur
 Applicationdan
 Oracle Job
 Third-party application
Note: proceduru SQL de istifade etmek olmaz.
Sad脹gov Xyyam
http://www.azeroug.org
13/
Notation by name, by position
nb, 14 Sentyabr 2013 Sad脹gov Xyyam
http://www.azeroug.org
14/
Function
nb, 14 Sentyabr 2013 Sad脹gov Xyyam
CREATE [OR REPLACE] FUNCTION function_name
[(argument1 [mode1] datatype1,
argument2 [mode2] datatype2,
. . .)]
RETURN datatype
[ AUTHID [ DEFINER | CURRENT_USER ]]
IS|AS
function_body;
http://www.azeroug.org
15/
Function
nb, 14 Sentyabr 2013 Sad脹gov Xyyam
CREATE FUNCTION check_sal RETURN Boolean IS
v_dept_id employees.department_id%TYPE;
v_empno employees.employee_id%TYPE;
v_sal employees.salary%TYPE;
v_avg_sal employees.salary%TYPE;
BEGIN
v_empno:=205;
SELECT salary,department_id INTO v_sal,v_dept_id FROM employees
WHERE employee_id= v_empno;
SELECT avg(salary) INTO v_avg_sal FROM employees WHERE
department_id=v_dept_id;
IF v_sal > v_avg_sal THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN NULL;
END;
http://www.azeroug.org
16/
Invoking a Function
nb, 14 Sentyabr 2013 Sad脹gov Xyyam
BEGIN
IF (check_sal IS NULL) THEN
DBMS_OUTPUT.PUT_LINE('The function returned
NULL due to exception');
ELSIF (check_sal) THEN
DBMS_OUTPUT.PUT_LINE('Salary > average');
ELSE
DBMS_OUTPUT.PUT_LINE('Salary < average');
END IF;
END;
/
http://www.azeroug.org
17/
Function
nb, 14 Sentyabr 2013 Sad脹gov Xyyam
DROP FUNCTION check_sal;
CREATE FUNCTION check_sal(p_empno employees.employee_id%TYPE)
RETURN Boolean IS
v_dept_id employees.department_id%TYPE;
v_sal employees.salary%TYPE;
v_avg_sal employees.salary%TYPE;
BEGIN
SELECT salary,department_id INTO v_sal,v_dept_id FROM employees
WHERE employee_id=p_empno;
SELECT avg(salary) INTO v_avg_sal FROM employees
WHERE department_id=v_dept_id;
IF v_sal > v_avg_sal THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
EXCEPTION
...
http://www.azeroug.org
18/
Invoking Function
nb, 14 Sentyabr 2013 Sad脹gov Xyyam
BEGIN
DBMS_OUTPUT.PUT_LINE('Checking for employee with id 205');
IF (check_sal(205) IS NULL) THEN
DBMS_OUTPUT.PUT_LINE('The function returned
NULL due to exception');
ELSIF (check_sal(205)) THEN
DBMS_OUTPUT.PUT_LINE('Salary > average');
ELSE
DBMS_OUTPUT.PUT_LINE('Salary < average');
END IF;
DBMS_OUTPUT.PUT_LINE('Checking for employee with id 70');
IF (check_sal(70) IS NULL) THEN
DBMS_OUTPUT.PUT_LINE('The function returned
NULL due to exception');
ELSIF (check_sal(70)) THEN
...
END IF;
END;
/
http://www.azeroug.org
19/
Restrictions on User-Defined Functions
nb, 14 Sentyabr 2013
Query v DML da ilnilen funkciyada olmaz:
 OUT yada IN OUT parametler
 Commit yada roll back
 create a savepoint or roll back to a savepoint,
 alter the session or the system.
 DDL
 Eyni tablicada deyiiklik etmek
Amma
 INSERT etmek (from SELECT statement)
 INSERT from a subquery in a DML statement
Sad脹gov Xyyam
http://www.azeroug.org
20/
Package Architecture
nb, 14 Sentyabr 2013 Sad脹gov Xyyam
http://www.azeroug.org
21/
Package spec
nb, 14 Sentyabr 2013 Sad脹gov Xyyam
http://www.azeroug.org
22/
Package body
nb, 14 Sentyabr 2013 Sad脹gov Xyyam
http://www.azeroug.org
23/
Example
nb, 14 Sentyabr 2013 Sad脹gov Xyyam
http://www.azeroug.org
24/
Execute
nb, 14 Sentyabr 2013 Sad脹gov Xyyam
http://www.azeroug.org
25/
Advantages of PL/SQL Packages
nb, 14 Sentyabr 2013
 Modularity
 Easier Application Design
 Information Hiding
 Added Functionality
 Better Performance
Sad脹gov Xyyam
http://www.azeroug.org
26/
Product-Specific Packages
nb, 14 Sentyabr 2013
 DBMS_ALERT
 DBMS_OUTPUT
 DBMS_PIPE
 UTL_FILE
 UTL_HTTP
 UTL_SMTP
Sad脹gov Xyyam
http://www.azeroug.org
27/
Drop
nb, 14 Sentyabr 2013
 Procedures
 DROP PROCEDURE procedure_name
 Function
 DROP FUNCTION function_name
 Package
 DROP PACKAGE package_name
Sad脹gov Xyyam
http://www.azeroug.org
28/
Data dictionary
nb, 14 Sentyabr 2013
 user_procedures
 OBJECT_TYPE=PROCEDURE
 OBJECT_TYPE=FUNCTION
 OBJECT_TYPE=PACKAGE
 user_source
 TYPE=PROCEDURE
 TYPE=FUNCTION
 TYPE=PACKAGE
 user_errors
Sad脹gov Xyyam
http://www.azeroug.org
29/
Sizin suallar脹n脹z
nb, 14 Sentyabr 2013 Sad脹gov Xyyam
http://www.azeroug.org
30/
Son
nb, 14 Sentyabr 2013 Sad脹gov Xyyam
Sad脹gov Xyyam
khsadigov@azerfon.az
Mob: (070) 201 - 13 - 93
Skype: khsadigov
Ad

Recommended

弍亰仂 仆仂于 亳亰仄亠仆亠仆亳亶 仆舒仍仂亞仂于仂亞仂 亰舒从仂仆仂亟舒亠仍于舒 2014 亞.
弍亰仂 仆仂于 亳亰仄亠仆亠仆亳亶 仆舒仍仂亞仂于仂亞仂 亰舒从仂仆仂亟舒亠仍于舒 2014 亞.
束 亅亂个損
Academic Skills For International Trade & Transport
Academic Skills For International Trade & Transport
Dawn Kay
Lbs client-lunch&learn
Lbs client-lunch&learn
Engauge
Picture storyboard of soap trailor
Picture storyboard of soap trailor
akabucko
仍舒仆亳仂于舒仆亳亠 舒弍仂 于 从仂仆于亠亞亠仆仆仂亶 亠亟舒从亳亳
仍舒仆亳仂于舒仆亳亠 舒弍仂 于 从仂仆于亠亞亠仆仆仂亶 亠亟舒从亳亳
Faculty of Media Communications
2024 Trend Updates: What Really Works In SEO & Content Marketing
2024 Trend Updates: What Really Works In SEO & Content Marketing
Search Engine Journal
Storytelling For The Web: Integrate Storytelling in your Design Process
Storytelling For The Web: Integrate Storytelling in your Design Process
Chiara Aliotta
Artificial Intelligence, Data and Competition SCHREPEL June 2024 OECD dis...
Artificial Intelligence, Data and Competition SCHREPEL June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
2024 State of Marketing Report by Hubspot
2024 State of Marketing Report by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius

More Related Content

Featured (20)

How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
2024 State of Marketing Report by Hubspot
2024 State of Marketing Report by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
2024 State of Marketing Report by Hubspot
2024 State of Marketing Report by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius

Azer oug sadigov xayyam

Editor's Notes

  • #3: Sizin suallar脹n脹z
  • #4: Tkk端rlr AZEROUG