03-01_en_Introduction to PL SQL
-
Upload
sevensecondss -
Category
Documents
-
view
218 -
download
0
description
Transcript of 03-01_en_Introduction to PL SQL
DataBase Logic in Business
ApplicationsIntroduction to Oracle PL/SQL
Al.I. Cuza University of Iași Faculty of Economics and Business AdministrationDepartment of Accounting, Information Systems and Statistics
By Marin Fotache & Co.
The Need for CodeSQL is the universal data language
(“intergalactic dataspeak” M. Stonebraker)SQL acceptance is mainly due to its
“declarativity”, i.e. you don’t need to code anything, but to just specifiy what data you neeed
For a while (SQL-89 and SQL-92), SQL was purely declarative
In SQL:1999 standard PSM (Persistent Stored Modules) was added
Real-world applications require procedures performing tasks not possible using only SQL statements (UPDATE, SELECT, …)
SQL Procedural Extensions
Main database servers implemented procedural SQL extensions (programming languages for databases) since early 1990s
Procedural extensions used to be very different in syntax; in recent years similarities have increased among languages
Every DB server has one or more programming languages for writing/developing code to be launched on the DB server – stored procedures
Stored procedures (procedures, functions, packages, triggers) are part of the database
Examples of programming languages available in some DB servers
Oracle: PL/SQL, Java, C, C++, C#, Visual Basic, COBOL
IBM DB2: SQL PL, C++, COBOL, Fortran, Java, Perl, PHP, Python, Ruby/Ruby on Rails, REXX, C#, VB .NET and other .NET languages
Microsoft SQL Server: Transact SQL (T-SQL), C# VB .NET and other .NET languages
PostgreSQL: PL/Java (Java), PL/PHP (PHP), PL/Py (Python), PL/R (R), PL/Ruby (Ruby), PL/Scheme (Scheme), PL/sh (Unix shell)
PL/SQL
The main language for programming Oracle database applications
Our main focus for this semesterEasy to understand, even by non-
programmersDoes not provide the richness of other
languages of C#, Java, Python, C++ etc. because it addressed maily the data processing in Oracle
Simplicity makes it very easy-to-learn and stable
Oracle PL/SQL Code
PL/SQL code is organized in blocksAnonymous blocks are stored outside
the database in text (usually .sql) filesNamed blocks reside with the database
– stored procedures: ◦Procedures◦Functions◦Packages
User-defined packages System packages
◦Triggers
Useful Resources on Basic PL/SQL
Getting started PL/SQL tutorialhttp://www.way2tutorial.com/plsql/tutorial.phpPL/SQL Tutorial (TutorialsPoint)http://www.tutorialspoint.com/plsql/index.htmpl/sql tutorialhttp://plsql-tutorial.comPL/SQL Tutorialhttp://www.plsqltutorial.comFotache et. 2003, Fotache 2009 (in Romanian)
- uploaded on FEAA portal)An older video-tutorial (in Romanian):
03_Primele blocuri PL SQL.mp4http://1drv.ms/1yX0l61
First PL/SQL topics in recommended tutorials
Block StructureData TypesVariable & ScopeConstant DeclarationCommentsConditional ControlLoop StatementSequential ControlCase StatementFunctionsProcedures
Video-tutorials on Basic PL/SQL PL1 PL SQL Tutorial Introduction to PL SQL programminghttps://www.youtube.com/watch?v=Wvl_zDdvUuE PL2 PL SQL Tutorial Declaration Section Theory)https://www.youtube.com/watch?v=Wf-OoqxG4uE&spfreload=10 PL3 PL SQL Tutorial Declaration Section Hands On) https://www.youtube.com/watch?v=C4tEDxg_EiY PL4 PL SQL Tutorial Displaying Strings and Assignment
Theory)https://www.youtube.com/watch?v=ltZhhnnfp2o PL5 PL SQL Tutorial DBMS OUTPUT and Assignment Hands On)https://www.youtube.com/watch?v=LTEoCZhmigI PL6 PL SQL Tutorial Programs to Try based on PL1 PL5https://www.youtube.com/watch?v=IqlGhAWOwvk&spfreload=10 PL7 PL SQL Tutorial SELECT statements in PL SQL blocks
Theory)https://www.youtube.com/watch?v=JX_fg0MUDIU&spfreload=10
Video-tutorials on Basic PL/SQL (cont.)
PL8 PL SQL Tutorial Select statements in a PL SQL block Hands On)
https://www.youtube.com/watch?v=-OPoHSArODE&spfreload=10 PL9 PL SQL Tutorial DML and TCL statements Theory)https://www.youtube.com/watch?v=T7SJcoNhRvE PL10 PL SQL Tutorial DML and TCL statements Hands On)https://www.youtube.com/watch?v=Q76d25yRlxs PL11 PL SQL Tutorial IF statements in PL SQL Theory)https://www.youtube.com/watch?v=kHCUitCcHSE&spfreload=10 PL12 PL SQL Tutorial IF statements in PL SQL Hands On)https://www.youtube.com/watch?v=fd1ZvJpx458&spfreload=10 PL13 PL SQL Tutorial CASE Statement in PL SQL Theory)https://www.youtube.com/watch?v=w3ERdbPcXZo&spfreload=10 PL14 PL SQL Tutorial CASE Statement in PL SQL Hands On)https://www.youtube.com/watch?v=uPDZlBte18M&spfreload=10 PL15 PL SQL Tutorial LOOP END LOOP statement Theory)https://www.youtube.com/watch?v=ZYFwp9VQC6A&spfreload=10
Video-tutorials on Basic PL/SQL (cont.)
PL16 PL SQL Tutorial Loop Statement Hands On))https://www.youtube.com/watch?v=IgJI1Q_VxZo PL17 PL SQL Tutorial WHILE LOOP construct Theory)https://www.youtube.com/watch?v=00ZCPpP3ZrA&spfreload=10 PL18 PL SQL Tutorial While Loop Statement Hands On)https://www.youtube.com/watch?v=zP1Yfj_oBN0 PL19 PL SQL Tutorial For LOOP construct Theory)https://www.youtube.com/watch?v=SrSrzwNjI40 PL20 PLSQL Tutorial FOR LOOP in PL SQL Hands On)https://www.youtube.com/watch?v=gVWHt0qD9ig
See also video-tutorials from PLS-1 to PLS-8 in the playlist:https://www.youtube.com/playlist?list=PL3245012E0631F7AE&spfreload=10