There are sometimes when you are writing and executing pl/sql functions or complex queries on the SQL Developer worksheet that for some reason you happen to forget to save or the battery on your laptop died and you were not able to save all that work. Or may be you were just too confident that you won't ever use that query or function again so you just did not save it.
But suddenly, some days or even weeks, you realise you need that function again and you start complaining an hitting yourself for not being able to save the query when you finished.
For that cases, sql developer saves an historic of the queries executed. Yes! each and every query you have executed on the worksheet window!
SQL Developer history files path
It is stored under %AppData%\SQL Developer\SqlHistory
You just need to open any xml file in your favourite text editor and start searching for your query.
You can now feel relief, but just in case, save any query or function you write, you might need it in the future.