Examine the structure of employee table. You issue the following query:DECLAREl_vc_firstname employee.emp_name%type;l_salary employee.salary%type;BEGINSELECT emp_name, salary INTO l_vc_firstname, l_salary FROM employee WHERE emp_id=201;dbms_output.put_line('Number of rows processed: '||sql%rowcount);END;/What will be the outcome of above query?
Question
Examine the structure of employee table. You issue the following query:DECLAREl_vc_firstname employee.emp_name%type;l_salary employee.salary%type;BEGINSELECT emp_name, salary INTO l_vc_firstname, l_salary FROM employee WHERE emp_id=201;dbms_output.put_line('Number of rows processed: '||sql%rowcount);END;/What will be the outcome of above query?
Solution
The query you provided is written in PL/SQL, Oracle's procedural language. It declares two variables, l_vc_firstname and l_salary, which are of the same type as emp_name and salary in the employee table respectively.
The BEGIN and END; statements encapsulate a block of code that is executed as a single unit.
The SELECT statement within this block is used to fetch the emp_name and salary of the employee with emp_id equal to 201. The fetched values are then stored into the variables l_vc_firstname and l_salary respectively.
The dbms_output.put_line function is then used to display the number of rows processed by the SELECT statement.
The sql%rowcount attribute gives the number of rows processed by the SQL statement most recently executed.
So, the outcome of the above query will be a line of output displaying the number of rows processed by the SELECT statement. If the emp_id 201 exists in the employee table, the sql%rowcount will return 1, otherwise, it will return 0.
Similar Questions
An expression below creates a procedure emp_infor that accept two parameters: employeeno and job_title, then pass them toexplicit cursor named emp_list to retrieve the firstname, lastname, hiredate, job_id and salary, of all employees earning a salaryless that 11000 and have an “O” as the second letter in the lastname. Create an anonymous block that will call the procedure todisplay the details of employee as per entry of job_title and employeeno parameters. Use this table Employee (employeeno,firstname, lastname, hiredate, job_id ,salary, job_title)
Table employee has 10 records. It has a non-NULL SALARY column which is also UNIQUE.The SQL statementSELECT COUNT(*) FROM Employee WHERE SALARY> ANY(SELECT SALARY FROM EMPLOYEE);Prints10950
Which of the below queries displays employees' name and new salary after the increment of 1000? SELECT ename, sal FROM emp;SELECT ename, sal=sal+1000 FROM emp;SELECT ename, sal+1000 FROM emp;SELECT ename, 1000 FROM emp;
Write queries for the following tables:T1 ( Empno, Ename , Salary, Designation)T2 (Empno, Deptno.)(1) Display the Deptno in which Employee Seeta is working.(2) Display Empno, Ename, Deptno.
employee_id Name Salary1001 Annie 60001009 Ross 45001018 Zeith 7000above are the Employee table details.select employee_id from employee order by employee_id desc;Which of the following output will be true?
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.