Reputation: 344
I have issue change ADD_MONTHS
Oracle to PostgreSQL.
I have Oracle query like this :
ADD_MONTHS (to_date(to_char(start_billdate,'DD-MM-YYYY'),'DD-MM-YYYY'),
(processed_num*periodvalue)
)
So how to implement that query to PostgreSQL?
Upvotes: 0
Views: 996
Reputation: 142720
One option might be to multiply number of months (processed_num * periodvalue
) with the interval of 1 month and add that to start_billdate
:
start_billdate + (interval '1 month' * processed_num * periodvalue);
Upvotes: 2
Reputation:
You can construct an interval with the contents of the column:
start_billdate + make_interval(months => processed_num*periodvalue)
Upvotes: 1