how to insert records from one table to another selecting only the common columns

i want to insert records from one table to another with common columns

desc fp_mast null? type emp_id not null varchar2(4) emp_nm not null varchar2(35) typ not null varchar2(1) flag not null varchar2(1) st_dt not null DATE end_dt DATE wk_dt not null DATE

desc emp_mast null? type

emp_id not null varchar2(4) emp_nm not null varchar2(35) grd_cd not null varchar2(3) desg_cd not null varchar2(2) cost_sl not null varchar2(2) flag not null varchar2(1) join_dt not null DATE resig_dt DATE wk_dt not null DATE

i tried this query to insert the records but did not work

insert into fp_mast(emp_id,emp_nm,st_dt,end_dt,wk_dt) select(emp_no,emp_nm,join_dt,resig_dt,wk_dt) from emp_mast where emp_id in ('7996','7942','5251','7999','8249','6464','8220', '8221')

it kept showing me the following error

missing right parenthesis

thank you.

--------------Solutions-------------

missing right parenthesis

Because you have a syntax error in the SELECT statement.

Change this:

select(emp_no,emp_nm,join_dt,resig_dt,wk_dt)

to this:

select emp_no,emp_nm,join_dt,resig_dt,wk_dt

You don't need the parenthesis for the column names in the select list. I think you got confused with the way VALUES keyword is used.

Category:sql Time:2018-10-25 Views:1
Tags: sql oracle select

Related post

Copyright (C) pcaskme.com, All Rights Reserved.

processed in 0.650 (s). 13 q(s)