🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.interbase.sql
1 messages
1 total messages Started by Jose Carlos Wed, 11 Dec 2002 17:55
View based on a UNION of 2 Select's
#11213
Author: Jose Carlos
Date: Wed, 11 Dec 2002 17:55
75 lines
2096 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads