插入一個檔案到DB中
conn system/system
grant create any directory to test;
conn test/test
create table demo (id int primary key,theclob clob);
create or replace directory my_file as ‘d:’;
create or replace procedure load_a_file(p_id in number,
p_filename in varchar2) as
l_clob clob;
l_bfile bfile;
begin
insert into demo
values
(p_id, empty_clob())
returning theClob into l_clob;
l_bfile := bfilename('MY_FILES', p_filename);
dbms_lob.fileopen(l_bfile);
dbms_lob.loadfromfile(l_clob, l_bfile, dbms_lob.getlength(l_bfile));
dbms_lob.fileclose(l_bfile);
end;
exec load_a_file( 1, 'index.html' );
grant create any directory to test;
conn test/test
create table demo (id int primary key,theclob clob);
create or replace directory my_file as ‘d:’;
create or replace procedure load_a_file(p_id in number,
p_filename in varchar2) as
l_clob clob;
l_bfile bfile;
begin
insert into demo
values
(p_id, empty_clob())
returning theClob into l_clob;
l_bfile := bfilename('MY_FILES', p_filename);
dbms_lob.fileopen(l_bfile);
dbms_lob.loadfromfile(l_clob, l_bfile, dbms_lob.getlength(l_bfile));
dbms_lob.fileclose(l_bfile);
end;
exec load_a_file( 1, 'index.html' );
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8118583/viewspace-64845/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 多個excel檔案合併到一個檔案中的多個sheet表中Excel
- mysql 從一個表中查詢,插入到另一個表中MySql
- 一個私有協議檔案DB 的解析.協議
- Oracle中把一個查詢結果插入到一張表中Oracle
- 匯出多個檔案到一個Excel中的不同sheetsExcel
- linux下向一個檔案中的某行插入資料的做法Linux
- 在一個js檔案中引入另一個js檔案JS
- c# 讀取多個路徑檔案到一個檔案
- 儲存文字到一個檔案裡
- Redis從檔案中批量插入資料Redis
- sql server 2000 一個表的資料插入到三個相關聯表中,一條一條的插入SQLServer
- Python判斷一個檔案中的字串是否存在於另外一個檔案中Python字串
- [Shell] Input null到檔案中的兩個方法Null
- db2 sql批量插入一張表插入另一張表DB2SQL
- Linux給檔案隔兩個字元插入-Linux字元
- 查詢一個表的一列插入到另一個表
- 將framework檔案放在一個單獨的檔案中Framework
- 【DB 2學習】檢視一個資料庫的配置檔案資料庫
- 在多個檔案中import同一個檔案,webpack會多次打包嗎ImportWeb
- 如何在linux 中合併兩個檔案為一個檔案pasteLinuxAST
- 遷移檔案系統管理下的db到asm下ASM
- Windows 複製 xcopy 檔案到另外一個 目錄Windows
- VBA遍歷 Excel 合併到一個 Excel 檔案Excel
- MySQL插入圖片或pdf檔案到資料庫中(BLOB)--load_file函式MySql資料庫函式
- 把EXCEL表格插入到PPT中Excel
- C# 將資料夾中檔案複製到另一個資料夾C#
- 一mdf檔案達到 120G , 如何拆分成多個檔案 ?
- LoadRunner中檔案操作的一個例子
- SQL Anywhere db檔案損壞修復 DB檔案修復 DB資料庫修復SQL資料庫
- 如何批量複製多個檔案到多個目錄中(批量複製檔案,多對多檔案高效操作的方法)
- Angular 專案中匯入 styles 檔案到 Component 中的一些技巧Angular
- ASP.NET 中將檔案上傳到另外一個伺服器的方法二ASP.NET伺服器
- RAC中對DB引數檔案的簡單理解
- 如何在Linux中查詢一個檔案Linux
- 如何在 Linux 中查詢一個檔案Linux
- linux的tar命令詳情;linux多個檔案壓縮打包到一個壓縮檔案Linux
- 如何將一個陣列中的元素插入另一個陣列陣列
- mysql從一張表中取出資料插入到另一張表MySql