Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: view problem

Re: view problem

From: Nuno Guerreiro <nuno-v-guerreiro_at_invalid.telecom.pt>
Date: Thu, 26 Nov 1998 10:13:17 GMT
Message-ID: <365d2802.157830448@news.telecom.pt>


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



As I don't normally appreciate unsolicited commercial e-mail (widely known as SPAM), I encoded my e-mail address. If you want to reply by e-mail, please remove the text added to fool spam software

"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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US