21 Feb 2013

Floatting Currency in SQL Query

SQL> ---------------------------- USING FLOATING LOCAL CURRENCY (L)
/*
   START--->RUN-->REGEDIT
    HKEY LOCAL MACHINE-->>SOFTWARE-->>ORACLE-->>HOME0
    PRESS RIGHT CLICK ON RIGHT SIDE PORTION
    OPTION APPEAR WITH NEW-->>STRING_VALUE-->>NLS_CURRENCY
    THEN DOUBLE CLICK IT. PROVIDE THE Rs. IN VALUE OF DATA AND THEN PRESS OK
    CLOSE THE REGISTRY EDIT. AND RESTART THE COMPUTER TO SEE THE EFFECT
*/
SQL> SELECT SAL, TO_CHAR(SAL,'$99,999.99') FORM1,
  2* TO_CHAR(SAL,'L99,999.99') FROM EMP;

       SAL FORM1       TO_CHAR(SAL,'L99,999                                                        
---------- ----------- --------------------                                                        
       800     $800.00            Rs.800.00                                                        
      2600   $2,600.00          Rs.2,600.00                                                        
      1250   $1,250.00          Rs.1,250.00                                                        
      2975   $2,975.00          Rs.2,975.00                                                        
      1250   $1,250.00          Rs.1,250.00                                                        
      2850   $2,850.00          Rs.2,850.00                                                        
      2450   $2,450.00          Rs.2,450.00                                                        
      3000   $3,000.00          Rs.3,000.00                                                        
      5000   $5,000.00          Rs.5,000.00                                                        
      1500   $1,500.00          Rs.1,500.00                                                        
      1100   $1,100.00          Rs.1,100.00                                                        
       950     $950.00            Rs.950.00                                                        
      3000   $3,000.00          Rs.3,000.00                                                        
      1300   $1,300.00          Rs.1,300.00                                                        
      3500   $3,500.00          Rs.3,500.00                                                        

15 rows selected.

SQL>
 --- FOR TEMPORAY CHANGES
ALTER SESSION SET NLS_CURRENCY='£';

Session altered.

SQL>  SELECT SAL, TO_CHAR(SAL,'$99,999.99') FORM1,
  2   TO_CHAR(SAL,'L99,999.99') FROM EMP;

       SAL FORM1       TO_CHAR(SAL,'L99,999                                                        
---------- ----------- --------------------                                                        
       800     $800.00              £800.00                                                        
      2600   $2,600.00            £2,600.00                                                        
      1250   $1,250.00            £1,250.00                                                        
      2975   $2,975.00            £2,975.00                                                        
      1250   $1,250.00            £1,250.00                                                        
      2850   $2,850.00            £2,850.00                                                        
      2450   $2,450.00            £2,450.00                                                        
      3000   $3,000.00            £3,000.00                                                        
      5000   $5,000.00            £5,000.00                                                        
      1500   $1,500.00            £1,500.00                                                        
      1100   $1,100.00            £1,100.00                                                        
       950     $950.00              £950.00                                                        
      3000   $3,000.00            £3,000.00                                                        
      1300   $1,300.00            £1,300.00                                                        
      3500   $3,500.00            £3,500.00                                                        

15 rows selected.

No comments:

Post a Comment