Oracle insert from select into table with more columns
Just add in the '0' in your select.
INSERT INTO table_name (a,b,c,d)
SELECT
other_table.a AS a,
other_table.b AS b,
other_table.c AS c,
'0' AS d
FROM other_table
SQL INSERT STATEMENT, ONLY TWO VALUES INTO A TABLE WHICH HAS MANY COLUMNS
Your syntax is incorrect. I believe you want:
INSERT INTO your_table_name (your_column_name, your_id )
(select your_column_name, 'abc' as your_id from another_table);
oracle select few columns from first table and insert (seq.nextval for one column + already selected columns) into second table
Your insert
statement should have the column-names in the table. Then you should select the values from appropriate sequence and table.
INSERT INTO PRODUCT2 (PRD_ID, PRD_NAME)
SELECT PRODUCT_SEQ.NEXTVAL, PRD_NAME FROM PRODUCT1
Related Topics
How to Find Records That Are Not Joined
Fastest Way Merge Two SQLite Databases
Extra Fields with SQL Min() & Group By
Command for Adding a Default Constraint
Disable and Later Enable All Table Indexes in Oracle
How to Pass Variable from Shell Script to SQLplus
SQL Server Query for Rank (Rownumber) and Groupings
How to Use an Oracle Associative Array in a SQL Query
How to Return Second Newest Record in SQL
Mysql: Which to Use When: Drop Table, Truncate Table, Delete from Table
SQL Server 2008: Ordering by Datetime Is Too Slow
Postgres - Create Table from Select
SQL Count* Group by Bigger Than,