The table or view does not exist when DBlink is incorrect

advertisements

If I run the below query, I'm getting ORA-02019 connection description for remote database not found as the DBlink BLAH is not there.

SELECT * FROM [email protected];

But if I put it in an anonymous block, its giving ORA-00942 table or view does not exist error.

BEGIN
  SELECT * FROM [email protected];
EXCEPTION
  WHEN OTHERS THEN
    NULL;
END;


Try this (Dynamic SQL), you would get ORA-02019 connection description for remote database not found

begin
EXECUTE IMMEDIATE 'select * from [email protected]';
end;
/

The other error ORA-00942 table or view does not exist is probably a compilation error and not a runtime error.

Reason for the compilation error is, blah is unknown to oracle during the semantic checks on compilation since it is not defined (synonyms).