1. 1. Which type of argument passes a value from a procedure to the calling program? A. VARCHAR2 B. BOOLEAN C. OUT D. IN 2.

Slides:



Advertisements
Similar presentations
PL/SQL.
Advertisements

AN INTRODUCTION TO PL/SQL Mehdi Azarmi 1. Introduction PL/SQL is Oracle's procedural language extension to SQL, the non-procedural relational database.
PL/SQL. Introduction to PL/SQL PL/SQL is the procedure extension to Oracle SQL. It is used to access an Oracle database from various environments (e.g.
INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Introduction to PL/SQL – Lecture 6.
Introduction To SQL Lynnwood Brown President System Managers LLC Copyright System Managers LLC 2003 all rights reserved.
Murali Mani Persistent Stored Modules (Stored Procedures) : PSM.
A Guide to SQL, Seventh Edition. Objectives Create a new table from an existing table Change data using the UPDATE command Add new data using the INSERT.
PL/SQL Agenda: Basic PL/SQL block structure
Oracle PL/SQL Eyad Husni Elshami. Why PL/SQL Block Structures: – PL/SQL consists of blocks of code, which can be nested within each other. Each block.
Copyright  Oracle Corporation, All rights reserved. 4 Creating Functions.
1 PL/SQL programming Procedures and Cursors Lecture 1 Akhtar Ali.
PL/SQL Bulk Collections in Oracle 9i and 10g Kent Crotty Burleson Consulting October 13, 2006.
ORACLE ONLINE TRAINING Contact our Support Team : SOFTNSOL India: Skype id : softnsoltrainings id:
Distributed Database Applications COSC 5050 Week Three.
PL / SQL P rocedural L anguage / S tructured Q uery L anguage Chapter 7 in Lab Reference.
EE Copyright س Oracle Corporation, All rights reserved. ® Review of PL/SQL.
Lecture 4 PL/SQL language. PL/SQL – procedural SQL Allows combining procedural and SQL code PL/SQL code is compiled, including SQL commands PL/SQL code.
PL/SQLPL/SQL Oracle11g : PL/SQL Programming Chapter 6 Functions.
Program with PL/SQL. Interacting with the Oracle Server.
Overview · What is PL/SQL · Advantages of PL/SQL · Basic Structure of a PL/SQL Block · Procedure · Function · Anonymous Block · Types of Block · Declaring.
PL/SQL A BRIEF OVERVIEW DAVID WILSON. PL/SQL User’s Guide and Reference PL/SQL User’s Guide and Reference.
ACTION QUERIES (SQL COMMANDS ) STRUCTURED QUERY LANGUAGE.
Procedure Function Trigger. create table employee ( id number, name varchar2(100), deptno number, salary float, primary key(id) ) create table deptincrease.
PL/SQL Cursors Session - II. Attributes Attributes %TYPE %ROWTYPE % Found % NotFound % RowCount % IsOPen %TYPE %ROWTYPE % Found % NotFound % RowCount.
PL SQL Block Structures. What is PL SQL A good way to get acquainted with PL/SQL is to look at a sample program. PL/SQL combines the data manipulating.
In Oracle.  A PL/SQL block stored in the database and fired in response to a specified event ◦ DML statements : insert, update, delete ◦ DDL statements.
PRACTICE OVERVIEW PL/SQL Part Examine this package specification and body: Which statement about the V_TOTAL_BUDGET variable is true? A. It must.
Stored Procedures Week 9. Test Details Stored Procedures SQL can call code written in iSeries High Level Languages –Called stored procedures SQL has.
1 CursorsCursors. 2 SQL Cursor A cursor is a private SQL work area. A cursor is a private SQL work area. There are two types of cursors: There are two.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 8 Advanced SQL.
PL/SQL Block Structure DECLARE - Optional Variables, cursors, user-defined exceptions BEGIN - Mandatory SQL Statements PL/SQL Statements EXCEPTIONS - Optional.
Manipulating Data in PL/SQL. 2 home back first prev next last What Will I Learn? Construct and execute PL/SQL statements that manipulate data with DML.
Database Management COP4540, SCS, FIU Oracle PL/SQL (Ch 10.5)
School of Computing and Management Sciences © Sheffield Hallam University SQL is non-procedural –designed to be relatively approachable to non- programmers.
Copyright  Oracle Corporation, All rights reserved. 18 Interacting with the Oracle Server.
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 9 Database Triggers.
Using SQL in PL/SQL ITEC 224 Database Programming.
A Guide to SQL, Eighth Edition Chapter Eight SQL Functions and Procedures.
Professor: Dr. Shu-Ching Chen TA: Hsin-Yu Ha Function, Trigger used in PosgreSQL.
A Guide to SQL, Eighth Edition Chapter Six Updating Data.
PL/SQL programming Procedures and Cursors Lecture 1 [Part 2]
Advanced Databases More Advanced PL/SQL Programing 1.
PRACTICE OVERVIEW PL/SQL Part Your stored procedure, GET_BUDGET, has a logic problem and must be modified. The script that contains the procedure.
Introduction to PL/SQL Francis Thottungal. The outline The basic PL/SQL code structure is : DECLARE -- optional, which declares and define variables,
Program with PL/SQL Lesson 3. Interacting with the Oracle Server.
A Guide to MySQL 6. 2 Objectives Create a new table from an existing table Change data using the UPDATE command Add new data using the INSERT command.
PL/SQL  PL/SQL stands for Procedural Language/SQL.  PL/SQL extends SQL by adding constructs found in procedural languages like procedures, loops, variables,
Kingdom of Saudi Arabia Ministry of Higher Education Al-Imam Muhammad Ibn Saud Islamic University College of Computer and Information Sciences Overview.
Introduction to PL/SQL N. Dimililer. About PL/SQL –PL/SQL is an extension to SQL with design features of programming languages. –Data manipulation and.
ITEC 224 Database Programming
Program with PL/SQL Lesson 4.
PL/SQL MULTIPLE CHOICE QUESTION.
Interacting with the Oracle8 Server
Interacting with the Oracle Server
Interacting with the Oracle Server
Creating Stored Procedures and Functions
Interacting with the Oracle Server
PL/SQL.
SQL PL/SQL Presented by: Dr. Samir Tartir
Database Management Systems 2
Interacting with the Oracle Server
Writing Correlated Subqueries
الأزنده أ.موضي المحرج.
PRACTICE OVERVIEW PL/SQL Part - 2.
Stored Procedure used in PosgreSQL
Chapter 2 Handling Data in PL/SQL Blocks Oracle9i Developer:
PRACTICE OVERVIEW PL/SQL Part - 1.
Chapter 8 Advanced SQL Pearson Education © 2009.
Triggers.
Database Programming Using Oracle 11g
Presentation transcript:

1

1. Which type of argument passes a value from a procedure to the calling program? A. VARCHAR2 B. BOOLEAN C. OUT D. IN 2

CREATE OR REPLACE TRIGGER update_emp AFTER UPDATE ON emp BEGIN INSERT INTO audit_table (who, dated) VALUES (USER, SYSDATE); END; 2. You issue an UPDATE command in the EMP table that resulted in changing 10 rows. How many rows are inserted into the AUDIT_TABLE? A. 1 B. 10 C. None D. A value equal to the number of rows in the EMP table. 3

3. Which table name is valid? A. #_667 B. Number C. Catch_#22 D. 1996_invoices 4

4. You want to display the average salary for the departments 20 and 50, but only if those departments have an average salary of at least Which statement will produce the required results A. SELECT deptno, AVG(sal) FROM emp WHERE deptno IN (20,50) GROUP BY deptno HAVING AVG (sal)>=2000; B. SELECT deptno, AVG(sal) FROM emp GROUP BY deptno HAVING AVG (sal)>=2000; Deptno IN (20,50); C. SELECT deptno, AVG(sal) FROM emp WHERE deptno IN (20,50) AND AVG (sal)>=2000 GROUP BY deptno; D. SELECT deptno, AVG(sal) FROM emp WHERE deptno IN (20,50) GROUP BY AVG(sal) HAVING AVG(sal)>=2000 5

5. Why do stored procedures and functions improve performance? A. They reduce network round trips. B. They allow the application to perform high speed processing locally. C. They reduce the number of calls to the database and decrease network traffic by bundling commands. D. They reduce the number of calls to the database and decrease network traffic by using the local PL/SQL engine. 6

6. You have decided to permanently remove all the data from the STUDENT table and you need the table structure in the future. Which single command performs this? A. TRUNCATE TABLE student; B. DROP TABLE student; C. ROLLBACK TABLE student; D. Delete from table student; 7

7. Evaluate the following IF statement: IF v_value > 10 THEN v_new_value:=2*v_value; ELSIF v_value > 20 THEN v_new_value:=3*v_value; ELSIF v_value > 30 THEN v_new_value:=4*v_value; ELSE v_new_value:=5*v_value; END IF What would be assigned to v_new_value if v_value = 50? A. 50 B. 100 C. 150 D

8. Written a PL/SQL loop, you need to test if the current FETCH was successful. Which SQL cursor attribute would you use to accomplish this task? A. SQL%ISOPEN B. SQL%FOUND C. SQL%OPEN D. An SQL cursor attribute cannot be used inside a PL/SQL loop. 9

9. Which statement is true when writing a cursor FOR loop? A. You must explicitly fetch the rows within a cursor FOR loop. B. You must explicitly open the cursor prior to the cursor FOR loop. C. You must explicitly close the cursor prior to the end of program. D. You do not explicitly open, fetch or close a cursor within a cursor FOR loop. 10

10. Evaluate this PL/SQL block: BEGIN FOR i IN LOOP IF I=4 OR I=6 THEN null; ELSE INSERT INTO test(result) VALUES (I); END IF; COMMIT; END LOOP; ROLLBACK; END; How many values will be inserted into the TEST table? A. 4 B. 6 C. 8 D