Write a procedure to return the month and the number of
developers joined in each month (cursor )
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / prabhudatta barick
CREATE OR REPALCE PROCEDURE EMP_PRO
IS
BEGIN
FOR EMP_CUR IN(SELECT SUBSTR(EMP_DOA,4,3) MONTH,
COUNT(*) NO_OF_EMP
FROM HRD_EMPLOYEETB
GROUP BY SUBSTR(EMP_DOA,4,3)
ORDER BY 1)
LOOP
DBMS_OUTPUT.PUT_LINE(EMP_CUR.MONTH||' '||EMP_CUR.NO_OF_EMP);
END LOOP;
END;
Is This Answer Correct ? | 0 Yes | 0 No |
what is definer rights invoke rights?
Is primary key clustered index?
How to write a procedure for displying the data in a TREE or (PARENT and CHILD ) relationship , for ex: A is the main project id, for this project B,C,D are sub tasks(sub project id's) for B the sub tasks are e,f,g and for c is h ,i ,j and for d is k,l,m now i need to display the o/p in a TREE fashion pls help me , thanks in advance surendra
How to combine two stored procedures in sql?
What are the built in functions of sql?
what is a table called, if it has neither cluster nor non-cluster index? What is it used for? : Sql dba
Differentiate pl/sql and sql?
What is data type in sql?
How can analyze query after generating explain plan ?
What are the advantages of the packages
Why do we need cursors in pl sql?
What is an exception in pl/sql?