Problem related to overwrite in HIVE

#1

hello,

I created a table using the below code and it worked fine. However, I am not able to replace the data with another select.

create table orders_closed2
as select order_id,order_date,order_status from orders where order_status=‘CLOSED’;

insert overwrite into orders_closed2
select order_id,order_date,order_status
from orders where order_status=‘PENDING’;

I am getting an error with overwrite here. If I take it out, it works fine. Are there any restriction with replacing data when a table is created this way?

Thanks.
Purnima

0 Likes

#2

hi use “table” instead of “into”

insert overwrite table orders_closed2
select order_id,order_date,order_status
from orders where order_status=‘PENDING’;

0 Likes

#3

INTO doesn’t work, I get the below error

cannot recognize input near ‘into’ ‘table’ ‘orders_closed2’ in destination specification

0 Likes

#4

Hi Do not use “into”. Please replace into with table in your code then it will work.

example:

insert overwrite table orders_closed2
select order_id,order_date,order_status
from orders where order_status=‘PENDING’;

0 Likes