Neha Gour
Neha Gour

Reputation: 71

Insert query not working as expected in Hive

I'm using below query to insert data in hive.

INSERT INTO TABLE dc_financials_sales (salessourcenbr,
                    salessourcecountrycode, salesendinginvsalesdate,
                    itemdeptnbr, basedivcode,
                    childctrtrackingid, msgreceivedts,
                    finreportinggroupcode, gateoutuserid,
                    itemshippedqty, itemshippedqtyuom,
                    itemupc, outboundchanneltype,
                    parentctrtrackingid, salespolinenbr,
                    salesponbr, salesdocid, salesdocumenttype,
                    totalsalescost, totalsalescostuom,
                    trailergateoutts, trailernbr,
                    transportationloadid, saptransactionid,
                    vnpkqtyineaches, whpkqtyineaches,
                    whpksellcost, whpksellcostuom,
                    wmtitemnbr, wmtitemdesc)
VALUES (6086, 'US',
        '20191115', 7,
        'WM', NULL,
        '2019-11-21 09:04:06+0000', 'US',
        's0k01wf', 1,
        'EA', '28914173184',
        'Staplestock', NULL,
        NULL, NULL,
        '1168337034A', 'CO',
        100, 'USD',
        '2019-11-15 13:39:38+0000', NULL,
        NULL, '20191121090405332000000v7bG3NGSALEUS6086',
        1, 1,
        100, 'USD',
        '570495975', 'DISNEY PRINCESS ROYA');

But, getting error:

Your query has the following error(s):

Error while compiling statement: FAILED: 
SemanticException 1:38 '[salessourcenbr, salessourcecountrycode, salesendinginvsalesdate]' in insert schema specification are not found among regular columns of default.dc_financials_sales nor dynamic partition columns. 
Error encountered near token 'wmtitemdesc'

Can someone help me to understand why the query is not working in Hive?

Upvotes: 1

Views: 796

Answers (1)

mazaneicha
mazaneicha

Reputation: 9425

Hive does not support specifying ordinary (non-partition) columns in INSERT VALUES statement. See Hive Language Manual:

...Values must be provided for every column in the table. The standard SQL syntax that allows the user to insert values into only some columns is not yet supported. To mimic the standard SQL, nulls can be provided for columns the user does not wish to assign a value to.

Upvotes: 1

Related Questions