是这样的,我要建一个 job scheduler,每个小时执行这段代码DECLARE
CURSOR free_space IS
SELECT tablespace_name,sum(bytes)/1024/1024
FROM dba_free_space
WHERE tablespace_name='USERS'
GROUP BY tablespace_name; tablename dba_free_space.tablespace_name%type;
freespace dba_free_space.bytes%type; BEGIN
OPEN free_space;
FETCH free_space INTO tablename,freespace;
INSERT INTO free_space_data VALUES(
tablename, freespace,systimestamp);
CLOSE free_space;
END;我看到说建job的时候有 job_type => 'STORED_PROCEDURE'
我就想把这段弄成一个STORED_PROCEDURE,然后去调用
应该怎么写呢?
CURSOR free_space IS
SELECT tablespace_name,sum(bytes)/1024/1024
FROM dba_free_space
WHERE tablespace_name='USERS'
GROUP BY tablespace_name; tablename dba_free_space.tablespace_name%type;
freespace dba_free_space.bytes%type; BEGIN
OPEN free_space;
FETCH free_space INTO tablename,freespace;
INSERT INTO free_space_data VALUES(
tablename, freespace,systimestamp);
CLOSE free_space;
END;我看到说建job的时候有 job_type => 'STORED_PROCEDURE'
我就想把这段弄成一个STORED_PROCEDURE,然后去调用
应该怎么写呢?
CURSOR free_space IS
SELECT tablespace_name,sum(bytes)/1024/1024
FROM dba_free_space
WHERE tablespace_name='USERS'
GROUP BY tablespace_name; tablename dba_free_space.tablespace_name%type;
freespace dba_free_space.bytes%type; BEGIN
OPEN free_space;
FETCH free_space INTO tablename,freespace;
INSERT INTO free_space_data VALUES(
tablename, freespace,systimestamp);
CLOSE free_space;
END;