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

Which is better join or inner query?

700


Why do we use sql constraints? Which constraints we can use while creating database in sql?

726


What are stored procedures in mysql?

760


Explain the difference between drop and truncate commands in sql?

740


What has stored procedures in sql?

783






how to show all tables with 'mysql'? : Sql dba

816


What is auto increment feature in sql?

819


What do you understand by pl/sql packages?

768


Can we join 3 tables in sql?

705


How much ram can sql express use?

699


What is the difference between alter trigger and drop trigger statements?

797


what does the t-sql command ident_current does? : Transact sql

734


What is numeric function sql?

724


What is transaction control language (tcl)?

849


what are the 'mysql' command line options? : Sql dba

743