Student or Learner
I was here whole night.
I had been here whole night.
He was the king of Israel.
He had been the king of Israel.
He was in jail.
He had been in jail.
I have heard and seen such types of sentences. What is the difference between "was" and "had been"
Not a teacher
It's easier to understand the difference if you associate them with a definite time in the past and an indefinite time prior to a point in the past. So, maybe the following will help:
He was the king of Israel at that time
He had been the king of Israel before the Roman invasion
He was in jail that summer.
He had been in jail before that summer.