tailieunhanh - Teach Yourself PL/SQL in 21 Days- P6

Teach Yourself PL/SQL in 21 Days- P6: Welcome to Sams Teach Yourself PL/SQL in 21 Days, Second Edition. The fact that you purchased this book indicates that you have an interest in learning the PL/SQL language, which is Oracle’s relational database procedural programming language. It allows you to develop powerful and complex programs to access and manipulate data in the Oracle8i database. We have attempted to include as many examples of PL/SQL code as possible to illustrate PL/SQL features | Using SQL 227 I Table The Employee Table After Inserting emp_id emp_name supervised_by pay_rate pay_type 1 Jessica Loraine 2 H 2 Kurt Roberts 5 S 8 This insert statement simply created two records in the employee table. The statement provided the data to be used in the record creations. Note that there were no column_name references in the INSERT statement. The reason is that SQL will make a one-to-one match of the column_name to the data included in the INSERT statement. If you want you can insert data into selected columns as shown in the second example. It is advisable to always include the column list to ensure clarity to others. The column list will come in handy whenever you have to debug your code. Likewise it is advisable to use a sequence number for any of the table s primary key values. Here s the second example Input Analysis INSERT into employee ernp_id ernp_narne values 1 1 Jessica Loraine1 2 1 Kurt Roberts1 In the second example you only placed data in the emp_id and emp_name columns. All other columns would be blank as seen in Table . Table Inserting with Named Columns emp id emp name supervised by pay rate pay type 1 Jessica Loraine 2 Kurt Roberts Inserting Some Data You will now insert data into the employee table for use in the remainder of the book. Type in the PL SQL block shown in Listing and then compile and execute it. When you run this block of code it will ask you for an employee s name and related information and in turn insert this data into the Employee table. Run this anonymous PL SQL I 228 Day 8 block multiple times in order to end up with roughly 10 employees worth of data loaded. Your goal here is to input data that represents the typical organizational chart shown in Figure . You want data loaded for all levels of the organizational chart. While inserting data feel free to use any names you like. Figure Organization chart. Department 1 Department 2 z Department 3 Listing shows the PL SQL .

TÀI LIỆU LIÊN QUAN
TỪ KHÓA LIÊN QUAN