ITPub博客

首页 > Linux操作系统 > Linux操作系统 > CREATE TABLE AS and LONG RAW[from akadia]

CREATE TABLE AS and LONG RAW[from akadia]

原创 Linux操作系统 作者:jlandzpa 时间:2019-07-19 11:42:03 0 删除 编辑

Long Raw data types cannot be included in the CREATE TABLE AS syntax. This is documented in the Oracle 7.3 or 8.0 Server SQL Reference Guide 'AS subquery' clause explanation of the CREATE TABLE syntax. The INSERT INTO statement results in the same error (see example). Use export/import to workaround this limitation of long raw usage.


Solution Description

Use the following workaround to create a table using the "CREATE TABLE AS" syntax:

SQL> create table test1 (
col1 int primary key,
col2 long raw);

Table created.

SQL> create table test2 as select col1 from test1;

Table created.

SQL> alter table test2 add (col2 long raw);

Table altered.

You may now export from one table (test1) and import into the other table (test2).

  • Export table test1

  • Rename table test1 to test3

  • Rename table test2 to test1

  • Import table test3 into the new test1

  • Rename table test1 back to test2

  • Rename table test3 back to test1

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/936/viewspace-60570/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2001-10-12

  • 博文量
    268
  • 访问量
    172258