Oracle 11g query strange behavior
I'm trying to write a script that will modify log files for oracle database.
Currently I've encountered a very strange behavior when writing the piece
of code that should have switched logfile if the current one is active.
The problem is:
When I execute the following script:
DECLARE
g_status v$log.status%type;
BEGIN
select status into g_status from v$log where group# = 2;
if g_status = 'CURRENT' then
EXECUTE IMMEDIATE('alter system switch logfile;');
end if;
END;
/
I get
SQL> @testSwitch
PL/SQL procedure successfully completed.
But when I change just one number
DECLARE
g_status v$log.status%type;
BEGIN
select status into g_status from v$log where group# = 1;
if g_status = 'CURRENT' then
EXECUTE IMMEDIATE('alter system switch logfile;');
end if;
END;
/
It gives me
SQL> @testSwitch
DECLARE
*
ERROR at line 1:
ORA-00911: invalid character
ORA-06512: at line 6
I'm not sure, that this script will work properly and really switch
logfile, but I don't get why does THIS happen.
Can anyone help?
No comments:
Post a Comment