Subject | Re: [ib-support] Not in query |
---|---|
Author | Helen Borrie |
Post date | 2001-07-01T05:34:55Z |
At 08:47 PM 30-06-01 -0800, you wrote:
create procedure conditional_insert(var1 integer, var2 whatever,...)
as
begin
if (not(exists(select pk_table2 from table2 where pk_table2= :var1))) then
insert into table2(col1, col2, ...)
values(:var1, :var2,.....);
end
Cheers,
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________
>Can anyone provide an example of SQL syntax that would compareNot in one statement - it can be done with a simple stored procedure, though.
>the primary index of one table to another to determine whether or
>not a value in one table exists in the other, and if not then
>insert it?
create procedure conditional_insert(var1 integer, var2 whatever,...)
as
begin
if (not(exists(select pk_table2 from table2 where pk_table2= :var1))) then
insert into table2(col1, col2, ...)
values(:var1, :var2,.....);
end
Cheers,
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________