PHP Code:
SQL> set serverout on
SQL> r
1 declare
2 read_only_ts exception;
3 pragma exception_init ( read_only_ts, -1642 );
4 sql_stmt varchar2(250);
5 ErrorMsg varchar2(200) :=SQLERRM;
6 begin
7 dbms_output.put_line('print line 1 ');
8 sql_stmt:= 'alter tablespace d2_claim begin backup';
9 execute immediate sql_stmt;
10 ErrorMsg := SQLERRM;
11 dbms_output.put_line('print line 2 ');
12 exception
13 when read_only_ts then null;
14 when others then
15 insert into admin.backup_error
16 (backup_date, tablespace_name, error_code)
17 values
18 ( sysdate, '$Tablespace', ErrorMsg );
19 commit;
20* end;
print line 1
PL/SQL procedure successfully completed.
SQL>
anyone know why i'm getting
"print line 1" but not getting "print line 2"??
if i comment out "execute immediate" line, both lines print
1 declare
2 read_only_ts exception;
3 pragma exception_init ( read_only_ts, -1642 );
4 sql_stmt varchar2(250);
5 ErrorMsg varchar2(200) :=SQLERRM;
6 begin
7 dbms_output.put_line('print line 1 ');
8 sql_stmt:= 'alter tablespace d2_claim begin backup';
9 -- execute immediate sql_stmt;
10 ErrorMsg := SQLERRM;
11 dbms_output.put_line('print line 2 ');
12 exception
13 when read_only_ts then null;
14 when others then
15 insert into admin.backup_error
16 (backup_date, tablespace_name, error_code)
17 values
18 ( sysdate, '$Tablespace', ErrorMsg );
19 commit;
20* end;
SQL> /
print line 1
print line 2
PL/SQL procedure successfully completed.
tia,
d.