Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Add Months function with year multiplied into 12

Ram venuMar 20 2019 — edited Mar 21 2019

HI ,

We have SQL file with following query

first update query followed by select query

UPDATE customer_debt

   SET period_start_date = ADD_MONTHS(period__start_date,1900*12)

WHERE TO_NUMBER(TO_CHAR(period_start_date,'YYYY')) BETWEEN 76 AND 99

UPDATE customer_debt

   SET period_start_date = ADD_MONTHS(period_start_date,2000*12)

WHERE TO_NUMBER(TO_CHAR(period_start_date,'YYYY')) BETWEEN 0 AND 75

UPDATE customer_debt

   SET period_end_date = ADD_MONTHS(period_end_date,1900*12)

WHERE TO_NUMBER(TO_CHAR(period_end_date,'YYYY')) BETWEEN 76 AND 99

UPDATE customer_debt

   SET period_end_date = ADD_MONTHS(period_end_date,2000*12)

WHERE TO_NUMBER(TO_CHAR(period_end_date,'YYYY')) BETWEEN 0 AND 75

Select * from customer_debt where create_date between period_start_date and period-end_date;

I am trying to understand what is the purpose of using update statement , and update statement returns same date value as original.

help me to understand above update statements.

Thanks

Comments
Post Details
Added on Mar 20 2019
16 comments
2,619 views