Recognizing PL/SQL Lexical Units. 2 home back first prev next last What Will I Learn? List and define the different types of lexical units available in.

Slides:



Advertisements
Similar presentations
JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
Advertisements

Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
Lecture-5 Though SQL is the natural language of the DBA, it suffers from various inherent disadvantages, when used as a conventional programming language.
© 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5/e Starting Out with C++: Early Objects 5 th Edition Chapter 2 Introduction.
Data types and variables
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie June 27, 2005.
JavaScript, Fourth Edition
Chapter 2: Introduction to C++.
JavaScript, Third Edition
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
Objectives You should be able to describe: Data Types
CSC 125 Introduction to C++ Programming Chapter 2 Introduction to C++
Benefits of PL/SQL. 2 home back first prev next last What Will I Learn? In this lesson, you will learn to: –List and explain the benefits of PL/SQL –List.
Primitive Data Types and Operations Identifiers, Variables, and Constants Primitive Data Types Byte, short, int, long, float, double, char, boolean Casting.
Chapter 2: Basic Elements of Java J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition.
2440: 211 Interactive Web Programming Expressions & Operators.
C Tokens Identifiers Keywords Constants Operators Special symbols.
Chapter 2 Basic Elements of Java. Chapter Objectives Become familiar with the basic components of a Java program, including methods, special symbols,
CS1 Lesson 2 Introduction to C++ CS1 Lesson 2 -- John Cole1.
COE 405 VHDL Lexical Elements Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum & Minerals Dr. Aiman H. El-Maleh.
CSE 1301 Lecture 2 Data Types Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
Input, Output, and Processing
JAVA Tokens. Introduction A token is an individual element in a program. More than one token can appear in a single line separated by white spaces.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Program with PL/SQL Lesson 5. Working with Composite Data Types.
Copyright © 2012 Pearson Education, Inc. Chapter 2: Introduction to C++
Java Programming: From Problem Analysis to Program Design, 4e Chapter 2 Basic Elements of Java.
Java Programming: From Problem Analysis to Program Design, 5e Chapter 2 Basic Elements of Java.
Course Title: Object Oriented Programming with C++ instructor ADEEL ANJUM Chapter No: 03 Conditional statement 1 BY ADEEL ANJUM (MSc-cs, CCNA,WEB DEVELOPER)
 Character set is a set of valid characters that a language can recognise.  A character represents any letter, digit or any other sign  Java uses the.
BASICS CONCEPTS OF ‘C’.  C Character Set C Character Set  Tokens in C Tokens in C  Constants Constants  Variables Variables  Global Variables Global.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Trapping Oracle Server Exceptions. 2 home back first prev next last What Will I Learn? Describe and provide an example of an error defined by the Oracle.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 2: Introduction to C++
Introduction to Programming
Chapter 2 Variables.
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
Chapter 2: Introduction to C++. Outline Basic “Hello World!!” Variables Data Types Illustration.
Ajmer Singh PGT(IP) Programming Fundamentals. Ajmer Singh PGT(IP) Java Character Set Character set is a set of valid characters that a language can recognize.
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
Lecture 5 Computer programming -1-. Input \ Output statement 1- Input (cin) : Use to input data from keyboard. Example : cin >> age; 2- Output (cout):
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Introduction to C++
Java Programming: From Problem Analysis to Program Design, Second Edition 1 Lecture 1 Objectives  Become familiar with the basic components of a Java.
Chapter 4: Variables, Constants, and Arithmetic Operators Introduction to Programming with C++ Fourth Edition.
PL/SQL Writing Executable Statements. PL/SQL Block Syntax and Guidelines Statement can be split across lines, but keywords must not be split Lexical units.
3 Copyright © 2004, Oracle. All rights reserved. Writing Executable Statements.
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 2: Introduction to C++
2.1 The Part of a C++ Program. The Parts of a C++ Program // sample C++ program #include using namespace std; int main() { cout
Java Programming: Guided Learning with Early Objects Chapter 1 Basic Elements of Java.
Definition of the Programming Language CPRL
Chapter 2 Variables.
Topics Designing a Program Input, Processing, and Output
Chapter 2: Introduction to C++
CS170 – Week 1 Lecture 3: Foundation Ismail abumuhfouz.
BASIC ELEMENTS OF A COMPUTER PROGRAM
Section 3.2c Strings and Method Signatures
Java Programming: From Problem Analysis to Program Design, 4e
Chapter 2: Introduction to C++
Introduction to the C Language
2.1 Parts of a C++ Program.
Chapter 1: Computer Systems
elementary programming
Chapter 2: Introduction to C++.
Topics Designing a Program Input, Processing, and Output
Topics Designing a Program Input, Processing, and Output
Chap 2. Identifiers, Keywords, and Types
Chapter 2 Variables.
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

Recognizing PL/SQL Lexical Units

2 home back first prev next last What Will I Learn? List and define the different types of lexical units available in PL/SQL Describe identifiers and identify valid and invalid identifiers in PL/SQL Describe and identify reserved words, delimiters, literals, and comments in PL/SQL

3 home back first prev next last Why Learn It? A spoken language has different parts of speech. Each part of speech (such as adjective, noun, and verb) is used differently and must follow rules. Similarly, a programming language has different parts of speech that are used differently and must follow rules. These parts of speech are called lexical units. This lesson explores the lexical units of the PL/SQL programming language.

4 home back first prev next last Lexical Units in a PL/SQL Block Lexical units: –Are the building blocks of any PL/SQL block –Are sequences of characters including letters, digits, tabs, returns, and symbols –Can be classified as:  Identifiers  Reserved words  Delimiters  Literals  Comments

5 home back first prev next last Identifiers An identifier is the name given to a PL/SQL object, including any of the following: (Do not be concerned if you do not know what all of the above objects are! You will learn about PL/SQL objects throughout this course.)

6 home back first prev next last Identifiers The identifiers in the following PL/SQL code are highlighted::

7 home back first prev next last Properties of an Identifier Identifiers: –Are up to 30 characters in length –Must start with a letter –Can include $ (dollar sign), _ (underscore), and # (pound sign/hash sign) –Cannot contain spaces

8 home back first prev next last Valid and Invalid Identifiers Examples of valid identifiers: Examples of invalid identifiers:

9 home back first prev next last Reserved Words Reserved words are words that have special meaning to the Oracle database. Reserved words cannot be used as identifiers in a PL/SQL program.

10 home back first prev next last Reserved Words The following is a partial list of reserved words. Note: For more information, refer to the “PL/SQL User’s Guide and Reference.”

11 home back first prev next last Reserved Words What happens when you try to use a reserved word as an identifier in a PL/SQL program? DECLARE date DATE; BEGIN SELECT ADD_MONTHS(SYSDATE,3) INTO date FROM DUAL; END;

12 home back first prev next last Delimiters Delimiters are symbols that have special meaning to the Oracle database.

13 home back first prev next last Literals A literal is –an explicit numeric, character string, date, or Boolean value that is not represented by an identifier. Literals are classified as: –Character (also known as string literals) –Numeric –Boolean

14 home back first prev next last Character Literals Character literals include all the printable characters in the PL/SQL character set: letters, numerals, spaces, and special symbols. Character literals have the data type CHAR and must be enclosed in single quotation marks. Character literals may be composed of zero or more characters from the PL/SQL character set. Character literals are case sensitive and, therefore, PL/SQL is not equivalent to pl/sql.

15 home back first prev next last Numeric Literals Values that represent an integer or real value are numeric literals Numeric literals can be represented either by a simple value (for example, –32.5) or by a scientific notation (for example, 2E5, meaning 2* (10 to the power of 5) =200000). Examples: 428, 1.276, 2.09E14

16 home back first prev next last Boolean Literals Values that are assigned to Boolean variables are Boolean literals. Notice they are not surrounded by quotes. TRUE, FALSE, and NULL are Boolean literals or keywords.

17 home back first prev next last Comments Comments explain what a piece of code is trying to achieve. –Well-placed comments are extremely valuable for code readability and future code maintenance. –It is good programming practice to comment code. Comments are ignored by PL/SQL. –They make no difference to how a PL/SQL block executes or the results it displays. Comments are also very useful for debugging

18 home back first prev next last Syntax for Commenting Code Commenting a Single Line –Two dashes -- are used for commenting a single line. Commenting Multiple Lines –/* */ is used for commenting multiple lines.

19 home back first prev next last Terminology Key terms used in this lesson include: –Lexical Units –Identifiers –Reserved Words –Delimiters –Literals –Comments

20 home back first prev next last Summary In this lesson, you learned to: –List and define the different types of lexical units available in PL/SQL –Describe identifiers and identify valid and invalid identifiers in PL/SQL –Describe and identify reserved words, delimiters, literals, and comments in PL/SQL

21 home back first prev next last Try It/Solve It The exercises for this lesson cover the following topics: –Listing and defining the different types of lexical units available in PL/SQL –Describing identifiers and identifying valid and invalid identifiers in PL/SQL –Describing and identifying reserved words, delimiters, literals, and comments in PL/SQL