Software QA (13)
SQL Server (1)
How To Assign Query Results to Variables
How To Assign Query Results to Variables? - Oracle DBA FAQ - Working with Database Objects in PL/SQL
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, 9392👍, 0💬
How To Run "mysql" Commands from a Batch File? - MySQL FAQs - Command-Line End User Interface mysql ...
What is normalization? What are different types of normalization? It is set of rules that have been ...
What are the core functionalities in XML .NET framework? Can you explain in detail those functionali...
What is DAR (Decision Analysis and Resolution) ? Decision Analysis and Resolution is to analyze poss...
Do You Know the Book "JUnit in Action"? You should know this book. It received some good reviews. Ti...