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



Write a procedure to return the month and the number of developers joined in each month (cursor )..

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

Write a procedure to return the month and the number of developers joined in each month (cursor )..

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

Post New Answer

More SQL PLSQL Interview Questions

how to calculate expressions with sql statements? : Sql dba

0 Answers  


Why do we use procedures in sql?

0 Answers  


What is oracle ? why we should go for oracle database instead of diffrent databases available in the industry.

5 Answers   Polaris,


How can I see all tables in sql?

0 Answers  


How many types of privileges are available in sql?

0 Answers  






What will be the output of this Query? select to_char(trunc(add_months(sysdate-3),mm),mm/dd/yyyy) from dual

6 Answers   Cap Gemini, TCS,


What is the difference between partitioning and sharding?

0 Answers  


How does left join work in sql?

0 Answers  


How do I remove sql developer from windows 10?

0 Answers  


What is the difference between functions, procedures, and packages in pl/sql?

0 Answers  


What is cost in sql execution plan?

0 Answers  


how can we encrypt and decrypt a data present in a mysql table using mysql? : Sql dba

0 Answers  


Categories