Oralce:select into VS inserts into Select (true halo)

Source: Internet
Author: User
Tags insert table name
Select
Want to realize a very simple function cost me a long time;
Objective: To record a material number copy a copy of the primary key and then store it in the original table;

1) using memory

Select * into a from B in this form, death is not good ~ ~

2) online Google a bit

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

Insert (the statement that inserts a record into the datasheet)

INSERT into table name (field name 1, field Name 2, ...) Values (value 1, value 2, ...);
INSERT into table name (field name 1, field Name 2, ...) SELECT (field name 1, field Name 2, ...) from another table name;

The second syntax fits well and decides to try.
Do not want or hint: right parenthesis missing!

Strangely, carefully again and again, found that the grammatical format is exactly the same as above;
~~~~~~~~~~~~~~~ No words
Try to remove the parentheses.
INSERT into table name (field name 1, field Name 2, ...) SELECT Field name 1, field Name 2, ... from another table name;

OK, really do not understand, head dizzy, forget, write down, next time maybe forget

INSERT into table name (field name 1, field Name 2, ...) SELECT (field name 1, field Name 2, ...) from another table name;
==> red brackets must be removed ~~!!



Correctly affixed to the following:

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 '





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.