I’m trying to run a script that starts with
declare
l_current_host all_db_links.host%type;
l_rep_db varchar2(128);
l_sql varchar2(4000);
begin
select host
into l_current_host
from dual
left outer join sys.all_db_links
on owner = ‘UTL_KRG’
and db_link = ‘REP_UTL_KRG’;
To test I commented out the into clause, then blocked the query:
select host
– into l_current_host
from dual
left outer join sys.all_db_links
on owner = ‘UTL_KRG’
and db_link = ‘REP_UTL_KRG’;
and hit F9 - I get an ORA-00903: Invalid table name.
So I put my cursor on all_db_links and hit F4. Ok, so it exists and is accessible.
I then retried the query with Ctrl-Enter, still no luck.
So I copied the query to a new editor tab.
There it executes without problem.
@Dennis: I unchecked the statement terminator option. No difference. Since there are no blank lines in the statement, I’m not really surprised.
@Gregory: I commented out the into clause to test the query and validate its results interactively. Hence the attempt to execute the statment using F9 and Ctrl-Enter. F5 would run the whole script which should then result in an error due to the missing INTO clause…
@John: 11.2.0.4.0
Since the statement executes normally when issued in a separate editor tab, I suspect a Toad issue, though I cannot be 100% sure, of course.
So it seems in incomplete query is fired at Oracle.
Not surprising Oracle balks
I hope this helps you find the root cause.
If I need to do anything else to collect symptom data,
just let me know. I’ll be back in the office tomorrow moring.
Definitely that is a problem but I can’t tell where it’s coming from in our source since there is so little of the query to go on!
so, if you put this in the editor and run it with F9, does it fail consistently? If not, can you tell me how to change it so that it does?
declare
l_current_host all_db_links.host%type;
l_rep_db varchar2(128);
l_sql varchar2(4000);
begin
select host
into l_current_host
from dual
left outer join sys.all_db_links
on owner = ‘UTL_KRG’
and db_link = ‘REP_UTL_KRG’;
end;