Re: Dynamic Block program unit?

From: DA Morgan <damorgan_at_exesolutions.com>
Date: Mon, 20 Jan 2003 08:02:49 -0800
Message-ID: <3E2C1DA9.46805EC3_at_exesolutions.com>


Adam Hapworth wrote:

> Hello All,
> I have a form that goes against our database and looks at 4 tables
> of the exact same strcutre. Each table has its own block in the form.
> I have some procedures in the program units that do something for
> each of these blocks because I cannot seem to figure out a dynamic way
> around it. Each Program unit is tied to a specific block and the
> items inside are called with bind varaibles(:block1.item1). I was
> wondering if there was a way to pass the block name in as a varchar2
> and then tie that to the items. I have tried getting the block id
> using Find_block() builtin but when I go to read the items it fails
> saying it can't find the item.
>
> what I have in a very limited scope
>
> procedure a
> is
> begin
> :block1.item1 := 'foo';
> end;
>
> procedure b
> is
> begin
> :block2.item1 := 'foo';
> end;
>
> What I would like to do is
>
> procedure c(block_name in varchar2)
> is
> begin
> block_name.item1 := 'foo';
> end;
>
> How would I go about doing something of this sort.
>
> I know this may sound like a silly design but it is all I have to work
> with :(
>
> Thanks
> Adam

Another solution would be to use a global variable that you could set anywhere on the form.

But I am a bit troubled by a form linked to four identical tables. There is no excuse for four identical tables in a relational database. Why not combine the tables into one with a field identifying the four record types. Then you could just dynamically set the WHERE clause on the block to query the records you want.

Daniel Morgan Received on Mon Jan 20 2003 - 17:02:49 CET

Original text of this message