Subject Re: [firebird-support] Custom RI was Re: Possible bug with CHECK constraint
Author German Pablo Gentile
Helen Borrie wrote:

>At 08:57 AM 3/10/2004 -0300, you wrote:
>
>
>Perhaps somebody will...but do not hijack other people's threads.
>
>
>
>
Is amazing but seems like the only way somebody ask in this group. See
my other posts. Zero replies.

>Yes, it is easy. If you can write a Before trigger, then you can write
>what is required to implement RI. You know your data; I don't. For the
>first one you attempt, do what you do with any programming task: write a
>specification, starting with "What do I want to achieve?"
>
>Then code it.
>
>After that, use your code as a boilerplate for any other custom RI you need
>to implement.
>
>
>
Sorry, i think is clear what want to do and was my mistake.I know
nothing about triggers as i say before.I just want to replace foreign
key checks in delete.
I need to check in the main table if theres a value of my foreign table
before i delte a record in foreign table. That will be the replace for
the referential integrity for the foreign table.Remember i need to
delete that keys because my insert in main table are so sloowly?

So, where can i find triggers syntax and wich is the best way to find if
there a value for a record in a table and act in consecuence?

a pseudocode can be:

before delete foreign key:
if exist(value_of_fktable in main_table) then
abort deleteting_record_in_fktable

TIA

German.