将较长的原始数据检索到clob变量中 [英] retrieving long raw data into clob variable

查看:52
本文介绍了将较长的原始数据检索到clob变量中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从数据类型为长原始的列中检索长原始数据到clob变量中.

I want to retrieve long raw data from a column having data type long raw into a clob variable.

如果我直接编写insert语句,则无法插入到长的原始列中.

If I directly write insert statement , I am not able to insert into long raw column.

我必须使用utl_raw.cast_to_raw(..)函数将文本插入到长原始列中. 有人可以解释这个问题吗?

I have to use utl_raw.cast_to_raw(..) function for inserting text into long raw column. Can someone explain this issue?

让我向您解释一下此工作流程

Let me explain you the workflow for this

  1. 用户在Delphi中的丰富编辑器控件中输入格式文本并保存.

  1. User enters formatted text in a rich editor control in Delphi and saves.

数据保存在一个很长的原始列中.

Data is saved in a long raw column.

用户单击Delphi中的按钮,数据应从原始的长列中检索并显示在丰富的编辑器控件中.

User clicks on a button in Delphi and data should retrieve from the long raw column and display in the rich editor control.

因此,我们所需要的只是一个传递ID的SQL,它应该以长原始格式返回数据.

So all we need is a SQL that passes the id and it should return the data form the long raw.

这可行,但是由于我们获得二进制垃圾数据,因此数据不可读.

This works but the data is not readable as we get binary garbage data.

此表的表结构将类似于 创建表数据(id整数,数据长原始数据);

The table structure for this table will be like create table data(id integer ,data long raw);

我正在使用oracle 9i作为数据库.

I am using oracle 9i as database.

推荐答案

自Oracle 8.0起(即大约15年前),为了支持CLOB和BLOB,不推荐使用LONG和LONG RAW数据类型.进行此切换的主要原因是LONG列确实很难使用,而LONG RAW则翻了一番.

The LONG and LONG RAW data types have been deprecated in favour of CLOB and BLOB since Oracle 8.0 (i.e almost fifteen years ago). The primary reason for this switch is that LONG columns are really hard to work with, and that goes double for LONG RAW.

正如您已经发现的那样,我们在PL/SQL中可以执行的操作受到限制.该限制为32K.较大的LONG RAW列只能在C中处理.

As you have already discovered, there is a limit to what we can do in PL/SQL. That limit is 32K. Larger LONG RAW columns can only be handled in C.

Tom Kyte曾经托管一个实用程序,用于将Long Raw列卸载到平面文件中,然后可以通过SQL Loader将其加载到现代LOB列中.这种功能似乎不可用(不在他的博客上的/〜tkyte文件列表中).

Tom Kyte used to host a utility for unloading Long Raw columns to a flat file, which could then be loaded to modern LOB columns through SQL Loader. This utlity appears to be unavailable (it's not on the list of /~tkyte files on his blog).

但是,Fangxin Lou编写了另一个Tom Kyte实用程序的版本,他称为ociuldr,显然可以处理Long Raw.您可以从他的网站下载源代码. 了解更多信息.

However, Fangxin Lou has written a version of another Tom Kyte utility, which he's called ociuldr and which apparently handles Long Raw. You can download the source from his web site. Find out more.

NB 我还没有为自己尝试过ociuldr(自从上个千年以来,我还没有遇到过Long Raw),而且我也没有以任何方式担保它.但这似乎是互联网目前提供的唯一解决方案.因此,我建议您尝试一下,除非您具有良好的OCI技能并且可以编写自己的实现.

NB I have not tried ociuldr for myself (I haven't come across a Long Raw since the last millennium), and I'm not vouchsafing it in any way whatsoever. But it seems to be the only solution the internet offers right now. So I suggest you try it, unless you have good OCI skills and can write your own implementation.

这篇关于将较长的原始数据检索到clob变量中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆