單個過程獲取指令碼
declare
v_text varchar2(4000);
v_line number;
v_min_line number;
v_max_line number;
-- i_owner varchar2(30);
-- i_object varchar2(30);
cursor c_as is
select line,case when line=1 then 'create or replace '||text
else text
end text
from all_source where owner='J1_G3_ZBQ' and name ='CP_TRANS_G3SJGS';
fhandle utl_file.file_type;
begin
select min(line),max(line) into v_min_line,v_max_line from all_source where owner='J1_G3_ZBQ' and name ='CP_TRANS_G3SJGS';
fhandle := utl_file.fopen('EXP_DIR','CP_TRANS_G3SJGS.sql', 'w',32767);
for cur in c_as loop
v_text :=cur.text;
v_line :=cur.line;
if v_line=v_max_line then
utl_file.put_line(fhandle ,replace(replace(v_text,chr(10),'/'),';',';'||chr(10)||'/'));
-- dbms_output.put_line(replace(v_text,chr(10),'/'));
else
utl_file.put_line(fhandle ,replace(v_text,chr(10),''));
-- dbms_output.put_line(replace(v_text,chr(10),''));
end if;
end loop;
utl_file.fclose(fhandle);
end;
/
v_text varchar2(4000);
v_line number;
v_min_line number;
v_max_line number;
-- i_owner varchar2(30);
-- i_object varchar2(30);
cursor c_as is
select line,case when line=1 then 'create or replace '||text
else text
end text
from all_source where owner='J1_G3_ZBQ' and name ='CP_TRANS_G3SJGS';
fhandle utl_file.file_type;
begin
select min(line),max(line) into v_min_line,v_max_line from all_source where owner='J1_G3_ZBQ' and name ='CP_TRANS_G3SJGS';
fhandle := utl_file.fopen('EXP_DIR','CP_TRANS_G3SJGS.sql', 'w',32767);
for cur in c_as loop
v_text :=cur.text;
v_line :=cur.line;
if v_line=v_max_line then
utl_file.put_line(fhandle ,replace(replace(v_text,chr(10),'/'),';',';'||chr(10)||'/'));
-- dbms_output.put_line(replace(v_text,chr(10),'/'));
else
utl_file.put_line(fhandle ,replace(v_text,chr(10),''));
-- dbms_output.put_line(replace(v_text,chr(10),''));
end if;
end loop;
utl_file.fclose(fhandle);
end;
/
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29802484/viewspace-1767282/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Universal-Image-Loader原始碼解解析---display過程 + 獲取bitmap過程原始碼
- Spring原始碼剖析4:懶載入的單例Bean獲取過程分析Spring原始碼單例Bean
- jenkins pipline指令碼 獲取git分支Jenkins指令碼Git
- 常用指令碼:獲取隱含引數指令碼
- shell指令碼中main函式中$#獲取不到指令碼傳入引數個數淺析指令碼AI函式
- ES系列(五):獲取單條資料get處理過程實現
- Spring原始碼剖析4:其餘方式獲取Bean的過程分析Spring原始碼Bean
- shell指令碼獲取函式返回值指令碼函式
- shell指令碼獲取時間格式化指令碼
- 獲取sql完整指令碼,get_fulltext.shSQL指令碼
- PostgreSQL獲取建表語句儲存過程SQL儲存過程
- Linux c程式中獲取shell指令碼輸出(如獲取system命令輸出)LinuxC程式指令碼
- 2 個簡單的 python 指令碼,連線 MySQL 和讀取 ExcelPython指令碼MySqlExcel
- loadrunner12.6快速實戰之透過抓包來獲取app測試指令碼APP指令碼
- 【Redis】獲取沒有設定ttl的key指令碼Redis指令碼
- vbs指令碼獲取Am註冊路徑資訊指令碼
- 獲取AWR的指令碼,可以在crontab裡面部署指令碼
- 透過硬體識別符號獲取過程映像輸入符號
- 指令的執行過程
- jQuery獲取表單值及幾個表單事件jQuery事件
- 線上定時指令碼執行慢,分析過程指令碼
- sqlserver資料庫還原儲存過程指令碼SQLServer資料庫儲存過程指令碼
- Linux Shell獲取正在執行指令碼的絕對路徑Linux指令碼
- Python指令碼的常見引數獲取和處理方式Python指令碼
- Bash 指令碼例項:獲取符號連結的目標位置指令碼符號
- 使用TensorFlow 來實現一個簡單的驗證碼識別過程
- 如何獲取 vue 單檔案自身原始碼路徑Vue原始碼
- 簡單上手SpringBean的整個裝配過程SpringBean
- 【Azure Redis 快取】使用Python程式碼獲取Azure Redis的監控指標值 (含Powershell指令碼方式)Redis快取Python指標指令碼
- 獲取所有域使用者的登陸歷史資訊指令碼指令碼
- 採用lua指令碼獲取mysql、redis資料以及jwt的校驗指令碼MySqlRedisJWT
- 客戶端的js js指令碼的引入 js的解析過程客戶端JS指令碼
- 獲取AOSP原始碼原始碼
- 獲取上個月
- 聊天平臺原始碼,通過MediaStore獲取縮圖模糊原始碼AST
- 通過用shellcode獲取shell
- 今天在linux上用perl連線sqlserver,執行儲存過程,獲取一個結果集LinuxSQLServer儲存過程
- bigget_nft領取指令碼指令碼
- 使用ajax指令碼取資料指令碼