Preview

Enrollment and Billing System

Satisfactory Essays
Open Document
Open Document
1141 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Enrollment and Billing System
Declaring PL/SQL Variables

Copyright © 2009, Oracle. All rights reserved.

Objectives
After completing this lesson, you should be able to do the following: • Recognize valid and invalid identifiers • List the uses of variables • Declare and initialize variables • List and describe various data types • Identify the benefits of using the %TYPE attribute • Declare, use, and print bind variables

2-2

Copyright © 2009, Oracle. All rights reserved.

Use of Variables
Variables can be used for: • Temporary storage of data • Manipulation of stored values • Reusability

SELECT first_name, department_id INTO v_fname, v_deptno FROM …

Jennifer

v_fname

10

v_deptno

2-3

Copyright © 2009, Oracle. All rights reserved.

Requirements for Variable Names
A variable name: • Must start with a letter • Can include letters or numbers • Can include special characters (such as $, _, and # ) • • Must contain no more than 30 characters Must not include reserved words

2-4

Copyright © 2009, Oracle. All rights reserved.

Handling Variables in PL/SQL
Variables are: • Declared and initialized in the declarative section • Used and assigned new values in the executable section • Passed as parameters to PL/SQL subprograms • Used to hold the output of a PL/SQL subprogram

2-5

Copyright © 2009, Oracle. All rights reserved.

Declaring and Initializing PL/SQL Variables
Syntax:
identifier [CONSTANT] datatype [NOT NULL] [:= | DEFAULT expr];

Examples:
DECLARE v_hiredate v_deptno v_location c_comm DATE; NUMBER(2) NOT NULL := 10; VARCHAR2(13) := 'Atlanta'; CONSTANT NUMBER := 1400;

2-6

Copyright © 2009, Oracle. All rights reserved.

Declaring and Initializing PL/SQL Variables
DECLARE v_myName VARCHAR2(20); BEGIN DBMS_OUTPUT.PUT_LINE('My name is: '|| v_myName); v_myName := 'John'; DBMS_OUTPUT.PUT_LINE('My name is: '|| v_myName); END; / DECLARE v_myName VARCHAR2(20):= 'John'; BEGIN v_myName := 'Steven'; DBMS_OUTPUT.PUT_LINE('My name is: '||

You May Also Find These Documents Helpful

  • Good Essays

    Week 1 Lab_ CIS_115

    • 439 Words
    • 2 Pages

    List all variables you will use (use valid variable names). Indicate whether the data type is string, integer, or decimal, and so on.…

    • 439 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    4. What is a local variable? What statements are able to access a local variable?…

    • 765 Words
    • 5 Pages
    Satisfactory Essays
  • Good Essays

    1. SELECT e.ename, e.deptno, d.dname, d.deptno FROM dept d LEFT OUTER JOIN emp e ON d.deptno = e.deptno ORDER BY d.deptno; SQL> SELECT e.ename, e.deptno, d.dname, d.deptno 2 FROM dept d 3 LEFT OUTER JOIN emp e 4 ON d.deptno = e.deptno 5 ORDER BY d.deptno; ENAME DEPTNO DNAME DEPTNO ---------- ---------- -------------- ----------…

    • 1542 Words
    • 7 Pages
    Good Essays
  • Powerful Essays

    a guide to mysql ch 7

    • 1287 Words
    • 9 Pages

    Except where indicated, use MySQL Query Browser to perform each operation and print the results.…

    • 1287 Words
    • 9 Pages
    Powerful Essays
  • Good Essays

    Programing Problems

    • 721 Words
    • 3 Pages

    Main Module Declare EmployeeID As Real Declare HourlyRate As Real Declare RegHours As Real Declare OvertimeHours As Real Declare GrossPay As Real Declare Tax…

    • 721 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    the variables to make it easier for you to work with. We are interested in your ability to…

    • 268 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Hrm Labor

    • 363 Words
    • 2 Pages

    | (TCO 2) Use the ____ data type for columns that contain letters and special characters and for columns containing numbers that will not be used in calculations.…

    • 363 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    ( NAME = N'Jeff Thompson Sr - POS 410 - IA - KVO_log', FILENAME = N'D:\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\Jeff Thompson Sr - POS 410 - IA - KVO_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)…

    • 1555 Words
    • 7 Pages
    Powerful Essays
  • Good Essays

    Compter Science

    • 819 Words
    • 4 Pages

    In a high-level language, the programmer’s only responsibilities for managing data items are to declare (or in the case of Python, create) all constants and variables the program will use.…

    • 819 Words
    • 4 Pages
    Good Essays
  • Better Essays

    Plsql Chap7 Sols

    • 2330 Words
    • 17 Pages

    12. If there are values referenced continually in the application, storing them in packaged variables will allow the values to only be retrieved once thus saving data retrieval processing. The values in global constructs are persistent for the entire user session.…

    • 2330 Words
    • 17 Pages
    Better Essays
  • Good Essays

    Data Base

    • 2312 Words
    • 10 Pages

    * Each value manipulated by an Oracle database possesses a data type. The data type of a value links a selection of attributes to the value. These attributes of the value differentiate one data type from the others. Oracle treats certain data types in a distinct way. For instance, one can add values of NUMBER data type, but not values of RAW data type. When one builds a table or a cluster, one must assign data types for all its columns. In Oracle, the arguments of a procedure or stored function also need to be allocated data types. The data types specify the domain of values which…

    • 2312 Words
    • 10 Pages
    Good Essays
  • Satisfactory Essays

    Statistic Practice Test

    • 741 Words
    • 3 Pages

    B. a document that tells the researcher where variables are located in the data file and what numbers go with variable attributes*…

    • 741 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    IS4560

    • 486 Words
    • 2 Pages

    methods, including character scrambling and masking, numeric variance and nulling, rely on an array of built-in SQL Server system functions that are used for string manipulation.…

    • 486 Words
    • 2 Pages
    Good Essays
  • Good Essays

    ii) What is the difference between a keyword and a variable? Can keywords be used as variables? Which of…

    • 1557 Words
    • 7 Pages
    Good Essays
  • Better Essays

    1. 1 . If your sending agency (e.g. Bank of Tokyo, Sumitomo Corporation, GSIS, etc.) is to be billed through the Office of Scholarships and Student Services (OSSS), go to Room 302, Vinzon's Hall : 1. a. Have your Form 5 approved by OSSS. Please check the name of the Scholarship and the privilege (e.g. Tution Only, All School fees) if it is indicated on the form. 2. b. Submit your Form5 to ARS-Billing. If your Scholarship privilege covers all school fees, your Form 5 will be stamped REGISTERED. If you are paying part of the assesed fee (e.g. student fund, fine), follow item 3 below 2. 2 . If your sending agency is to be billed through the OUR 3. a. Submit the certificate of Authority to Bill from your sending agency everytime you enroll 4. b. Submit your Form 5 to ARS-Billing for stamping of REGISTERED 3. 3 . If you are paying part of the assessed fee (e.g. student fund, fine), proceed to the payment area and pay the necessary fees…

    • 1297 Words
    • 6 Pages
    Better Essays

Related Topics