PL/SQL Cursor Exercises: Display a table based detail information for the employee of ID 149 from the employees table
PL/SQL Cursor: Exercise-8 with Solution
Write a program in PL/SQL to display a table based detail information for the employee of ID 149 from the employees table.
Table based record
Sample Solution:
PL/SQL Code:
DECLARE
z_employee employees%ROWTYPE;
BEGIN
SELECT *
INTO z_employee -- INTO clause always notifies only single row can be fetch
FROM employees
WHERE employee_id = 149;
dbms_output.Put_line('Employee Details : ID:'
||z_employee.employee_id
||' Name: '
||z_employee.first_name
||' '
||z_employee.last_name
||' Salary: '
||z_employee.salary);
END;
/
Sample Output:
SQL> / Employee Details : ID:149 Name: Eleni Zlotkey Salary: 10500 PL/SQL procedure successfully completed.
Flowchart:
Improve this sample solution and post your code through Disqus
Previous: Write a program in PL/SQL to create a table-based record using the %ROWTYPE attribute.
Next: Write a program in PL/SQL to display a cursor based detail information of employees from employees table.
What is the difficulty level of this exercise?
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework