Write a procedure to return the month and the number of
developers joined in each month (cursor )

Answer Posted / rajesh venati

CREATE OR REPLACE PROCEDURE PRO
IS
CURSOR ECUR IS SELECT TO_CHAR(HIREDATE,'MON')
V_MONTH,COUNT(*) V_NO FROM EMP GROUP BY TO_CHAR(HIREDATE,'MON');
BEGIN
FOR V_ECUR IN ECUR LOOP
DBMS_OUTPUT.PUT_LINE(V_ECUR.V_MONTH||' '||V_ECUR.V_NO);
END LOOP;
END;


SQL> EXEC PRO;
DEC 3
APR 2
NOV 1
SEP 2
FEB 2
JUN 1
MAY 2
JAN 1

Is This Answer Correct ?    15 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you pronounce sql?

548


what are the drivers in mysql? : Sql dba

552


What is sql catalog?

563


How do I start sql profiler?

556


what are the different tables present in mysql? : Sql dba

503






how can we find the number of rows in a table using mysql? : Sql dba

585


What is plpgsql language?

530


how to include comments in sql statements? : Sql dba

544


how to enter characters as hex numbers? : Sql dba

569


What found sql?

521


What is the mutating table and constraining table?

558


What is an index? What are the types of indexes? How many clustered indexes can be created on a table?

551


What is left inner join in sql?

518


Can variables be used in sql statements?

552


How is sql used in oracle?

581