[Babase] neighbors triggers

Karl O. Pinc kop at meme.com
Thu Sep 28 20:47:11 EDT 2006


On 09/28/2006 06:58:53 PM, Leah Gerber wrote:
> Karl,
> 
> I have unsuccessfully searched for the SQL that makes up the  
> neighbors trigger that produces the error "Ncode 2: required ncode 1"  
> etc. Can you either send me the SQL or tell me where to find the SQL  
> for the error checking for neighbors. I would like to see how many  
> neighbors errors are left after i did this big fix.

It's wrapped up in a plpgsql stored procedure that is the trigger
that does data validation on insert/update/delete.  Because the
code is written to check rows as they go in row-by-row it won't
be all that useful.  However,....

The trick is to do a NOT EXISTS subquery:

select * from neighbors where code = '2' and
not exists (select 1 from neighbors as n
where n.pntid = neighbors.pntid and n.code = '1');

Note, i've not actually tried to run this code.

I think you'll have to do this in postgres because
I don't think foxpro does NOT EXISTS.

Karl <kop at meme.com>
Free Software:  "You don't pay back, you pay forward."
                  -- Robert A. Heinlein



More information about the Babase mailing list