Synonym compiles but is not found

I compile a Synonym and get this
image

I go to the Schema Browser, refresh, and get
"Target object could not be found."
for the one that just compiled correctly. What am I doing wrong? What am I missing?

Hi Louie.

I'm not trying to be a jerk but just to be clear - you didn't compile a synonym, you created one.

Target objects don't need to exist for synonyms to be created.

Try this:

Create synonym SynGoodLuckWithThis for MyAwesomeNonExistentObject;

You can create that with no errors. The error comes when you try to use it.

-John

Yes, senior moment. Frustrated with this mess I inherited.

So what target object is it referring to? The original coders of this mess have the same synonym in different schemas all pointing to the same table. I look, the table is there, but is currently empty. Would that cause an issue? It's been a while since I messed with a synonym, much less 172 of them. Thank you.

You can look up the target object by running this in the Editor.

select *
from dba_synonyms
where synonym_name = 'SYNGOODLUCKWITHTHIS';

Or you can look in the Schema Browser:

If the target object is a table which exists but is not empty, that will not produce the "Target object could not be found" error. But maybe the synonym points to an object that you aren't expecting (maybe the wrong schema?)

You can always turn on Spool SQL to try to isolate the problem.

Main Menu -> Database -> Spool SQL -> Spool to Screen.

It will show all SQL that Toad runs along with any errors. If you aren't sure what one of them means, post it here and I'll be happy to help.

Thank you. I just went back to Schema Browser to check something and now the one that said Target Object... is now there. Is there a delay when I do the refresh?

There is no delay when you refresh the Schema Browser. There are 3 refresh buttons and there is some caching going on in Toad, so maybe that was the problem. If you want to refresh the entire Schema Browser, use this refresh button.

Thank you. It's not TOAD, it's the project I inherited. I'll get there.