Lab 3.1 PL/SQL Programming FundamentalsCharacter TypesThe PL/SQL engine accepts four types of characters: letters, digits, symbols (*, +, -, =, etc.), and white space. When elements from one or more of these character types are joined together, they will create a lexical unit (these lexical units can be a combination of character types). The lexical units are the words of the PL/SQL language. First you need to learn the PL/SQL vocabulary, and then you will move on to the syntax, or grammar. Soon you can start talking in PL/SQL.
Lexical UnitsA language such as English contains different parts of speech. Each part of speech, such as a verb or noun, behaves in a different way and must be used according to specific rules. Likewise, a programming language has lexical units that are the building blocks of the language. PL/SQL lexical units fall within one of the following five groups: Identifiers must begin with a letter and may be up to 30 characters long. See a PL/SQL manual for a more detailed list of restrictions; generally, if you stay with characters, numbers, and " ", and avoid reserved words, you will not run into problems. Reserved words are words that PL/SQL saves for its own use (e.g., BEGIN, END, SELECT). These are characters that have special meaning to PL/SQL, such as arithmetic operators and quotation marks. A literal is any value (character, numeric, or Boolean [true/false]) that is not an identifier. 123, "Declaration of Independence," and FALSE are examples of literals. These can be either single-line comments (i.e., --) or multiline comments (i.e., /* */). See Appendix B, "PL/SQL Formatting Guide," for details on formatting.In the following exercises, you will practice putting these units together. |