when in SQLplus on the server in OCI sysdate returns the coirrect date and time, however when we execute select sysdate from dual in Toad we get the time as being 1 hour behind what the database says it is.
does anyone know if there is a setting in Toad to fix this or is it a bug?
I've had similar problems in the cloud. The application code used SYSDATE throughout and was getting the wrong times back as the cloud servers were all Oracle Linux with the UTC timezone. We were not allowed to change that.
If I remember correctly, we changed the code to use CURRENT_DATE instead.
SYSDATE returns the server time with apparently no adjustments for the session timezone. In our case, we got UTC from the server. Our sessions were in BST and thus an hour out.
CURRENT_DATE returns the server date and time adjusted to the sessions timezone.
If SQLPlus gives different results from Toad, check your session timezone for each and compare.
I suspect Toad gets its timezone from the control panel setup in Windows. I would have though SQL*Plus should also, but don't know.
Toad would then be setting the session timezone appropriately and dates etc would be correct, except SYSDATE doesn't care about the session timezone, only the DB Server timezone.
@NormTeamT when OP first mentioned SQL*Plus, it was on the server, so my guess is that the PC and server are in different time zones. I'd be willing to bet that SQL*Plus on the desktop and Toad give the same sysdate.
Ah, right, I either missed that, or completely forgot. I blame a lack of sleep due to having an 11 week old puppy running my life!
I would agree with you then. The server and PC are most likely in different timezones. OCI is always (?) set to UTC and I'm not sure it is allowed to be changed.
In my last contract, we were not allowed to change it. That was OCI.
Take care, hope you are well John. Greetings from "Plague Island".