Subject Re: [firebird-support] table names as variables...
Author Peter Lee
Thanks for the info... we're waiting on fb 1.5 to be officially released
before we start playing with it, so we'll have to look at another solution
for now. However, just to clarify, in fb 1.5, the [declare 'x' statement]
syntax is supported within triggers and/or procedures?

Just curious, why do you think that it isn't very robust - possibility of
errors in table names coming from our g_topics table?

Regards,

Peter Lee

At 26/11/2003, you wrote:
>At 12:21 PM 26/11/2003 +1100, you wrote:
> >Hello Everyone,
> >
> >Just wondering how I would achieve this in firebird / ib? A record in
> >G_LEVEL has just been deleted (primary key is level_def_num), and I want to
> >delete the contents of another table which has entries linked by
> >level_def_num. The table name to have the entries deleted from is stored
> >in table G_TOPICS. Is it possible to embed the table name in such a way in
> >my delete statement?
> >
> >====
> >
> >CREATE TRIGGER TRG_G_LEVEL_DELETE FOR G_LEVEL ACTIVE
> > AFTER DELETE POSITION 0
> > AS
> > DECLARE VARIABLE TOPIC_TABLE VARCHAR(12);
> > BEGIN
> > /* Now delete the level data from the topic specific database */
> > SELECT DATABASE_NAME FROM G_TOPICS WHERE G_TOPICS.topic_num =
> >old.topic_num INTO :topic_table;
> > DELETE FROM :topic_table WHERE level_def_num = old.level_def_num;
> > END
> >
> >====
>
>In Interbase or Fb 1, no. In Fb 1.5, yes, though not using your
>syntax. What you can do in 1.5 is run an EXECUTE STATEMENT statement
>inside your PSQL code, which is an "executable string", a statement which
>you build up and pass as the argument to EXECUTE STATEMENT, then execute.
>
>This isn't a very robust way to maintain RI but I guess with this
>dependency structure you don't have any choice.
>
>heLen
>
>
>
>
>To unsubscribe from this group, send an email to:
>firebird-support-unsubscribe@yahoogroups.com
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

-
Peter Lee Mobile: +61 412 011 174 ptle@...
-----------------------------------------------------------------------
Rising Software Australia Pty. Ltd. http://www.risingsoftware.com/
Publishers of 'Auralia' - Ear Training and 'Musition' - Theory Training
Ph: +61 3 9481 3320 FAX: +61 3 9481 3380 USA Freecall: 1 888 667 7839