高分请教与探讨,关于long和long raw移植的问题...

qiuyang_wang 2003-09-22 09:25:23
请问,如何将long或long raw类型字段的内容复制到另一张表中?
数据库:
Oracle 8.0.5
Oracle 9i
说明:
因为要与自动转换程序接口,因此绝对不能采用前端处理或手工处理的方式,只能使用sql语句或存储过程。
谢谢大家,同时预祝大家国庆节快乐。
...全文
164 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
sanoul 2003-11-25
  • 打赏
  • 举报
回复
zhangshunshi(宇轩)
------------------------------
你可以这样复制long raw记录
1.首先创建一个表A,如:
create table A(zxtmc varchar2(50),mknr blob)

2.表XT_MKDA有两个字段:zxtmc varchar2(50),mknr long raw
把xt_mkda的数据插入A中:
insert into A
select zxtmc,to_lob(mknr) from XT_MKDA

3.创建表B:
create table B(zxtmc varchar2(50),mknr long raw)

4.复制表A 的记录到表B:
insert into B
select zxtmc,mknr from A

5.查看select * from B
表B就是你要的结果

long raw类型字段的内容复制到另一张表中
----------------------------------------
问题在于PL/SQL不支持你这样的使用,我在SQL PLUS下面是直接可以执行的,但PL/SQL总报错,说类型不匹配
fzzlz 2003-09-25
  • 打赏
  • 举报
回复
不懂!学习....
yuxuan 2003-09-23
  • 打赏
  • 举报
回复
更正:
2.表XT_MKDA有两个字段:zxtmc varchar2(50),mknr long raw
把xt_mkda的数据插入ttt中:
insert into ttt
select zxtmc,to_lob(mknr) from XT_MKDA

应为:
2.表XT_MKDA有两个字段:zxtmc varchar2(50),mknr long raw
把xt_mkda的数据插入A中:
insert into A
select zxtmc,to_lob(mknr) from XT_MKDA
yuxuan 2003-09-23
  • 打赏
  • 举报
回复
你可以这样复制long raw记录
1.首先创建一个表A,如:
create table A(zxtmc varchar2(50),mknr blob)

2.表XT_MKDA有两个字段:zxtmc varchar2(50),mknr long raw
把xt_mkda的数据插入ttt中:
insert into ttt
select zxtmc,to_lob(mknr) from XT_MKDA

3.创建表B:
create table B(zxtmc varchar2(50),mknr long raw)

4.复制表A 的记录到表B:
insert into B
select zxtmc,mknr from A

5.查看select * from B
表B就是你要的结果

long raw类型字段的内容复制到另一张表中

jiezhi 2003-09-22
  • 打赏
  • 举报
回复
http://gigabase.idi.ntnu.no/oradoc/appdev.901/a89852/utl_raw.htm#998101
jiezhi 2003-09-22
  • 打赏
  • 举报
回复
http://gigabase.idi.ntnu.no/oradoc/appdev.901/a89852/utl_raw.htm#998101
hdkkk 2003-09-22
  • 打赏
  • 举报
回复
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/u_raw2.htm#1001736
hdkkk 2003-09-22
  • 打赏
  • 举报
回复
Summary of UTL_RAW Subprograms
Table 98-1 UTL_RAW Subprograms
Subprogram Description
CAST_FROM_BINARY_INTEGER Function
Returns the binary representation of a BINARY_INTEGER (in RAW).

CAST_FROM_NUMBER Function
Returns the binary representation of a NUMBER (in RAW).

CAST_TO_BINARY_INTEGER Function
Casts the binary representation of a BINARY_INTEGER (in RAW) into a BINARY_INTEGER

CAST_TO_NUMBER Function
Casts the binary representation of a NUMBER (in RAW) into a NUMBER. If include_length is TRUE, the first byte of r encodes the number of bytes in r (

CAST_TO_RAW Function
Converts a VARCHAR2 represented using n data bytes into a RAW with n data bytes.

CAST_TO_VARCHAR2 Function
Converts a RAW represented using n data bytes into VARCHAR2 with n data bytes.

CONCAT Function
Concatenates up to 12 RAWs into a single RAW.

LENGTH Function
Returns the length in bytes of a RAW r.

SUBSTR Function
Returns len bytes, starting at pos from RAW r.

TRANSLATE Function
Translates the bytes in the input RAW r according to the bytes in the translation RAWs from_set and to_set.

TRANSLITERATE Function
Converts the bytes in the input RAW r according to the bytes in the transliteration RAWs from_set and to_set.

OVERLAY Function
Overlays the specified portion of target RAW with overlay RAW, starting from byte position pos of target and proceding for len bytes.

COPIES Function
Returns n copies of r concatenated together.

XRANGE Function
Returns a RAW containing all valid 1-byte encodings in succession, beginning with the value start_byte and ending with the value end_byte.

REVERSE Function
Reverses a byte sequence in RAW r from end to end.

COMPARE Function
Compares RAW r1 against RAW r2.

CONVERT Function
Converts RAW r from character set from_charset to character set to_charset and returns the resulting RAW.

BIT_AND Function
Performs bitwise logical "and" of the values in RAW r1 with RAW r2 and returns the "anded" result RAW.

BIT_OR Function
Performs bitwise logical "or" of the values in RAW r1 with RAW r2 and returns the "or'd" result RAW.

BIT_XOR Function
Performs bitwise logical "exclusive or" of the values in RAW r1 with RAW r2 and returns the "xor'd" result RAW.

BIT_COMPLEMENT Function
Performs bitwise logical "complement" of the values in RAW r and returns the "complement'ed" result RAW.

bzszp 2003-09-22
  • 打赏
  • 举报
回复
查一下utl_row包的使用方式
我这里没装联机帮助
qiuyang_wang 2003-09-22
  • 打赏
  • 举报
回复
我试了试:utl_raw.length和utl_raw.substr,错误提示为:
ORA-06550: line 4, column 39:
PL/SQL: ORA-00997: illegal use of LONG datatype
ORA-06550: line 4, column 2:
PL/SQL: SQL Statement ignored

不知道utl_raw内函数能否操作Long Raw型数据,怎么操作?
还忘大家指教。
jiezhi 2003-09-22
  • 打赏
  • 举报
回复
long--->to_lob()
long raw---->utl_raw
qiuyang_wang 2003-09-22
  • 打赏
  • 举报
回复
首先谢谢各位大哥了。小弟太笨还是搞不定,还望祥加指点。

采用:Insert into .. select .. 形式也不行,错误如下:

ORA-00997: illegal use of LONG datatype

我相信Oracle一定可以做到,但我就是不知道怎么做。楼上各位给在下介绍了Utl_raw包,我还是不知道怎么访问Long raw类型字段,不管小弟怎么试,总提示:
illegal use of LONG datatype 错误。

不管用什么办法,只要不通过前台应用程序,实现将Long raw类型字段内数据从一个表到另一个表的移植就可以,小弟都快急风了。
谢谢大家。
LGQDUCKY 2003-09-22
  • 打赏
  • 举报
回复
utl_raw.length 对 LONG不行
用INSERT INTO TABLE_NAME1。。。 SELECT * FROM TABLE_NAME。。。。

3,490

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 高级技术相关讨论专区
社区管理员
  • 高级技术社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧