Tilsley, Jerry M. wrote:
> I have the schema:
> CREATE TABLE panel_tracker (ov_id numeric, mt_acct char(12), orm_id numeric, 
> panel_code char(5));

Really?  You don't have a "ov_systems" table?

> I would like to create the following INSTEAD OF INSERT trigger:
> create trigger insteadInsertPanelTracker instead of insert on panel_tracker
> begin
> set @ov_id = select ov_id from ov_systems where mt_mnemonic=NEW.ov_id;
> insert into panel_tracker values (@ov_id, NEW.mt_acct, NEW.orm_id, 
> NEW.panel_code);
> end
> ;

This is not valid in SQLite.

There are no variables; you would have to put that into a subselect.

And SQLite does not allow you to put INSTEAD OF triggers on a table.
If you really want to do this, you have to create a view for that
table, and create INSTEAD OF triggers for all of INSERT/UPDATE/
DELETE:

create trigger insteadInsertPanelTracker
instead of insert on panel_tracker
begin
  insert into the_actual_panel_tracker_table
    values ((select ov_id from ov_systems where mt_mnemonic=NEW.ov_id),
            NEW.mt_acct, NEW.orm_id, NEW.panel_code);
end;

> Disclaimer****
> This email is confidential ...

This e-mail contains public information intended for any subscriber of
this mailing list and for anybody else who bothers to read it; it will
be copied, disclosed and distributed to the public.  If you think you
are not the intended recipient, please commit suicide immediately.
These terms apply also to any e-mails quoted in, referenced from, or
answering this e-mail, and supersede any disclaimers in those e-mails.
Additionally, disclaimers in those e-mails will incur legal processing
fees of $42 per line; you have agreed to this by reading this disclaimer.


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to