One orbit. Consider the projectile just as it leaves the barrel, if it is in orbit then this point is on its orbit. It will return. The earth will have rotated the gun away, but the projectile is still going to come back into the atmosphere where it will lose too much energy to continue.
Any useful orbit needs to be above the atmosphere and would have to be shot from there.
You could use a secondary nudge of some sort to round out the orbit once it is in space and keep the projectile up, but making such a device that will survive the initial acceleration is unlikely.
"making such a device that will survive the initial acceleration is unlikely"
Bear in mind that using an electromagnetic launcher you could accelerate (relatively) gradually over a length of track, the so-called "Mass Driver" concept.
I think this can get you most of the way there, using some form of atmospheric steering. Best case you could get your nearest approach tangent to the highest spot of atmosphere. You still need a bit more to avoid the atmosphere entirely, but your are mostly there.
Lowering the orbit isn't the problem, if it's already fast enough. The problem is that the end of the velocity change is still going to be in the atmosphere.
Any useful orbit needs to be above the atmosphere and would have to be shot from there.
You could use a secondary nudge of some sort to round out the orbit once it is in space and keep the projectile up, but making such a device that will survive the initial acceleration is unlikely.