Question: The following query returns 

```
select to_char( trunc(sysdate) - numtoyminterval(level - 1, 'month'), 'mon-yy') as month from dual connect by level <= 12

```

last 12 months according to today's date(i.e. 2-Jan-18).

[![enter image description here](https://i.stack.imgur.com/Sd9ZQ.png)](https://i.stack.imgur.com/Sd9ZQ.png)

Say if today's date is 29-DEC-17 it gives oracle sql error: 
**ORA-01839: date not valid for month specified**
(since on subtracting there would be a date in the result as **'29-FEB-17'** which is not possible). So on specific dates this error would pop-up. How do you suggest to overcome this?

Answer: 
`char` is `signed` on your platform.

If you use `unsigned char` for your types for `c2` and `c1` then the implicit promotion to `int` for each term in your expression will have the effect you are after.
You can use multiplication instead of shifting:

```
int i = (int)c2 * 256 + c1;

```