select pair value into two variables : Select into « PL SQL Statements « Oracle PL/SQL Tutorial

Oracle PL/SQL Tutorial
1. Introduction
2. Query Select
3. Set
4. Insert Update Delete
5. Sequences
6. Table
7. Table Joins
8. View
9. Index
10. SQL Data Types
11. Character String Functions
12. Aggregate Functions
13. Date Timestamp Functions
14. Numerical Math Functions
15. Conversion Functions
16. Analytical Functions
17. Miscellaneous Functions
18. Regular Expressions Functions
19. Statistical Functions
20. Linear Regression Functions
21. PL SQL Data Types
22. PL SQL Statements
23. PL SQL Operators
24. PL SQL Programming
25. Cursor
26. Collections
27. Function Procedure Packages
28. Trigger
29. SQL PLUS Session Environment
30. System Tables Data Dictionary
31. System Packages
32. Object Oriented
33. XML
34. Large Objects
35. Transaction
36. User Privilege
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Oracle PL/SQL Tutorial » PL SQL Statements » Select into 
22. 10. 16. select pair value into two variables
SQL>
SQL> CREATE TABLE employee (
  2     emp_id NUMBER,
  3     last_name VARCHAR2(30),
  4     first_name VARCHAR2(30),
  5     salary NUMBER
  6  );

Table created.

SQL> INSERT INTO employee (emp_id, last_name, first_name, salary)VALUES (1'G''J'100000);

row created.

SQL>
SQL> INSERT INTO employee (emp_id, last_name, first_name, salary)VALUES (2'G''H'100000);

row created.

SQL>
SQL>
SQL> DECLARE
  2     employee_rowid UROWID;
  3     employee_salary NUMBER;
  4  BEGIN
  5     SELECT rowid, salary INTO employee_rowid, employee_salary
  6     FROM employee
  7     WHERE last_name='G' AND first_name='J';
  8
  9     UPDATE employee
 10        SET salary = employee_salary
 11      WHERE rowid = employee_rowid;
 12  END;
 13  /

PL/SQL procedure successfully completed.

SQL>
SQL> drop table employee;

Table dropped.

SQL>
SQL>
SQL>
22. 10. Select into
22. 10. 1. Use Select into statement to assign value to a variable
22. 10. 2. Multiple-Row SELECT Command with Several Exception-Handling Routines: set value in exception handler
22. 10. 3. Select data into record type data
22. 10. 4. Select data into PL/SQL table of cursor
22. 10. 5. Select count value into a variable
22. 10. 6. Use if statement to check the selected into value
22. 10. 7. Use more than one entrances in if statement to handle the value returned from a select into
22. 10. 8. Retrieving a single row: The basic syntax
22. 10. 9. Use IF-THEN-ELSE to check the return value from the select into statement
22. 10. 10. SELECT into ROWTYPE
22. 10. 11. SELECT into TYPE
22. 10. 12. Multiple-row SELECT command.
22. 10. 13. Multiple-row SELECT command with several exception-handling routines
22. 10. 14. Create a loop that prints a list of all employees and their managers
22. 10. 15. You must have the same datatypes in both the SELECT and INTO clauses.
22. 10. 16. select pair value into two variables
22. 10. 17. Build an anonymous block that will trigger an error.
22. 10. 18. Demo a SELECT INTO with exception handling
22. 10. 19. Select into and subquery
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.