Article View: borland.public.interbase.sql
Article #11228Re: View based on a UNION of 2 Select's
From: Jose Carlos
Date: Thu, 12 Dec 2002 10:50
Date: Thu, 12 Dec 2002 10:50
109 lines
3102 bytes
3102 bytes
IB 6.0.2.0. the same happens with 6.0.1.0 too. thanks Jose Carlos "Martijn Tonies" <m.tonies@upscene_remove.com> escreveu na mensagem news:3df775a5$1@newsgroups.borland.com... > Hi, > > What version of IB are you using? I recall a bug in earlier versions > that messed up the PLAN that IB returned. > > > -- > > With regards, > > Martijn Tonies > InterBase Workbench - the developer tool for InterBase & Firebird > Firebird Workbench - the developer tool for Firebird > Upscene Productions > http://www.upscene.com > > "This is an object-oriented system. > If we change anything, the users object." > > > > > 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:
<3df85be9@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!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-mailReferences:
<3df76de6@newsgroups.borland.com> <3df775a5$1@newsgroups.borland.com>Show 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-12 01:51:47 PST From: "Jose Carlos" <jcmarcussojr@hotmail.com> Newsgroups: borland.public.interbase.sql References: <3df76de6@newsgroups.borland.com> <3df775a5$1@newsgroups.borland.com> Subject: Re: View based on a UNION of 2 Select's Date: Thu, 12 Dec 2002 07:50:49 -0300 Lines: 111 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.84 Message-ID: <3df85be9@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1039686633 200.191.7.84 (12 Dec 2002 01:50:33 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!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