Error on Update Join

后端 未结 2 1520
再見小時候
再見小時候 2020-12-22 05:29

I\'m receiving this error

This is my Current error: ORA-00971: missing SET keyword

UPDATE FGMULTI (JOIN arinvt ar 
 ON  fgmulti.arinvt_id = ar.id)

         


        
相关标签:
2条回答
  • 2020-12-22 05:40

    use update for select by join

     UPDATE (select NON_CONFORM_ALLOCTABLE
             from FGMULTI 
              JOIN arinvt ar 
              ON  fgmulti.arinvt_id = ar.id 
             WHERE IN_Date = CurrentDate 
             AND ar.Class LIKE 'CP%' 
             OR ar.Class LIKE 'FG%' 
             OR ar.Class LIKE 'IN%' 
             OR ar.Class LIKE 'LA%' 
             OR ar.Class LIKE 'PK%') t
     SET t.NON_CONFORM_ALLOCATABLE = 'Y' 
    
    0 讨论(0)
  • 2020-12-22 05:56

    You can't use a JOIN in Oracle in an UPDATE statement. You can do that using and exists clause:

    UPDATE FGMULTI
       SET NON_CONFORM_ALLOCATABLE = 'Y'
     WHERE IN_Date = CurrentDate 
      AND exists (SELECT 1 
                  FROM arinvt ar 
                  WHERE fgmulti.arinvt_id = ar.id
                   AND (ar.Class LIKE 'CP%' 
                     OR ar.Class LIKE 'FG%' 
                     OR ar.Class LIKE 'IN%' 
                     OR ar.Class LIKE 'LA%' 
                     OR ar.Class LIKE 'PK%'));
    
    0 讨论(0)
提交回复
热议问题