From the question, it seems like at there can be only one row for all matching records for which status_flag will be 'A', assuming this, you can write a query using left outer join on the new values and then use a case statement to identify the value of status_code.
INSERT INTO inv_dtl
SELECT a.p_id,
a.col1,
a.col2,
CASE WHEN b.status_flag IS NULL THEN 'A' ELSE 'I' END AS status_flag
FROM (SELECT 1 p_id, -- new values goes here
100 col1,
'new 2' col2,
'A' status_flag
FROM dual) a
LEFT OUTER JOIN (SELECT * FROM inv_dtl) b
ON b.col1 = a.col1 -- all columns list goes here
AND b.col2 = a.col2
AND b.status_flag = 'A'; -- Status 'A' is fixed.
Testing the code:
SQL> create table inv_dtl(p_key number, col1 number, col2 varchar2(10), status_flag varchar2(1));
Table created
SQL> INSERT INTO inv_dtl
2 SELECT a.p_id,
3 a.col1,
4 a.col2,
5 CASE WHEN b.status_flag IS NULL THEN 'A' ELSE 'I' END AS status_flag
6 FROM (SELECT 1 p_id,
7 100 col1,
8 'new' col2,
9 'A' status_flag
10 FROM dual) a
11 LEFT OUTER JOIN (SELECT * FROM inv_dtl) b
12 ON b.col1 = a.col1
13 AND b.col2 = a.col2
14 AND b.status_flag = 'A';
1 row inserted
SQL>
SQL> INSERT INTO inv_dtl
2 SELECT a.p_id,
3 a.col1,
4 a.col2,
5 CASE WHEN b.status_flag IS NULL THEN 'A' ELSE 'I' END AS status_flag
6 FROM (SELECT 2 p_id,
7 100 col1,
8 'new' col2,
9 'A' status_flag
10 FROM dual) a
11 LEFT OUTER JOIN (SELECT * FROM inv_dtl) b
12 ON b.col1 = a.col1
13 AND b.col2 = a.col2
14 AND b.status_flag = 'A';
1 row inserted
SQL>
SQL> INSERT INTO inv_dtl
2 SELECT a.p_id,
3 a.col1,
4 a.col2,
5 CASE WHEN b.status_flag IS NULL THEN 'A' ELSE 'I' END AS status_flag
6 FROM (SELECT 3 p_id,
7 100 col1,
8 'new' col2,
9 'A' status_flag
10 FROM dual) a
11 LEFT OUTER JOIN (SELECT * FROM inv_dtl) b
12 ON b.col1 = a.col1
13 AND b.col2 = a.col2
14 AND b.status_flag = 'A';
1 row inserted
SQL>
SQL> INSERT INTO inv_dtl
2 SELECT a.p_id,
3 a.col1,
4 a.col2,
5 CASE WHEN b.status_flag IS NULL THEN 'A' ELSE 'I' END AS status_flag
6 FROM (SELECT 4 p_id,
7 200 col1,
8 'new 2' col2,
9 'A' status_flag
10 FROM dual) a
11 LEFT OUTER JOIN (SELECT * FROM inv_dtl) b
12 ON b.col1 = a.col1
13 AND b.col2 = a.col2
14 AND b.status_flag = 'A';
1 row inserted
SQL>
SQL> INSERT INTO inv_dtl
2 SELECT a.p_id,
3 a.col1,
4 a.col2,
5 CASE WHEN b.status_flag IS NULL THEN 'A' ELSE 'I' END AS status_flag
6 FROM (SELECT 5 p_id,
7 200 col1,
8 'new 2' col2,
9 'A' status_flag
10 FROM dual) a
11 LEFT OUTER JOIN (SELECT * FROM inv_dtl) b
12 ON b.col1 = a.col1
13 AND b.col2 = a.col2
14 AND b.status_flag = 'A';
1 row inserted
SQL> select * from inv_dtl;
P_KEY COL1 COL2 STATUS_FLAG
---------- ---------- ---------- -----------
1 100 new A
2 100 new I
3 100 new I
4 200 new 2 A
5 200 new 2 I
SQL>