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

What is nvarchar in sql?

520


What is a subquery in sql?

505


What are the different dcl commands in sql?

559


What do you know by pl/sql cursors?

562


Does inner join remove duplicates?

518






how can we destroy the cookie? : Sql dba

555


What are the different types of sql commands?

598


Can we insert data in view?

501


Mention what are the benefits of pl/sql packages?

533


Is sql the best database?

498


what is a primary key? : Sql dba

552


What is sqlservr exe?

478


Can you upgrade sql express to full sql?

512


What is difference between cursor and trigger?

551


what is a cursor? : Sql dba

552