Article View: borland.public.interbase.sql
Article #11214View based on a UNION of 2 Select's
From: Jose Carlos
Date: Wed, 11 Dec 2002 16:22
Date: Wed, 11 Dec 2002 16:22
75 lines
2093 bytes
2093 bytes
Hi All,
I Have the following tables and view :
CREATE TABLE TAB1
(
COD INTEGER NOT NULL,
DESCR VARCHAR(10),
CODTAB INTEGER,
TYPETAB VARCHAR(1)
);
CREATE TABLE TAB2
(
COD INTEGER NOT NULL,
DESCR VARCHAR(10)
);
CREATE TABLE TAB3
(
COD INTEGER NOT NULL,
DESCR VARCHAR(10)
);
CREATE VIEW V_TABS
(
COD,
DESCR,
TYPETAB
)
AS
SELECT
COD,
DESCR,
'2'
FROM
TAB2
UNION
SELECT
COD,
DESCR,
'3'
FROM
TAB3;
My problem happens when I try to run the following
select :
SELECT
TAB1.COD,
TAB1.DESCR,
TAB1.TYPETAB || ' - ' || V_TABS.DESCR
FROM
TAB1
LEFT OUTER JOIN V_TABS
ON ( (V_TABS.CODTAB = TAB1.CODTAB)
AND
(V_TABS.TYPETAB = TAB1.TYPETAB))
The select return the records I want but my plan analyser tool goes crazy
and show a lot of unrecognized characters instead of the correct plan. Am I
doing something wrong ? Can I trust that my select will always work ?
Is there some problem using a VIEW based on a UNION of two SELECT's ? Is it
safe ?
Do you have some other idea ?
Thanks for reading.
Jose Carlos
Brazil
Technical Details
Message-ID:
<3df76de6@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!nntp2.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 114a0e,2f86d9a520aeb76b X-Google-Attributes: gid114a0e,public X-Google-ArrivalTime: 2002-12-11 08:56:09 PST From: "Jose Carlos" <jcmarcussojr@hotmail.com> Newsgroups: borland.public.interbase.sql Subject: View based on a UNION of 2 Select's Date: Wed, 11 Dec 2002 13:22:08 -0300 Lines: 77 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Host: 200.191.7.136 Message-ID: <3df76de6@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1039625702 200.191.7.136 (11 Dec 2002 08:55:02 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!nntp2.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail