2

I want to update table skuxloc qty to equal the sum of the qty per sku in lotxlocxid as follows:

update skuxloc sl
set sl.qty = lli.sumqty
inner join
(
  select sku, sum(qty) sumqty
  from lotxlocxid
  where loc = 'DRSLN7STG'
  group by sku
) lli on lli.sku = sl.sku
where sl.sku in
('108720-419-S',
'108720-419-XS',
'876070-100-11',
'876070-100-12',
'876070-100-9.5',
'942836-100-10.5',
'942836-100-6.5',
'942837-100-6.5',
'CW5594-100-6',
'CW5594-100-6.5',
'CW5594-100-8',
'DD1583-402-M',
'942836-100-9');

I am getting error at line 2 that this SQL command wasn't properly ended.

Any idea to what I might be doing wrong?

1 Answer 1

4

Oracle doesn't support join in updates. Instead use a correlated subquery:

update skuxloc sl
    set sl.qty = (select sum(lli.qty)
                  from lotxlocxid lli
                  where loc = 'DRSLN7STG' and
                        lli.sku = sl.sku
                 )
    where sl.sku in
    ('108720-419-S',
    '108720-419-XS',
    '876070-100-11',
    '876070-100-12',
    '876070-100-9.5',
    '942836-100-10.5',
    '942836-100-6.5',
    '942837-100-6.5',
    'CW5594-100-6',
    'CW5594-100-6.5',
    'CW5594-100-8',
    'DD1583-402-M',
    '942836-100-9');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.