oracle合并声明

时间:2009-10-05 17:43:38

标签: oracle

以下陈述在存储过程中       合并到table1 a

USING (SELECT a.ROWID row_id, RTRIM(NVL(c.address_line1_text, '')) || ' ' || 
RTRIM(NVL(b.unit_number, '')) address_line1_text, 
RTRIM(c.city_name) city_name, RTRIM(c.state_code) state_code, 
RTRIM(c.basic_zip_code) basic_zip_code, 
NVL(b.unit_number, ' ') unit_number

FROM table1 a ,table2 b ,table3 c

WHERE 
     a.program_type_cd = 'P'

        AND a.development_code = b.development_number
    ) src

      ON ( a.ROWID = src.row_id )
      --(ERROR IN LINE BELOW)
      WHEN MATCHED THEN UPDATE SET street = RTRIM(NVL(src.address_line1_text, '')) 
      || ' ' || RTRIM(NVL(b.unit_number, '')),

                                   city = RTRIM(src.city_name),

                                   STATE = RTRIM(src.state_code),

                                   zip = RTRIM(src.basic_zip_code),

                                   unit_number = NVL(src.unit_number, ' ');

我收到错误说:

"B"."UNIT_NUMBER": INVALID IDENTIFIER

1 个答案:

答案 0 :(得分:0)

我认为您应该在b.unit_number替换src.unit_number

  || ' ' || RTRIM(NVL(src.unit_number, '')), /* <-- */

                               city = RTRIM(src.city_name),

                               STATE = RTRIM(src.state_code),

                               zip = RTRIM(src.basic_zip_code),

                               unit_number = NVL(src.unit_number, ' ');