[20120910]建立包含long型別的表.txt
需要往一個表裡面append一些資料,而表內有long 欄位。處理還真麻煩,記錄一下。
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> create table t (id number,pic long);
Table created.
SQL> insert into t values (1,'aaaaaaaaaaaaaaaa');
1 row created.
SQL> create table t1 as select * from t;
create table t1 as select * from t
*
ERROR at line 1:
ORA-00997: illegal use of LONG datatype
SQL> create table t1 (id number,pic long);
Table created.
SQL> insert into t1 select * from t;
insert into t1 select * from t
*
ERROR at line 1:
ORA-00997: illegal use of LONG datatype
--看來含有LONG的欄位處理起來很麻煩。 當然方法很多,看了一些blog,發現最簡單的是使用sqlplus帶的copy命令,
--可以實現。記錄一下。俺以前經常用,現在差不多忘記了!!
--參考連結如下:
SQL> help copy
COPY
----
Copies data from a query to a table in the same or another
database. COPY supports CHAR, DATE, LONG, NUMBER and VARCHAR2.
COPY {FROM database | TO database | FROM database TO database}
{APPEND|CREATE|INSERT|REPLACE} destination_table
[(column, column, column, ...)] USING query
where database has the following syntax:
username[/password]@connect_identifier
SQL> copy from scott/xyzxyz@192.168.200.56/test.com to scott/xyzxyz@192.168.200.56/test.com append t1 using select * from t;
Array fetch/bind size is 200. (arraysize is 200)
Will commit when done. (copycommit is 0)
Maximum long size is 20000000. (long is 20000000)
1 rows selected from scott@192.168.200.56/test.com.
1 rows inserted into T1.
1 rows committed into T1 at scott@192.168.200.56/test.com.
SQL> set long 100
SQL> select * from t1;
ID PIC
---------- -----------------
1 aaaaaaaaaaaaaaaa
SQL> copy from scott/xyzxyz@192.168.200.56/test.com to scott/xyzxyz@192.168.200.56/test.com create t2 using select * from t;
Array fetch/bind size is 200. (arraysize is 200)
Will commit when done. (copycommit is 0)
Maximum long size is 100. (long is 100)
Table T2 created.
1 rows selected from scott@192.168.200.56/test.com.
1 rows inserted into T2.
1 rows committed into T2 at scott@192.168.200.56/test.com.
SQL> desc t2;
Name Null? Type
------ -------- ------------
ID NUMBER(38)
PIC LONG
SQL> select * from t2;
ID PIC
---------- ----------------
1 aaaaaaaaaaaaaaaa
--另外不要設定long引數太小,否則會被截斷!
SQL> set long 5
SQL> copy from scott/xyzxyz@192.168.200.56/test.com to scott/xyzxyz@192.168.200.56/test.com insert t2 using select * from t;
Array fetch/bind size is 200. (arraysize is 200)
Will commit when done. (copycommit is 0)
Maximum long size is 5. (long is 5)
1 rows selected from scott@192.168.200.56/test.com.
1 rows inserted into T2.
1 rows committed into T2 at scott@192.168.200.56/test.com.
SQL> set long 50
SQL> select * from t2;
ID PIC
---------- --------------------------------------------------
1 aaaaaaaaaaaaaaaa
1 aaaaa
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-743054/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 透過觸發器複製包含LONG型別的表觸發器型別
- Java long型別和Long型別的那些事Java型別
- 含LONG型別欄位的表無法MOVE型別
- 操作LONG型別型別
- int型別和long long型別運算執行時間的差別型別
- Long raw和Long型別總結型別
- LONG型別複製型別
- long型別相關型別
- LONG型別遷移到LOB型別(三)型別
- LONG型別遷移到LOB型別(二)型別
- LONG型別遷移到LOB型別(一)型別
- Oracle Long型別轉換為Clob型別Oracle型別
- 關於long型別的轉換型別
- oracle裡long型別的總結Oracle型別
- long型別資料的擷取型別
- oracle裡long型別詳解Oracle型別
- 測試Java中的long,int基本型別Java型別
- PLSQL Language Reference-PL/SQL資料型別-SQL資料型別-LONG和LONG RAW變數SQL資料型別變數
- 讀取oracle long型別及判斷是否自動分割槽表Oracle型別
- 靜態long型別常量serialVersionUID的作用型別UI
- 使用copy命令解決LONG型別的困擾型別
- Long型別的資料,利用COPY命令遷移型別
- Spring Mvc Long型別精度丟失SpringMVC型別
- LONG欄位型別向CLOB遷移型別
- long型別轉換成varchar2型別
- OCM實驗-建立含特殊欄位型別的表型別
- c++ 基本資料型別(int、float、double、long、long long)最大值,最小是表示方法C++資料型別
- Oracle 中LONG RAW BLOB CLOB型別介紹Oracle型別
- long資料型別跨平臺問題資料型別
- oracle的long型別欄位的應用-- 實戰篇Oracle型別
- oracle的long型別欄位的應用-- 知識篇Oracle型別
- expdp測試包含有lob型別的物件型別物件
- impdp匯入包含xmltype型別欄位空表報錯問題XML型別
- oracle集合型別使用的實驗.TXTOracle型別
- Oracle型別的建立及使用Oracle型別
- 建立NFS型別的儲存NFS型別
- ora-00997 非法使用LONG資料型別資料型別
- ORA-00997: 非法使用 LONG 資料型別資料型別