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
Do ddl statements need commit?
Can I learn sql in a week?
How do you get column names only for a table (sql server)?
what is oltp (online transaction processing)? : Sql dba
what are the difference between clustered and a non-clustered index? : Sql dba
What is procedure and function?
What is difference between sql function and stored procedure?
What's the difference between inner join and left join?
Write the command to remove all players named sachin from the players table.
1) Synonyms 2) Co-related Subquery 3) Different Jobs in Plsql 4) Explain Plan 5) Wrap 6) Query Optimization Technique 7) Bulk Collect 8) Types of index 9) IF primary key is created then the index created ? 10) Foreign Key 11) Exception Handling 12) Difference Between Delete and Trunc 13) Procedure Overloading 14) Grant Revoke 15) Procedure Argument types. 16) Functions. 17) Joins
What is cascade in sql?
How can a function retun more than one value in oracle with proper example?
What is cursor and why it is required?
Why do you partition data?
Explain what is a database?