Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: view problem
On Wed, 25 Nov 1998 12:29:56 EST, Manash Chakraborty
<manash_at_superlink.net> wrote:
>Hi,
>
>Ihave two tables
> tab1 with col1(number)
>tab2 with col2(number)
>
> Iwant to create a view vw12 with col12(number)
> the view column will show only the product of tab1.col1 and tab2.col2.
>
> such tab1 col1
> 2
> 3
> 4
>and tab2 col2
> 10
> 12
> 13
>
>The view I want with column
>
> 20
> 36
> 52
> Thanks in advance .Tapash
>
Since you don't tell the relationship between the 2 tables, I think you're assuming that Oracle always selects records from a table in a consistent order, which is not true. If you issue a SELECT statement against a table, there is no guarantee that it will give you the records by the order in which they were inserted.
I suggest that you add a second column to each of your table (ID, for example) and fill each with a sequential series of values.
Then your view would be something like this:
CREATE VIEW v1 AS
SELECT tab1.col1*tab2.col2 as product FROM tab1, tab2 WHERE tab1.id=tab2.id;
Good luck,
Nuno Guerreiro
"The art of arts, the glory of expression and the sunshine that lights the light of letters is simplicity"
Walt Whitman Received on Thu Nov 26 1998 - 04:13:17 CST
![]() |
![]() |