Saturday, May 5, 2018

Using TO_DATE in PLSQL Query

https://randomsrsolutions.blogspot.com/2018/05/using-todate-in-plsql-query.html

select '14-AUG-1947' A from Dual;
14-AUG-1947

select to_date('14-AUG-1947') A from Dual;
14-AUG-47

select Next_Day('14-AUG-1947', 'SUNDAY') A from Dual;
17-AUG-47

select Next_Day(to_date('14-AUG-1947'), 'SUNDAY') A from Dual; 
17-AUG-47

select to_char(to_date('14-AUG-1947'), 'RRRR') TOT_YEARS from dual;
1947

select to_date('14-AUG-1947', 'DD-MON-RRRR') A from dual;
14-AUG-47

select to_date('AUGUST 14, 1947', 'MONTH DD, RRRR') A from dual;
14-AUG-47

select to_date('AUG' ,'MON') from dual;
01-AUG-18

select to_date('14','DD') from dual;
14-MAY-18

select to_date('1947', 'RRRR') from dual;
01-MAY-47

select to_date('AUG 1947', 'MONTH RRRR') from dual;
01-AUG-47

select to_date('14 AUG 1947','DD MONTH RRRR') from dual;
14-AUG-47

select HIREDATE from EMP where HIREDATE = to_date('17/12/1980','DD/MM/RRRR');
17-DEC-80


Nesting Functions
Single-row functions can be nested to any depth. Nested functions are evaluated from the innermost level to the outermost level.
F3(F2(F1(col,arg1),arg2),arg3)

select to_number(to_char(to_date('14-AUG-1947'), 'RRRR')) from dual;
1947

No comments:

Post a Comment

XLA to GL Link

  https://plsqlquery.blogspot.com/2025/12/xla-to-gl-link.html SELECT             acr.cash_receipt_id,             acr.receipt_number,       ...