【问题标题】:Inserting a BLOB data into object type - Oracle将 BLOB 数据插入对象类型 - Oracle
【发布时间】:2013-08-10 18:39:00
【问题描述】:

我正在使用以下代码创建一个类型 INFOS 作为对象:

 create or replace TYPE INFOS AS OBJECT
 (
    NAME VARCHAR2(50 BYTE),
    PICTURE BLOB
 ) 

以及使用INFOS类型的表CLIENT:

create table client
(
    ID_CLIENT int not null primary key,
    INFORMATIONS INFOS
)

代码插入:

insert into client values(1,INFOS('john',EMPTY_BLOB()))

我无法将 INFO.PICTURE 列返回到变量中。

那么,如何将 BLOB 数据插入此表中。

【问题讨论】:

  • insert into CLIENT values (1, infos('John', your_blob_locator));
  • 但是我怎样才能将 INFOS.PICTURE 返回到 A VARIABLE 中以进行提交?
  • 使用DBMS_LOB 包。
  • 我尝试使用 DBMS_LOB 执行此操作,但它不起作用,您能给我举个例子吗?谢谢 EgorSkriptunoff

标签: database oracle insert blob object-type


【解决方案1】:
declare
  i infos;
  b blob;
begin
  insert 
    into client 
    values(1, INFOS('John', EMPTY_BLOB()))
    returning informations into i;
  b := i.picture;
  -- You can use b here
end;

【讨论】:

    猜你喜欢
    • 2014-11-26
    • 1970-01-01
    • 2012-10-23
    • 2020-06-13
    • 2022-01-15
    • 1970-01-01
    • 2016-02-07
    • 1970-01-01
    • 2017-03-23
    相关资源
    最近更新 更多