http://expert.csdn.net/Expert/topic/2106/2106680.xml?temp=.8537104
解决方案 »
- 一个简单的问题
- 如何在windows下自动输出oracle查询数据到文本
- 怎么下载Oracle Sql Developer?
- 高分请教
- 我们做数据库的前途在哪里,我的意思是。。。?
- 一样的sql语句为什么一个有结果,一个没有?请诸位帮忙!
- 关于:old的问题
- 把一个大表分类要类内检索怎么做可以提高检索速度啊
- oracle817下是否有类似于SQL SERVER 2000下的 inserted 和 deleted 表???各位大虾帮帮忙啊!!
- 急求在一个表请用一条sql语句查出所有的数据,查询结果先按照指定用户类型排序,然后按照id升序排序
- ?求助,ORACLE中在SELECT 语句 使用GROUP BY 分类查询时,提示‘GROUP BY 不是表达式’请问什么原因?
- 如何插入半个汉字?
对于lob字段而言,个人认为其使用比long类型有很大的灵活性,而且lob字段可以保存各类的数据,可以保存图片,大量的文字,现就clob跟blob两种类型加以说明,其中blob保存图片信息,clob保存大量文字。
exmple 6.
Create table test_table
(c_no number(1) not null,
c_blob blob,
c_clob clob,
constraint pk_test_table primary key (c_no)); unit Unit1; interface uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DBCtrls, Grids, DBGrids, DB, DBTables, ExtDlgs; type
TForm1 = class(TForm)
Database1: TDatabase; //用于连接数据库
Table1: TTable; //获取表信息
DataSource1: TDataSource;
DBGrid1: TDBGrid;
DBMemo1: TDBMemo; //显示c_clob字段内容
DBImage1: TDBImage; //显示c_blob字段内容
Button1: TButton; //插入按钮
Button2: TButton; //保存按钮
Table1C_NO: TFloatField; //Tfiled
Table1C_BLOB: TBlobField;
Table1C_CLOB: TMemoField;
OpenPictureDialog1: TOpenPictureDialog; //从文件获取图片
OpenDialog1: TOpenDialog; //从文件获取文字
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; var
Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject);
begin //插入操作
with Table1 do
begin
Insert; //将表状态置为插入状态
if OpenPictureDialog1.Execute then //获得图片信息
Table1C_BLOB.LoadFromFile(OpenPictureDialog1.FileName);
if OpenDialog1.Execute then //获得文字信息
Table1C_CLOB.LoadFromFile(OpenDialog1.FileName);
end;
end; procedure TForm1.Button2Click(Sender: TObject);
begin //提交插入内容
try
Table1.Post;
except
Application.MessageBox('错误发生','警告',0);
end;
end; end.