Oracle PL/SQL practice questions
On request of our students, please find below Oracle PL/SQL practice questions.
These examples will use tables in Oracle’s sample database Scott.
These exercises will require Oracle Installation.
Please provide your solution/code in the comment section.
Note: This blog does not contain the solutions, since it will fail the purpose. If you need the answers, please email us at hello@ohiocomputeracademy.com
Create a copy of Emp table
Create a table emp2. This table will be used for the practice code, so that you don’t change the original data in the emp table.
Create table emp2 as
Select * from emp;
Oracle PL/SQL Practice questions
- Use emp2 table. Write a PL/SQL code to update Salary of employee number 7521. Modify the salary to 6070 if it is less than 4000; Insert all the details of employee no. 7521 to a new table temp1 which has the same structure as emp table.
Note: temp1 table does not exist in your database, first create the temp1 table. - Write a PL/SQL code to print 10 numbers from 100 – 110. Also insert these number in the temp2 table.
Temp2 table contains only one column of datatype number.
Note: temp2 table doesn’t exist, so first create the table 4. - Use table emp2. Update the commission of the employee number 7499 to $300, if it is Null; else raise his commission by 25%.
- Create a procedure Newemp_Proc to insert a new row in the table emp2. The values to be inserted are empno, ename and sal
- Use table emp2. Create a procedure DisplayEmp_Proc to display all the employee numbers and names from the emp2 table using a cursor. Execute the procedure to get the output.