欢迎光临
我们一直在努力

ORALCE: Select into VS Insert into select(真的晕)-数据库专栏,ORACLE

建站超值云服务器,限时71元/月

想实现 一个很简单的功能 费了我好长时间;
目的: 把一个料号记录copy一份修改主键再存放到原表里去;

1) 凭记忆采用

select * into a from b 的这种形式,死也不行~~

2) 上网google了一下

==>http://fengyu.china.com/sql1.htm

insert  (往数据表里插入记录的语句)

insert into 表名(字段名1, 字段名2, ……) values ( 值1, 值2, ……);
insert into 表名(字段名1, 字段名2, ……)  select (字段名1, 字段名2, ……) from 另外的表名;

第二个的语法很符合,决定试试.
不想还是提示: 右括号missing!

奇怪,仔细对了一次又一次,发现语法格式和上面的一模一样;
~~~~~~~~~~~~~~~无语
真试试看把括号去掉试试
insert into 表名(字段名1, 字段名2, ……)  select 字段名1, 字段名2, …… from 另外的表名;

ok搞定,真不懂;头都发晕,算了,记下来,下次说不定又忘记了

insert into 表名(字段名1, 字段名2, ……)  select (字段名1, 字段名2, ……) from 另外的表名;
==>红色的括号一定要去掉~~!!

 

正确贴在下面:

insert into sales_part_tab (catalog_no ,contract,part_no,catalog_group,bonus_basis_flag,bonus_value_flag,
eng_attribute,customs_stat_no,note_id,discount_group,print_control_code,
note_text,package_type,sales_unit_meas,package_weight,activeind,price_conv_factor,
catalog_desc,price_unit_meas,catalog_type,conv_factor,cost,date_entered,
list_price,price_change_date,purchase_flag,so_flag,volume,weight_gross,weight_net,
fee_code,taxable,proposed_parcel_qty,close_tolerance,sales_price_group_id,
configuration,warranty,create_sm_object_option,ean_no,sales_part_sourcing,
expected_average_price,purchase_part_no,replacement_part_no,date_of_replacement,
cust_warranty_id,non_inv_part_type,intrastat_conv_factor,rowversion )

select catalog_no,pcb,part_no,catalog_group,bonus_basis_flag,bonus_value_flag,
eng_attribute,customs_stat_no,note_id,discount_group,print_control_code,
note_text,package_type,sales_unit_meas,package_weight,activeind,price_conv_factor,
catalog_desc,price_unit_meas,catalog_type,conv_factor,cost,date_entered,
list_price,price_change_date,purchase_flag,so_flag,volume,weight_gross,weight_net,
fee_code,taxable,proposed_parcel_qty,close_tolerance,sales_price_group_id,
configuration,warranty,create_sm_object_option,ean_no,sales_part_sourcing,
expected_average_price,purchase_part_no,replacement_part_no,date_of_replacement,
cust_warranty_id,non_inv_part_type,intrastat_conv_factor,rowversion

from sales_part_tab where catalog_no = 810370111f1291 and contract = tmp

 

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » ORALCE: Select into VS Insert into select(真的晕)-数据库专栏,ORACLE
分享到: 更多 (0)

相关推荐

  • 暂无文章