0

以下会产生错误:[Error] ORA-00904 (265: 19): PL/SQL: ORA-00904: "INP"."COLUMN_VALUE": invalid identifier

  MERGE INTO tab_mapping tbl_llclm
       USING (
              SELECT COLUMN_VALUE as map_id
                FROM TABLE (p_llcl_map_array) inp)
          ON (inp.COLUMN_VALUE = tbl_llclm.lab_loinc_map_id)
  WHEN NOT MATCHED
  THEN
     INSERT     (tab_map_id,
                 tab_loinc_map_id,
                 last_updated_by,
                 last_updated_date)
         VALUES (p_llc_id,
                 inp.map_id,
                 p_last_updated_by,
                 SYSDATE);

p_llcl_map_array 是 num_arr 类型(num_arr 是 SQL 类型的数字表)

4

1 回答 1

1

这应该有效。我只是将别名移到inp外面并引用COLUMN_VALUEmap_id

MERGE INTO tab_mapping tbl_llclm
       USING (
              SELECT COLUMN_VALUE as map_id
                FROM TABLE (p_llcl_map_array) 
             ) inp
          ON (inp.map_id = tbl_llclm.lab_loinc_map_id)
  WHEN NOT MATCHED
  THEN
     INSERT     (tab_map_id,
                 tab_loinc_map_id,
                 last_updated_by,
                 last_updated_date)
         VALUES (p_llc_id,
                 inp.map_id,
                 p_last_updated_by,
                 SYSDATE);
于 2014-10-01T14:09:34.280 回答