SQL>
SQL> set echo on
SQL>
SQL> create table t ( msg varchar2(20), cnt int );
Table created.
SQL>
SQL> insert into t select 'from SQL*PLUS', count(*) from session_roles;
1 row created.
SQL>
SQL> variable n number
SQL>
SQL> exec dbms_job.submit(:n,'insert into t select ''from job'', count(*) from session_roles;');
PL/SQL procedure successfully completed.
SQL>
SQL> print n
N
----------
181
SQL>
SQL> exec dbms_job.run(:n);
PL/SQL procedure successfully completed.
SQL>
SQL> select * from t;
MSG CNT
-------------------- ----------
from SQL*PLUS 12
from job 0
SQL> drop table t;
Table dropped.
SQL>
|