[bbk4979]第06集 - Chapter 04- Interacting with Oracle Database Server:SQL Statements in PL/SQL Programs(01)
2013-04-22 23:25
621 查看
Objectives
After completing this lesson,you should be table to do the following:Determine the SQL statements that can be directly included in a PL/SQL executeable block.
Manipulate data with DML statements in PL/SQL
Use transaction control statements in PL/SQL
Make use of the INTO clause to hold the values returned by a SQL statement
Differentiate between implicit cursors and explicit cursors
Use SQL cursor attributes
Agenda
Retrieving data with PL/SQLManipulating data with PL/SQL
Introducing SQL cursors
SQL Statements in PL/SQL
Retrieve a row from the database by using the SELECT command.Make chanages to rows in the database by using DML commands.
Control a transaction with COMMIT,ROLLBACK,or SAVEPOINT command;
一个PL/SQL的blokc中,如果执行完毕了,里面的事务不会自动处理(COMMIT,ROLLBACK),必须显示处理.
SELECT Statements in PL/SQL
Retrieve data from the database with a SELECT statement.Syntax:(带有明显PL/SQL烙印的SELECT)
SELECT select_list INTO { variable_name[,variable_name]... | record_name } FROM table [WHERE condition]
The INTO clause is required.
Queries must return only one row.
Demo 02
SELECT employee_id,last_name,salary,job_id FROM emp WHERE job_id = 'ST_CLERK'; DECLARE sal_increase employees.salary%TYPE := 800; BEGIN UPDATE emp SET salary = salary + sal_increase WHERE job_id = 'ST_CLERK'; COMMIT; END; / SELECT employee_id,last_name,salary,job_id FROM emp WHERE job_id = 'ST_CLERK';
相关文章推荐
- [bbk4980]第07集 - Chapter 04- Interacting with Oracle Database Server:SQL Statements in PL/SQL Programs(02)
- Top Ten (10) SQL Statements in Oracle Database
- Use aspnet_regsql with SQLServer database in App_Data
- Data Types with Different Maximum Sizes in oracle PL/SQL and SQL
- PL/SQL Enhancements in Oracle Database 10g
- Restore SQL Server database in same SQL server with different name
- MCITP SQL Server 2005 Database Developer All-in-One Exam Guide
- How To: Use Forms Authentication with SQL Server in ASP.NET 2.0
- How do I list user defined types in a SQL Server database
- START WITH and CONNECT BY in Oracle SQL
- Describe in brief Databases and SQL Server Databases Architecture.
- Database cannot be started in this edition of SQL Server" error when restoring a Microsoft Dynamics CRM database
- Oracle PL/SQL之WITH查询
- MS sqlserver数据库恢复出错 database is in use can not be restored
- How to Kill All Processes That Have Open Connection in a SQL Server Database[关闭数据库链接 最佳方法] -摘自网络
- [bbk2229] 第42集 - Chapter 11-SQL Statement Tuning(01)
- 不安装oracle、3分钟直接用pl/sql连接oracle server
- List the Stored Procedures in a SQL Server database
- List the Stored Procedures in a SQL Server database
- ORACLE SEND MAIL WITH PL/SQL