Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在同一个表中从一列向另一列插入值-SQL_Sql_Oracle - Fatal编程技术网

在同一个表中从一列向另一列插入值-SQL

在同一个表中从一列向另一列插入值-SQL,sql,oracle,Sql,Oracle,我想从同一个SQL表中的现有列向新列插入值。现有列值和新列值应相同。 有什么建议吗 这将有助于您: 更新表集合param1=newValue,其中param2=criteria更新它,正如您已经听说的那样。一点代码: 示例表和多行示例数据: SQL> create table test 2 (existing_column number, 3 new_column number); Table created. SQL> insert into t

我想从同一个SQL表中的现有列向新列插入值。现有列值和新列值应相同。 有什么建议吗

这将有助于您:


更新表集合param1=newValue,其中param2=criteria

更新它,正如您已经听说的那样。一点代码:

示例表和多行示例数据:

SQL> create table test
  2    (existing_column number,
  3     new_column      number);

Table created.

SQL> insert into test (existing_column)
  2  select level from dual connect by level <= 5;

5 rows created.

SQL> select * From test;

EXISTING_COLUMN NEW_COLUMN
--------------- ----------
              1
              2
              3
              4
              5

提示:更新。这很有帮助。谢谢
SQL> update test set
  2    new_column = existing_column
  3  where existing_column <= 3;

3 rows updated.
SQL> select * From test;

EXISTING_COLUMN NEW_COLUMN
--------------- ----------
              1          1
              2          2
              3          3
              4
              5

SQL>