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
Why do we use view in sql?
how to fetch alternate records from a table? : Sql dba
What kind of join is join?
What is a rank in sql?
Are sql database names case sensitive?
What is the primary use of normalization?
What is cursor status?
Can you selectively load only those records that you need? : aql loader
what is a tablespace? : Sql dba
what is the difference between mysql_fetch_object and mysql_fetch_array? : Sql dba
What is range partitioning?
What is difference between sql function and stored procedure?
How do you create a db file?
what is recursive stored procedure? : Sql dba
Is sql a backend language?