0
votes

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 DUAL@BLAH;

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

BEGIN
  SELECT * FROM DUAL@BLAH;
EXCEPTION
  WHEN OTHERS THEN
    NULL;
END;
2
remove the WHEN OTHERS THEN NULL and show us the output when you run the blockkevinskio

2 Answers

0
votes

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

begin
EXECUTE IMMEDIATE 'select * from dual@blah';
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).

0
votes

I suggest that ORA-02019 is run time error. The SQL is try to run the table at dblink but fails. That's why ORA-02019 occurred. While the ORA-00942 is compile time error. While compilation of begin..end block it is validating the objects. Validation failed and it has thrown the ORA-00942.