taking an oath in the mind

Taking an oath in the mind

Q:

1. If one takes an oath in the mind, is it valid? Suppose if we realize that our oath is invalid (oath on not to do something etc) is it necessary to keep up our oath?

2. If we take an oath by saying 'Allah qasam' does it mean oath or promise and even if we take by that word is it valid if we say it in mind?

3. I do not want to take an oath on particular things but if I make it against my will without making up my mind (to say like I feel like I took an oath in mind within 3 or 4 seconds against my willing) but I think I didn't take it intentionally but I feel to be not sure also. In this case should I keep up my oath or no need?

4. Does an unwilling or unintentional oath or promise count?