here's a table with a high number of columns
create table test (
id number,
col_1 varchar2(50),
col_2 varchar2(50),
.
.
col_n varchar2(50)
);
and the table is filled with some example data
insert into test values(1,'a1','a2',...,'an');
insert into test values(2,'a1','a3',...,'am');
insert into test values(3,'a4','a2',...,'ax');
now i need to copy one row (fore example the row with id=1) and change just one column's value, if the result does not be similar to another row (without considering id). some thing like this:
declare
r test%rowtype;
var1 number;
begin
insert into r from test where id = 1;
r.col_2='a3';
select count (*) into var1 from test where 'the row without id' = r;
if (var1 = 0) then
insert into test values r;
end if;
end;
but i don't know how to write the select part in oracle. consider table test has lots of columns so you can't write all of the columns in where clause.