dbTalk Databases Forums  

UNION ALL fails in stored proc

comp.databases.btrieve comp.databases.btrieve


Discuss UNION ALL fails in stored proc in the comp.databases.btrieve forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bill
 
Posts: n/a

Default UNION ALL fails in stored proc - 02-08-2007 , 05:31 PM






The following stored proc returns no results. If I remove the UNION ALL
and the second SELECT it does work. What must I do to get the UNION ALL
to work? Thanks.

CREATE PROCEDURE paEmplRelateProc(IN :RR INTEGER)
RETURNS(
RecType VARCHAR(4),
Id VARCHAR(8),
Name VARCHAR(80),
SharedAmt REAL,
IsPrimary CHAR(1),
RR INTEGER,
FromRR INTEGER
);
BEGIN
SELECT
R.RecType,
P.PracArea AS Id,
CAST(P.Name AS VARCHAR(80)) AS Name,
R.SharedAmt,
R.IsPrimary,
P.RR AS RR,
R.FromRR
FROM paRelate R LEFT OUTER JOIN paPracArea P
ON P.RR = R.ToRR
WHERE R.RecType = 'PRAC'
AND R.FromTableId = 912 AND R.FromRR = :RR
UNION ALL
SELECT
R.RecType,
C.ContactId AS Id,
CAST(C.Name AS VARCHAR(80)) AS Name,
R.SharedAmt,
R.IsPrimary,
C.RR AS RR,
R.FromRR
FROM paRelate R LEFT OUTER JOIN paContact C
ON C.RR = R.ToRR
WHERE R.RecType = 'OFFC'
AND R.FromTableId = 912 AND R.FromRR = :RR;
END;

--
..Bill.

Reply With Quote
  #2  
Old   
Bill Bach
 
Posts: n/a

Default Re: UNION ALL fails in stored proc - 02-08-2007 , 09:20 PM






This is a known issue with Pervasive PSQL v9.5:

53862 A UNION ALL in a stored procedure returns no data
Workaround: Contact Pervasive Support for field test fix (FTF)
Goldstar Software Inc.
Pervasive-based Products, Training & Services
Bill Bach
BillBach (AT) goldstarsoftware (DOT) com
http://www.goldstarsoftware.com
*** Chicago: Pervasive Service & Support Class - 03/2007 ***


Bill wrote:

Quote:
The following stored proc returns no results. If I remove the UNION
ALL and the second SELECT it does work. What must I do to get the
UNION ALL to work? Thanks.

CREATE PROCEDURE paEmplRelateProc(IN :RR INTEGER)
RETURNS(
RecType VARCHAR(4),
Id VARCHAR(8),
Name VARCHAR(80),
SharedAmt REAL,
IsPrimary CHAR(1),
RR INTEGER,
FromRR INTEGER
);
BEGIN
SELECT
R.RecType,
P.PracArea AS Id,
CAST(P.Name AS VARCHAR(80)) AS Name,
R.SharedAmt,
R.IsPrimary,
P.RR AS RR,
R.FromRR
FROM paRelate R LEFT OUTER JOIN paPracArea P
ON P.RR = R.ToRR
WHERE R.RecType = 'PRAC'
AND R.FromTableId = 912 AND R.FromRR = :RR
UNION ALL
SELECT
R.RecType,
C.ContactId AS Id,
CAST(C.Name AS VARCHAR(80)) AS Name,
R.SharedAmt,
R.IsPrimary,
C.RR AS RR,
R.FromRR
FROM paRelate R LEFT OUTER JOIN paContact C
ON C.RR = R.ToRR
WHERE R.RecType = 'OFFC'
AND R.FromTableId = 912 AND R.FromRR = :RR;
END;


Reply With Quote
  #3  
Old   
Bill
 
Posts: n/a

Default Re: UNION ALL fails in stored proc - 02-09-2007 , 09:54 AM



I just got the FTF and it does work now.

--
..Bill.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.