SQL & PL/SQL Hands on Oracle 11g DB Enterprise Edition
|
|
- Esmond Mason
- 7 years ago
- Views:
Transcription
1 SQL & PL/SQL Hands on Oracle 11g DB Enterprise Edition Writtent By: Abaid ur Rehman Project Manager ICM Software House
2 Contents SQL(Structured Query Languages)... 4 DCL(Data Control Languages)... 4 DDL(Data Definition Language)... 4 DML (Data Manipulation Language)... 4 TCL (Transaction Control Language)... 6 Functions... 6 Single Row Functions... 6 Group Functions... 7 Having Clause... 7 Joins... 8 Sub-Query... 8 Views... 8 Sequence... 8 Synonym... 8 Index... 8 Constraints... 9 Security... 9 PL/SQL NOTES Block Variable DML in PL/SQL Flow Control If condition Loops Exceptions Cursor Cursor for Loop Procedures IN PARAMETER OUT PARAMETER Page 2 of 14
3 IN OUT PARAMETER Functions CALL FUNCTION TRIGGER Page 3 of 14
4 SQL(Structured Query Languages) Standard Languages for Databases ANSI (American National Standard Institute) Standard Used to Interact / communicate with database Once Learned user every where SQL is re-categorized in sub-languages according to tasks: DCL(Data Control Languages) Used to Control Database Security Create User, Change Password, Assign Rights, snatch rights CREATE USER, GRANT RIGHTS, REVOKE RIGHTS CREATE USER You can create new users by this command and assign password to it. CREATE USER SCOTT IDENTIFIED BY TIGER; ALTER USER ALTER USER SCOTT IDENTIFIED BY TIGERS; GRANT RIGHTS GRANT RESOURCE, CONNECT, CREATE TABLE, CREATE SESSION,DBA TO SCOTT; REVOKE RIGHTS REVOKE CREATE SESSION FROM SCOTT; DDL(Data Definition Language) Used to interact with database Define objects, change objects, remove objects CREATE, ALTER, DROP CREATE TABLE CREATE TABLE EMP( EMPNO NUMBER(10) primary key, ENAME VARCHAR2(30), SAL NUMBER(12,2), COMM NUMBER(12,2), DEPTNO NUMBER(10) ); ALTER TABLE ALTER TABLE EMP ADD MGR NUMBER(5); ALTER TABLE EMP MODIFY ENAME VARCHAR2(50); DROP TABLE DROP TABLE EMP; DML (Data Manipulation Language) Used to interact with tables Store new records, change records, remove records, select data from tables. INSERT,UPDATE, DELETE, SELECT INSERT INSERT INTO EMP VALUES (1, ASAD,5000,500,7787,10); Page 4 of 14
5 INSERT INTO EMP(EMPNO,ENAME,SAL) VALUES (2, ALEEM,7000); INSERT INTO EMP(EMPNO,ENAME,SAL) VALUES (&no, &name,&salary); UPDATE UPDATE EMP SET MGR = 7767; UPDATE EMP SET COMM = 200 WHERE COMM IS NULL; DELETE DELETE ; DELETE WHERE SAL < 2000; SELECT ; SELECT ENAME,JOB,SAL ; SELECT ENAME EMPLOYEE,JOB DESIGNATION, SAL SALARY ; SELECT ENAME,JOB,SAL,SAL*.2 BONUS ; SELECT The name of Employee is ENAME ; ORDER BY ENAME; ORDER BY 2; ORDER BY JOB,DEPTNO; ORDER BY JOB DESC,DEPTNO; WHERE SAL < 3000; WHERE SAL > 5000; WHERE DEPTNO = 20; WHERE DEPTNO IN (10,30,40); WHERE SAL BETWEEN 2000 AND 5000; WHERE ENAME LIKE A%; Page 5 of 14
6 WHERE ENAME LIKE %ALI% ; WHERE JOB = MANAGER AND SAL < 3000; WHERE JOB = CLERK OR SAL > 2000; WHERE COMM IS NOT NULL; TCL (Transaction Control Language) Used to control Transactions COMMIT, ROLLBACK, SAVEPOINT COMMIT; ROLLBACK; SAVEPOINT; Functions Single Row Functions CHARACTER FUNCTIONS UPPER SELECT UPPER(ENAME) ; LOWER SELECT LOWER(ENAME ; INITCAP SELECT INITCAP(ENAME) ; LENGTH SELECT LENGTH(ENAME) ; SUBSTR SELECT SUBSTR(ENAME,2,3) ; INSTR SELECT INSTR(ENAME, A ) ; LPAD SELECT LPAD(ENAME,10, ~ ) ; RPAD SELECT RPAD(ENAME,10, ~ ) ; NUMERIC FUNCTIONS ROUND SELECT ROUND( ,2) FROM DUAL; SELECT ROUND( ,2) FROM DUAL; TRUNC SELECT TRUNC( ,2) FROM DUAL; SELECT TRUNC( ,2) FROM DUAL; MOD SELECT MOD(15,4) FROM DUAL; Page 6 of 14
7 DATE FUNCTIONS ADD_MONTHS SELECT ADD_MONTHS(HIREDATE,10) ; MONTHS_BETWEEN SELECT MONTHS_BETWEEN(SYSDATE,HIREDATE) ; LAST_DAY SELECT LAST_DAY(SYSDATE) FROM DUAL; CONVERSION FUNCTIONS TO_CHAR SELECT TO_CHAR(SYSDATE, DD-MM-RR HH:MI ) FROM DUAL; SELECT TO_CHAR(SAL, 999, ) ; TO_NUMBER SELECT TO_NUMBER(SUBSTR(HIREDATE,1,2)) ; TO_DATE SELECT TO_DATE( , MM-DD-YY ) FROM DUAL; OTHER FUNCTIONS NVL SELECT NVL(SAL,100) ; DECODE SELECT DECODE(JOB, MANAGER,SAL*.2, CLERK,SAL*.1,SAL*.05) ; Group Functions SUM SELECT SUM(SAL) ; SELECT SUM(SAL) GROUP BY DEPTNO; SELECT SUN(SAL) GROUP BY JOB; AVG SELECT AVG(SAL) GROUP BY DEPTNO; MIN MAX SELECT MIN(SAL) ; SELECT MAX(SAL) ; COUNT SELECT COUNT(*) ; SELECT COUNT(*) GROUP BY JOB; Having Clause SELECT SUM(SAL) GROUP BY JOB HAVING SUM(SAL) > 5000; Page 7 of 14
8 Joins INNER JOIN SELECT DNAME,ENAME,JOB,SAL,DEPT WHERE EMP.DEPTNO = DEPT.DEPTNO; OUTER JOIN SELECT DNAME,ENAME,JOB,SAL,DEPT WHERE EMP.DEPTNO(+) = DEPT.DEPTNO; SELF JOIN SELECT A.ENAME MANAGER,A.EMPNO MANAGERID, B.ENAME SUBORDINATE,B.EMPNO SUBORDINATEID A,EMP B WHERE A.EMPNO = B.MGR; Sub-Query Views Sequence WHERE SAL < (SELECT SAL WHERE ENAME = SMITH ); CREATE VIEW ORG_EMP_V AS SELECT A.ENAME MANAGER,A.EMPNO MANAGERID, B.ENAME SUBORDINATE,B.EMPNO SUBORDINATEID A,EMP B WHERE A.EMPNO = B.MGR; CREATE SEQUENCE SEQ_EMP1 START WITH 1 INCREMENT BY 1 NOCACHE; CREATE SEQJUENCE SEQ_EMP2 START WITH 100 INCREMENT BY 1 MINVALUE 90 MAXVALUE 150 CYCLE; SELECT SEQ_EMP1.NEXTVAL FROM DUAL; SELECT SEQ_EMP1.CURRVAL FROM DUAL; Synonym Index CREATE SYNONYM E FOR EMP; CREATE INDEX IDX_EMP_ENAME ON EMP(ENAME); Page 8 of 14
9 Constraints PRIMARY KEY UNIQUE NOT NULL FOREIGN KEY CHECK CREATE TABLE DEPT( DEPTNO NUMBER(10) PRIMARY KEY, DNAME VARCHAR2(100) NOT NULL); CREATE TABLE EMP( EMPNO NUMBER(10) PRIMARY KEY, ENAME VARCHAR2(100) NOT NULL, PHONE VARCHAR2(15) UNIQUE, SAL NUMBER(15,2), DEPTNO NUMBER(10), CHECK (SAL < 3000), FOREIGN KEY (DEPTNO) REFERENCES EMP); Security CREATE ROLE R1 IDENTIFIED BY R1; GRANT SELECT ON EMP TO R1; GRANT UPDATE,DELETE ON EMP TO R1; GRANT R1 TO SCOTT; Page 9 of 14
10 PL/SQL NOTES Block Declaration Section (Declare all variable, constants, cursors, exceptions) Executable Section (All executable PL/SQL Commands, call other procedures,dml) Exception Section (Tran Run time errors and give your own messages) Variable PL/SQL Variable Simple Variables Scalar variable Composite variable Declare X number(10); V_EMPNO EMP.EMPNO%TYPE; V_EMP EMP%ROWTYPE; SELECT * INTO V_EMP WHERE EMPNO = 7788; DBMS_OUTPUT.PUT_LINE(V_EMP.ENAME); DML in PL/SQL SELECT INSERT UPDATE DELETE Declare X number(10); V_EMPNO EMP.EMPNO%TYPE; V_EMP EMP%ROWTYPE; SELECT * INTO V_EMP WHERE EMPNO = 7788; DBMS_OUTPUT.PUT_LINE(V_EMP.ENAME); INSERT INTO EMP1 (EMPNO,ENAME,JOB,SAL) VALUES (V_EMP.EMPNO,V_EMP.ENAME,V_EMP.JOB,V_EMP.SAL); UPDATE EMP1 SET SAL = V_EMP.SAL WHERE EMPNO = V_EMP.EMPNO; DELETE 1 WHERE DEPTNO = V_EMP.DEPTNO; Page 10 of 14
11 Flow Control If condition DECLARE V_EMP EMP%ROWTYPE; SELECT * INTO V_EMP WHERE ENAME = SCOTT ; IF V_EMP.SAL < 3000 THEN DBMS_OUTPUT.PUT_LINE( A ); ELSIF V_EMP.SAL < 2000 THEN DBMS_OUTPUT.PUT_LINE( B ); ELSIF V_EMP.SAL < 1000 THEN DBMS_OUTPUT.PUT_LINE( C ); ELSE DBMS_OUTPUT.PUT_LINE( D ); END IF; Loops Basic loop DECLARE X NUMBER := 1; LOOP X := X +1 ; DBMS_OUTPUT.PUT_LINE(X); EXIT WHEN X = 10; END LOOP; While loop DECLARE X NUMBER := 1; WHILE X < 10 LOOP X := X +1; DBMS_OUTPUT.PUT_LINE(X); END LOOP; For loop FOR I IN LOOP DBMS_OUTPUT.PUT_LINE(I): END LOOP; Page 11 of 14
12 Exceptions DECLARE V_EMP EMP%ROWTYPE; SELECT * INTO V_EMP WHERE DEPTNO = 1; DBMS_OUTPUT.PUT_LINE(V_EMP.ENAME); EXCEPTION WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.PUT_LINE( SORRY, NO DATA FOUND ); WHEN TOO_MANY_ROWS THEN DBMS_OUTPUT.PUT_LINE( SORRY, MANY RECORDS FOUND ); Cursor DECLARE V_EMP EMP%ROWTYPE; CURSOR C_EMP IS SELECT * INTO V_EMP WHERE DEPTNO = 10; OPEN C_EMP; LOOP FETCH C_EMP INTO V_EMP; EXIT WHEN C_EMP%NOTFOUND; DBMS_OUTPUT.PUT_LINE(V_EMP.ENAME); END LOOP; Cursor for Loop FOR I IN () LOOP DBMS_OUTPUT.PUT_LINE(I.ENAME); END LOOP; Page 12 of 14
13 Procedures IN PARAMETER CREATE OR REPLACE PROCEDURE P_EMP(P_EMPNO NUMBER) IS V_ENAME EMP.ENAME%TYPE; SELECT ENAME INTO V_ENAME WHERE EMPNO = P_EMPNO; DBMS_OUTPUT.PUT_LINE(V_ENAME); Call Procedure P_EMP(100); OUT PARAMETER CREATE OR REPLACE PROCEDURE P_EMP(P_EMPNO IN NUMBER, P_ENAME OUT VARCHAR2) IS SELECT ENAME INTO P_ENAME WHERE EMPNO = P_EMPNO; Call Procedure DECLARE X NUMBER; P_EMP(100,X); IN OUT PARAMETER CREATE OR REPLACE PROCEDURE P_EMP(P_EMPNO_SAL IN OUT NUMBER) IS SELECT SAL INTO P_EMPNO_SAL WHERE EMPNO = P_EMPNO_SAL; DECLARE X NUMBER := 100; P_EMP(X); Page 13 of 14
14 Functions CREATE OR REPLACE FUNCTION F_EMP(P_EMPNO IN NUMBER) RETURN VARCHAR2 IS V_EMP EMP%ROWTYPE; SELECT ENAME INTO P_ENAME WHERE EMPNO = P_EMPNO; CALL FUNCTION SELECT F_EMP(7788) FROM DUAL; TRIGGER CREATE OR REPLACE TRIGGER INS_EMP AFTER INSERT OR DELETE OR UPDATE OF SAL ON EMP REFERENCES NEW AS N OLD AS O FOR EACH ROW IF INSERTING THEN INSERT INTO EMP1(EMPNO,ENAME,JOB) VALUES (: ELSIF UPDATING THEN UPDATE EMP1 SET SAL = :N.SAL WHERE EMPNO = :O.EMPNO; ELSIF DELETING THEN DELETE WHERE EMPNO = :O.EMPNO; END IF; Page 14 of 14
Oracle Database: SQL and PL/SQL Fundamentals
Oracle University Contact Us: 1.800.529.0165 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This course is designed to deliver the fundamentals of SQL and PL/SQL along
More informationProgramming with SQL
Unit 43: Programming with SQL Learning Outcomes A candidate following a programme of learning leading to this unit will be able to: Create queries to retrieve information from relational databases using
More informationOracle SQL. Course Summary. Duration. Objectives
Oracle SQL Course Summary Identify the major structural components of the Oracle Database 11g Create reports of aggregated data Write SELECT statements that include queries Retrieve row and column data
More informationOracle Database: SQL and PL/SQL Fundamentals NEW
Oracle University Contact Us: + 38516306373 Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training delivers the
More informationOracle Database: SQL and PL/SQL Fundamentals
Oracle University Contact Us: +966 12 739 894 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training is designed to
More informationOracle Database 12c: Introduction to SQL Ed 1.1
Oracle University Contact Us: 1.800.529.0165 Oracle Database 12c: Introduction to SQL Ed 1.1 Duration: 5 Days What you will learn This Oracle Database: Introduction to SQL training helps you write subqueries,
More informationOracle Database 11g SQL
AO3 - Version: 2 19 June 2016 Oracle Database 11g SQL Oracle Database 11g SQL AO3 - Version: 2 3 days Course Description: This course provides the essential SQL skills that allow developers to write queries
More informationOracle Database: Introduction to SQL
Oracle University Contact Us: +381 11 2016811 Oracle Database: Introduction to SQL Duration: 5 Days What you will learn Understanding the basic concepts of relational databases ensure refined code by developers.
More informationDuration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff
D80198GC10 Oracle Database 12c SQL and Fundamentals Summary Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff Level Professional Delivery Method Instructor-led
More informationOracle Database: Introduction to SQL
Oracle University Contact Us: 1.800.529.0165 Oracle Database: Introduction to SQL Duration: 5 Days What you will learn View a newer version of this course This Oracle Database: Introduction to SQL training
More informationOracle Database: SQL and PL/SQL Fundamentals NEW
Oracle University Contact Us: 001-855-844-3881 & 001-800-514-06-97 Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals
More informationDECLARATION SECTION. BODY STATEMENTS... Required
1 EXCEPTION DECLARATION SECTION Optional BODY STATEMENTS... Required STATEMENTS Optional The above Construction is called PL/SQL BLOCK DATATYPES 2 Binary Integer (-2 **31-1,2**31+1) signed integer fastest
More informationOracle Database: Introduction to SQL
Oracle University Contact Us: 1.800.529.0165 Oracle Database: Introduction to SQL Duration: 5 Days What you will learn This Oracle Database: Introduction to SQL training teaches you how to write subqueries,
More informationOracle PL/SQL Best Practices
Achieving PL/SQL Excellence Oracle PL/SQL Best Practices Steven Feuerstein Me - www.stevenfeuerstein.com PL/Solutions - www.plsolutions.com RevealNet - www.revealnet.com 7/5/99 Copyright 1999 Steven Feuerstein
More informationDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING DR.NAVALAR NEDUNCHEZHIAYN COLLEGE OF ENGINEERING, THOLUDUR-606303, CUDDALORE DIST.
CS2258-DATABASE MANAGEMENT SYSTEM LABORATORY LABORATORY MANUAL FOR IV SEMESTER B. E / CSE & IT (FOR PRIVATE CIRCULATION ONLY) ACADEMIC YEAR: 2013 2014 (EVEN) ANNA UNIVERSITY, CHENNAI DEPARTMENT OF COMPUTER
More informationTraining Guide. PL/SQL for Beginners. Workbook
An Training Guide PL/SQL for Beginners Workbook Workbook This workbook should be worked through with the associated Training Guide, PL/SQL for Beginners. Each section of the workbook corresponds to a section
More informationRDBMS Using Oracle. Lecture Week 7 Introduction to Oracle 9i SQL Last Lecture. kamran.munir@gmail.com. Joining Tables
RDBMS Using Oracle Lecture Week 7 Introduction to Oracle 9i SQL Last Lecture Joining Tables Multiple Table Queries Simple Joins Complex Joins Cartesian Joins Outer Joins Multi table Joins Other Multiple
More informationObjectives. Oracle SQL and SQL*PLus. Database Objects. What is a Sequence?
Oracle SQL and SQL*PLus Lesson 12: Other Database Objects Objectives After completing this lesson, you should be able to do the following: Describe some database objects and their uses Create, maintain,
More informationInstant SQL Programming
Instant SQL Programming Joe Celko Wrox Press Ltd. INSTANT Table of Contents Introduction 1 What Can SQL Do for Me? 2 Who Should Use This Book? 2 How To Use This Book 3 What You Should Know 3 Conventions
More informationNetezza SQL Class Outline
Netezza SQL Class Outline CoffingDW education has been customized for every customer for the past 20 years. Our classes can be taught either on site or remotely via the internet. Education Contact: John
More informationDATABASE DESIGN & PROGRAMMING WITH SQL COURSE CODE: 5324
DATABASE DESIGN & PROGRAMMING WITH SQL COURSE CODE: 5324 COURSE DESCRIPTION: This curriculum is geared to meet the learning needs of a variety of students, from those interested in gaining broad exposure
More informationAggregating Data Using Group Functions
Aggregating Data Using Group Functions Objectives Capter 5 After completing this lesson, you should be able to do the following: Identify the available group functions Describe the use of group functions
More informationConversion Functions
Conversion Functions Conversion functions convert a value from one datatype to another. Generally, the form of the function names follows the convention datatype TO datatype. The first datatype is the
More informationDatabase programming 20/08/2015. DBprog news. Outline. Motivation for DB programming. Using SQL queries in a program. Using SQL queries in a program
DBprog news Database programming http://eric.univ-lyon2.fr/~jdarmont/?page_id=451 M1 Informatique Year 2015-2016 Jérôme Darmont http://eric.univ-lyon2.fr/~jdarmont/ http://eric.univ-lyon2.fr/~jdarmont/?feed=rss2
More informationExamine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25)
Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) Which three statements inserts a row into the table? A. INSERT INTO employees
More informationOracle 10g PL/SQL Training
Oracle 10g PL/SQL Training Course Number: ORCL PS01 Length: 3 Day(s) Certification Exam This course will help you prepare for the following exams: 1Z0 042 1Z0 043 Course Overview PL/SQL is Oracle's Procedural
More informationSubqueries Chapter 6
Subqueries Chapter 6 Objectives After completing this lesson, you should be able to do the follovving: Describe the types of problems that subqueries can solve Define subqueries List the types of subqueries
More information2. Which of the following declarations is invalid? Mark for Review (1) Points
Mid Term Exam Semester 1 - Part 1 1. 1. Null 2. False 3. True 4. 0 Which of the above can be assigned to a Boolean variable? 2 and 3 2, 3 and 4 1, 2 and 3 (*) 1, 2, 3 and 4 2. Which of the following declarations
More informationDatabase Programming with PL/SQL: Learning Objectives
Database Programming with PL/SQL: Learning Objectives This course covers PL/SQL, a procedural language extension to SQL. Through an innovative project-based approach, students learn procedural logic constructs
More informationOverview of PL/SQL. About PL/SQL
Overview of PL/SQL About PL/SQL PL/SQL is an extension to SQL with design features of programming languages. Data manipulation and query statements of SQL are included within procedural units of code.
More informationOracle/SQL Tutorial 1
Oracle/SQL Tutorial 1 Michael Gertz Database and Information Systems Group Department of Computer Science University of California, Davis gertz@cs.ucdavis.edu http://www.db.cs.ucdavis.edu This Oracle/SQL
More informationHow To Name A Program In Apl/Sql
PL/SQL This section will provide a basic understanding of PL/SQL. This document will briefly cover the main concepts behind PL/SQL and provide brief examples illustrating the important facets of the language.
More informationHandling Exceptions. Copyright 2006, Oracle. All rights reserved. Oracle Database 10g: PL/SQL Fundamentals 8-1
Handling Exceptions Copyright 2006, Oracle. All rights reserved. Oracle Database 10g: PL/SQL Fundamentals 8-1 Objectives After completing this lesson, you should be able to do the following: Define PL/SQL
More informationDisplaying Data from Multiple Tables. Chapter 4
Displaying Data from Multiple Tables Chapter 4 1 Objectives After completing this lesson, you should be able to do the following: Write SELECT statements to access data from more than one table using equality
More informationORACLE 9I / 10G / 11G / PL/SQL COURSE CONTENT
ORACLE 9I / 10G / 11G / PL/SQL COURSE CONTENT INTRODUCTION: Course Objectives I-2 About PL/SQL I-3 PL/SQL Environment I-4 Benefits of PL/SQL I-5 Benefits of Subprograms I-10 Invoking Stored Procedures
More informationAnswers to the Try It Yourself Sections
APPENDIX D Answers to the Try It Yourself Sections Chapter 1, PL/SQL Concepts 1) To calculate the area of a circle, you must square the circle s radius and then multiply it by π. Write a program that calculates
More informationSingle-Row Functions Schedule: Timing Topic
3 Single-Row Functions Schedule: Timing Topic 55 minutes Lecture 30 minutes Practice 85 minutes Total Objectives After completing this lesson, you should be able to do the following: Describe various types
More informationOracle Database 11g SQL and PL/SQL: A Brief Primer
APPENDIX Oracle Database 11g SQL and PL/SQL: A Brief Primer I m sure most of you are already familiar with SQL to some extent. However, I present in this appendix a quick introduction to Oracle Database
More informationCOMS20700 DATABASES 13 PL/SQL. COMS20700 Databases Dr. Essam Ghadafi
13 PL/SQL COMS20700 Databases Dr. Essam Ghadafi PL/SQL - OVERVIEW PL/SQL: Procedure Language/Structured Query Language. Provides programming languages features: IF, Loops, subroutines,... Code can be compiled
More information1 Stored Procedures in PL/SQL 2 PL/SQL. 2.1 Variables. 2.2 PL/SQL Program Blocks
1 Stored Procedures in PL/SQL Many modern databases support a more procedural approach to databases they allow you to write procedural code to work with data. Usually, it takes the form of SQL interweaved
More informationOracle Database 10g: Introduction to SQL
Oracle University Contact Us: 1.800.529.0165 Oracle Database 10g: Introduction to SQL Duration: 5 Days What you will learn This course offers students an introduction to Oracle Database 10g database technology.
More informationOracle For Beginners Page : 1
Oracle For Beginners Page : 1 Chapter 17 EXCEPTION HANDLING What is an? How to handle s? Predefined s When NO_DATA_FOUND is not raised? User-defined Reraising an Associating an With An Oracle Error Exception
More informationError Management in Oracle PL/SQL
Fast Track PL/SQL Error Management in Oracle PL/SQL Steven Feuerstein PL/SQL Evangelist, Quest Software steven.feuerstein@quest.com PL/SQL Obsession - www.toadworld.com/sf Copyright 2000-2008 Steven Feuerstein
More informationVARRAY AND NESTED TABLE
Oracle For Beginners Page : 1 Chapter 23 VARRAY AND NESTED TABLE What is a collection? What is a VARRAY? Using VARRAY Nested Table Using DML commands with Nested Table Collection methods What is a collection?
More informationOracle For Beginners Page : 1
Oracle For Beginners Page : 1 Chapter 24 NATIVE DYNAMIC SQL What is dynamic SQL? Why do we need dynamic SQL? An Example of Dynamic SQL Execute Immediate Statement Using Placeholders Execute a Query Dynamically
More informationDisplaying Data from Multiple Tables
Displaying Data from Multiple Tables 1 Objectives After completing this lesson, you should be able to do the following: Write SELECT statements to access data from more than one table using eguality and
More informationWriting Control Structures
Writing Control Structures Copyright 2006, Oracle. All rights reserved. Oracle Database 10g: PL/SQL Fundamentals 5-1 Objectives After completing this lesson, you should be able to do the following: Identify
More informationProcedural Extension to SQL using Triggers. SS Chung
Procedural Extension to SQL using Triggers SS Chung 1 Content 1 Limitations of Relational Data Model for performing Information Processing 2 Database Triggers in SQL 3 Using Database Triggers for Information
More informationHandling Exceptions. Schedule: Timing Topic. 45 minutes Lecture 20 minutes Practice 65 minutes Total
23 Handling Exceptions Copyright Oracle Corporation, 1999. All rights reserved. Schedule: Timing Topic 45 minutes Lecture 20 minutes Practice 65 minutes Total Objectives After completing this lesson, you
More informationMini User's Guide for SQL*Plus T. J. Teorey
Mini User's Guide for SQL*Plus T. J. Teorey Table of Contents Oracle/logging-in 1 Nested subqueries 5 SQL create table/naming rules 2 Complex functions 6 Update commands 3 Save a query/perm table 6 Select
More informationIntro to Embedded SQL Programming for ILE RPG Developers
Intro to Embedded SQL Programming for ILE RPG Developers Dan Cruikshank DB2 for i Center of Excellence 1 Agenda Reasons for using Embedded SQL Getting started with Embedded SQL Using Host Variables Using
More informationHandling Exceptions. Schedule: Timing Topic 45 minutes Lecture 20 minutes Practice 65 minutes Total
Handling Exceptions Schedule: Timing Topic 45 minutes Lecture 20 minutes Practice 65 minutes Total Objectives After completing this lesson, you should be able to do the following: Define PL/SQL exceptions
More informationSQL Tuning Proven Methodologies
SQL Tuning Proven Methodologies V.Hariharaputhran V.Hariharaputhran o Twelve years in Oracle Development / DBA / Big Data / Cloud Technologies o All India Oracle Users Group (AIOUG) Evangelist o Passion
More informationHandling Exceptions. Copyright 2008, Oracle. All rights reserved.
Handling Exceptions Handling Exceptions What Will I Learn? In this lesson, you will learn to: Describe several advantages of including exception handling code in PL/SQL Describe the purpose of an EXCEPTION
More informationGuide to SQL Programming: SQL:1999 and Oracle Rdb V7.1
Guide to SQL Programming: SQL:1999 and Oracle Rdb V7.1 A feature of Oracle Rdb By Ian Smith Oracle Rdb Relational Technology Group Oracle Corporation 1 Oracle Rdb Journal SQL:1999 and Oracle Rdb V7.1 The
More informationWhat is the value of SQL%ISOPEN immediately after the SELECT statement is executed? Error. That attribute does not apply for implicit cursors.
1. A PL/SQL block includes the following statement: SELECT last_name INTO v_last_name FROM employees WHERE employee_id=100; What is the value of SQL%ISOPEN immediately after the SELECT statement is executed?
More informationRelational Algebra. Query Languages Review. Operators. Select (σ), Project (π), Union ( ), Difference (-), Join: Natural (*) and Theta ( )
Query Languages Review Relational Algebra SQL Set operators Union Intersection Difference Cartesian product Relational Algebra Operators Relational operators Selection Projection Join Division Douglas
More information- Eliminating redundant data - Ensuring data dependencies makes sense. ie:- data is stored logically
Normalization of databases Database normalization is a technique of organizing the data in the database. Normalization is a systematic approach of decomposing tables to eliminate data redundancy and undesirable
More informationInformatics Practices
Informatics Practices Learning Objectives: 1. To understand the application development environment. 2. To gain programming Skills in GUI Programming Tool and Database Creation in RDBMS. 3. To design,
More information14 Triggers / Embedded SQL
14 Triggers / Embedded SQL COMS20700 Databases Dr. Essam Ghadafi TRIGGERS A trigger is a procedure that is executed automatically whenever a specific event occurs. You can use triggers to enforce constraints
More informationSQL interview questions and answers
SQL interview questions and answers What is SQL and where does it come from? Structured Query Language (SQL) is a language that provides an interface to relational database systems. SQL was developed by
More informationReview your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
est: Final Exam Semester 1 Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Section 6 1. How can you retrieve the error code and error message of any
More informationHandling PL/SQL Errors
7 Handling PL/SQL Errors There is nothing more exhilarating than to be shot at without result. Winston Churchill Run-time errors arise from design faults, coding mistakes, hardware failures, and many other
More informationSQL. by Steven Holzner, Ph.D. ALPHA. A member of Penguin Group (USA) Inc.
SQL by Steven Holzner, Ph.D. A ALPHA A member of Penguin Group (USA) Inc. Contents Part 1: Mastering the SQL Basics 1 1 Getting into SQL 3 Understanding Databases 4 Creating Tables Creating Rows and Columns
More informationAdvanced SQL. Jim Mason. www.ebt-now.com Web solutions for iseries engineer, build, deploy, support, train 508-728-4353. jemason@ebt-now.
Advanced SQL Jim Mason jemason@ebt-now.com www.ebt-now.com Web solutions for iseries engineer, build, deploy, support, train 508-728-4353 What We ll Cover SQL and Database environments Managing Database
More informationReview your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Test: Final Exam Semester 1 Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Section 6 1. The following code does not violate any constraints and will
More informationOracle PL/SQL Language. CIS 331: Introduction to Database Systems
Oracle PL/SQL Language CIS 331: Introduction to Database Systems Topics: Structure of a PL/SQL program Exceptions 3-valued logic Loops (unconditional, while, for) Cursors Procedures Functions Triggers
More informationPart A: Data Definition Language (DDL) Schema and Catalog CREAT TABLE. Referential Triggered Actions. CSC 742 Database Management Systems
CSC 74 Database Management Systems Topic #0: SQL Part A: Data Definition Language (DDL) Spring 00 CSC 74: DBMS by Dr. Peng Ning Spring 00 CSC 74: DBMS by Dr. Peng Ning Schema and Catalog Schema A collection
More information9 Using Triggers. Using Triggers 9-1
9 Using Triggers Triggers are procedures that are stored in the database and implicitly run, or fired, when something happens. Traditionally, triggers supported the execution of a PL/SQL block when an
More informationDatabase Design. Marta Jakubowska-Sobczak IT/ADC based on slides prepared by Paula Figueiredo, IT/DB
Marta Jakubowska-Sobczak IT/ADC based on slides prepared by Paula Figueiredo, IT/DB Outline Database concepts Conceptual Design Logical Design Communicating with the RDBMS 2 Some concepts Database: an
More informationETL TESTING TRAINING
ETL TESTING TRAINING DURATION 35hrs AVAILABLE BATCHES WEEKDAYS (6.30AM TO 7.30AM) & WEEKENDS (6.30pm TO 8pm) MODE OF TRAINING AVAILABLE ONLINE INSTRUCTOR LED CLASSROOM TRAINING (MARATHAHALLI, BANGALORE)
More informationDate / Time Arithmetic with Oracle
Date / Time Arithmetic with Oracle If you store date and time information in Oracle, you have two different options for the column's datatype - DATE and TIMESTAMP. DATE is the datatype that we are all
More informationTopics Advanced PL/SQL, Integration with PROIV SuperLayer and use within Glovia
Topics Advanced PL/SQL, Integration with PROIV SuperLayer and use within Glovia 1. SQL Review Single Row Functions Character Functions Date Functions Numeric Function Conversion Functions General Functions
More informationT-SQL STANDARD ELEMENTS
T-SQL STANDARD ELEMENTS SLIDE Overview Types of commands and statement elements Basic SELECT statements Categories of T-SQL statements Data Manipulation Language (DML*) Statements for querying and modifying
More informationPL/SQL & SQL. Coding Guidelines. Trivadis AG. Document Version 2.0 2011 Trivadis AG
PL/SQL & SQL CODING GUIDELINES VERSION 2.0 PL/SQL & SQL Coding Guidelines Trivadis AG Document Version 2.0 2011 Trivadis AG Foreword Coding Guidelines are an important quality standard for any programming
More informationPL/SQL Programming. Oracle Database 12c. Oracle Press ORACLG. Michael McLaughlin. Mc Graw Hill Education
ORACLG Oracle Press Oracle Database 12c PL/SQL Programming Michael McLaughlin Mc Graw Hill Education New York Chicago San Francisco Athens London Madrid Mexico City Milan New Delhi Singapore Sydney Toronto
More informationA basic create statement for a simple student table would look like the following.
Creating Tables A basic create statement for a simple student table would look like the following. create table Student (SID varchar(10), FirstName varchar(30), LastName varchar(30), EmailAddress varchar(30));
More information2. Which three statements about functions are true? (Choose three.) Mark for Review (1) Points
1. Which SQL function can be used to remove heading or trailing characters (or both) from a character string? LPAD CUT NVL2 TRIM (*) 2. Which three statements about functions are true? (Choose three.)
More informationHow To Create A Table In Sql 2.5.2.2 (Ahem)
Database Systems Unit 5 Database Implementation: SQL Data Definition Language Learning Goals In this unit you will learn how to transfer a logical data model into a physical database, how to extend or
More informationSQL Introduction Chapter 7, sections 1 & 4. Introduction to SQL. Introduction to SQL. Introduction to SQL
SQL Introduction Chapter 7, sections 1 & 4 Objectives To understand Oracle s SQL client interface Understand the difference between commands to the interface and SQL language. To understand the Oracle
More informationPL / SQL Basics. Chapter 3
PL / SQL Basics Chapter 3 PL / SQL Basics PL / SQL block Lexical units Variable declarations PL / SQL types Expressions and operators PL / SQL control structures PL / SQL style guide 2 PL / SQL Block Basic
More informationIntroduction to PL/SQL Programming
Introduction to PL/SQL Programming Introduction to PL/SQL Programming i-ii Introduction to PL/SQL Programming 1997-2001 Technology Framers, LLC Introduction to PL/SQL Programming This publication is protected
More informationOracle PL/SQL Injection
Oracle PL/SQL Injection David Litchfield What is PL/SQL? Procedural Language / Structured Query Language Oracle s extension to standard SQL Programmable like T-SQL in the Microsoft world. Used to create
More informationHandling PL/SQL Errors
Handling PL/SQL Errors In PL/SQL, a warning or error condition is called an exception. Exceptions can be internally defined (by the run-time system) or user defined. Examples of internally defined exceptions
More informationOracle Database 10g Express
Oracle Database 10g Express This tutorial prepares the Oracle Database 10g Express Edition Developer to perform common development and administrative tasks of Oracle Database 10g Express Edition. Objectives
More informationOracle 11g PL/SQL training
Oracle 11g PL/SQL training Course Highlights This course introduces students to PL/SQL and helps them understand the benefits of this powerful programming language. Students learn to create PL/SQL blocks
More informationIT2304: Database Systems 1 (DBS 1)
: Database Systems 1 (DBS 1) (Compulsory) 1. OUTLINE OF SYLLABUS Topic Minimum number of hours Introduction to DBMS 07 Relational Data Model 03 Data manipulation using Relational Algebra 06 Data manipulation
More informationOracle to MySQL Migration
to Migration Stored Procedures, Packages, Triggers, Scripts and Applications White Paper March 2009, Ispirer Systems Ltd. Copyright 1999-2012. Ispirer Systems Ltd. All Rights Reserved. 1 Introduction The
More informationDelivering Database Compatibility for Oracle in Postgres Plus Advanced Server
f Delivering Database Compatibility for Oracle in Postgres Plus Advanced Server An EnterpriseDB White Paper For DBAs, Database Architects & IT Directors January 2014 Table of Contents Executive Summary
More informationIT2305 Database Systems I (Compulsory)
Database Systems I (Compulsory) INTRODUCTION This is one of the 4 modules designed for Semester 2 of Bachelor of Information Technology Degree program. CREDITS: 04 LEARNING OUTCOMES On completion of this
More informationSQL/PSM. Outline. Database Application Development Oracle PL/SQL. Why Stored Procedures? Stored Procedures PL/SQL. Embedded SQL Dynamic SQL
Outline Embedded SQL Dynamic SQL Many host languages: C, Cobol, Pascal, etc. JDBC (API) SQLJ (Embedded) Java Database Application Development Oracle PL/SQL Stored procedures CS430/630 Lecture 15 Slides
More information5. CHANGING STRUCTURE AND DATA
Oracle For Beginners Page : 1 5. CHANGING STRUCTURE AND DATA Altering the structure of a table Dropping a table Manipulating data Transaction Locking Read Consistency Summary Exercises Altering the structure
More informationMONASH UNIVERSITY. Faculty of Information Technology
CSE2132/CSE9002 - Tutorial 1 Database Concept Exercises TOPICS - Database Concepts; Introduction to Oracle Part 1 (To be done in the students own time then discussed in class if necessary.) Hoffer,Prescott
More informationD61830GC30. MySQL for Developers. Summary. Introduction. Prerequisites. At Course completion After completing this course, students will be able to:
D61830GC30 for Developers Summary Duration Vendor Audience 5 Days Oracle Database Administrators, Developers, Web Administrators Level Technology Professional Oracle 5.6 Delivery Method Instructor-led
More informationScheme G. Sample Test Paper-I
Scheme G Sample Test Paper-I Course Name : Computer Engineering Group Course Code : CO/CM/IF/CD/CW Marks : 25 Hours: 1 Hrs. Q.1 Attempt Any THREE. 09 Marks a) List any six applications of DBMS. b) Define
More informationUsing TimesTen between your Application and Oracle. between your Application and Oracle. DOAG Conference 2011
DOAG Conference 2011 Using TimesTen between your Application and Oracle Jan Ott, Roland Stirnimann Senior Consultants Trivadis AG BASEL 1 BERN LAUSANNE ZÜRICH DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. HAMBURG
More informationChapter 1. Writing Basic. SQL Statements
Chapter 1 Writing Basic SQL Statements 1 Objectives After completing this lesson, you should be able to do the following: List the capabilities of SQL SELECT statements Execute a basic SELECT statement
More informationIn This Lecture. SQL Data Definition SQL SQL. Notes. Non-Procedural Programming. Database Systems Lecture 5 Natasha Alechina
This Lecture Database Systems Lecture 5 Natasha Alechina The language, the relational model, and E/R diagrams CREATE TABLE Columns Primary Keys Foreign Keys For more information Connolly and Begg chapter
More informationCourse -Oracle 10g SQL (Exam Code IZ0-047) Session number Module Topics 1 Retrieving Data Using the SQL SELECT Statement
Course -Oracle 10g SQL (Exam Code IZ0-047) Session number Module Topics 1 Retrieving Data Using the SQL SELECT Statement List the capabilities of SQL SELECT statements Execute a basic SELECT statement
More information