る form and おう form of verbs when used with と思う


What's the difference between these 2 sentences:

> 買ってくると思った  
>  買ってこようと思った

Both of them translates to 'I thought that I'd go and buy'




買ってくると思った。 I understood that someone went shopping and I thought he would buy
it but He didn't.

買ってこようと思った。 'I thought that I'd go and buy' For example. 買ってこようと思ったのに、忘れた。 I
thought that I'd go and buy、 but I forgot about it. その話を聞いて、今度買ってこようと思った。
After I had the conversation, I decided to buy it.

