Tuesday, January 16, 2024

Conversion crore and Lac in Oracle Sql

 CREATE OR REPLACE FUNCTION number_to_core_lac(p_number IN NUMBER) RETURN VARCHAR2 IS

  l_crores NUMBER := TRUNC(p_number / 10000000);

  l_lacs   NUMBER := TRUNC(MOD(p_number, 10000000) / 100000);

BEGIN

  RETURN CASE 

           WHEN l_crores > 0 AND l_lacs > 0 THEN l_crores || ' Core, ' || l_lacs || ' Lac'

           WHEN l_crores > 0 THEN l_crores || ' Core'

           WHEN l_lacs > 0 THEN l_lacs || ' Lac'

           ELSE '0 Lac'

         END;

END;

/


SELECT number_to_core_lac(99994050000) AS "55 Core, 44 Lac" FROM DUAL;


No comments:

Post a Comment

How to install and configure Oracle Apex 24.1 with ORDS 22, Tomcat 9 and Jasper Report 7 on Oracle Linux 8.10

#########################Install Oracle  APEX 24.1################################ ----------------------------------------------------...