Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Assign Query Results to Variables
How To Assign Query Results to Variables? - Oracle DBA FAQ - Working with Database Objects in PL/SQL
✍: FYIcenter.com
If you want to assign results from SELECT statements to variables, you can use the INTO clause, which an extension of SELECT statements for PL/SQL. The sample code below shows some good example on INTO clause:
DECLARE total NUMBER; now DATE; fname VARCHAR2(10); lname VARCHAR2(10); BEGIN SELECT COUNT(*) INTO total FROM employees; DBMS_OUTPUT.PUT_LINE('Count = ' || TO_CHAR(total)); SELECT SYSDATE INTO now FROM DUAL; DBMS_OUTPUT.PUT_LINE('Now = ' || TO_CHAR(now, 'SSSSS')); SELECT first_name, last_name INTO fname, lname FROM employees WHERE employee_id = 100; DBMS_OUTPUT.PUT_LINE('Name = ' || fname || ' ' || lname); END; / Count = 107 Now = 82375 Name = Steven King
2007-04-27, 9513👍, 0💬
Popular Posts:
How To Enter Numeric Values as HEX Numbers? - MySQL FAQs - Introduction to SQL Basics If you want to...
What is Traceability Matrix? Traceability Matrix is one of the document will prepare by QA.To make s...
What invokes a thread's run() method? After a thread is started, via its start() method of the Threa...
What are the different accessibility levels defined in .NET ? Following are the five levels of acces...
How To Set Up Breakpoints in Debug Mode? - Oracle DBA FAQ - Introduction to Oracle SQL Developer To ...