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 a sql select statement?

562


What are the benefits of stored procedures?

530


What does a pl/sql package consist of?

512


What is synonyms?

570


What is union?

647






how to enter numeric values as hex numbers? : Sql dba

563


How insert into statements in sql?

586


Explain table and field in sql?

576


define join and explain different type of joins? : Sql dba

542


What is the difference between microsoft access and sql?

494


Which is faster truncate or drop?

552


What is the difference between delete, truncate and drop command?

544


What is implicit cursor in pl sql?

535


How do I truncate a word?

520


how tsql statements can be written and submitted to the database engine? : Transact sql

526