Subject RE: [firebird-support] select first fails with view
Author Rick DeBay
Firebird 1.5.1, DBW 2.4.2.12; I Have no idea what EMS manager or IBX
is.

Select * from V_DRUGLIST works; so the view definition doesn't have any
extra commas.
Select first 1 * from V_DRUGLIST fails.

CREATE VIEW V_DRUGLIST
(
BRANDGENERIC,
NDC,
GPI,
THERACODE,
DRUG,
LABEL,
SUPPLIERCODE,
DISTRB_CTR,
ACTIVE_FLAG,
PRICE340B,
PRICEACQUISITION,
PRICEAWP,
PRICEWAC,
PRICELIST,
ACQPRICECHANGED,
QTY
) AS
SELECT
BRANDGENERIC,DRUGLIST.NDC,GPI,THERACODE,DRUG,LABEL,SUPPLIERCODE,DISTRB_C
TR,ACTIVE_FLAG,PRICE340B,PRICEACQUISITION,PRICEAWP,PRICEWAC,PRICELIST,AC
QPRICECHANGED,QTY
FROM DRUGLIST JOIN DRUGQUANTITY
ON DRUGLIST.NDC=DRUGQUANTITY.NDC
;

-----Original Message-----
From: Helen Borrie [mailto:helebor@...]
Sent: Wednesday, August 04, 2004 3:51 AM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] select first fails with view

At 08:55 AM 4/08/2004 +0200, you wrote:


>Helen Borrie schrieb:
> > At 12:23 PM 3/08/2004 -0400, you wrote:
> >
> >>Select first 1 * from sometable works.
> >>Select first 1 * from v_someview fails:
>
> > In the Employee database, PHONE_LIST is a view, and this works fine:
> >
> > SELECT FIRST 1 * FROM PHONE_LIST
>
>Not quite.
>Working with an IB_Query (4.2Hf) some statements work, some don't.
>
>SELECT FIRST 1 * FROM VIEW ... does NOT work

Oh, that was a pre-Firebird artifact in IBO (4.2Hf came out in June
2002)
that took "FIRST" to be a column identifier and "1" to be a run-time
alias,
and would barf when it got to "*". It happened with tables as well as
views. It was fixed later. So maybe this inquirer is working with a
pre-Firebird version of EMS Manager as well. EMS Manager uses FIBPlus,
I
think, so the parser in versions since the Firebird 1 release should
know
about SELECT FIRST.

It's pretty unlikely to work if EMS is built with IBX, though, since the

IBX parser doesn't know about Firebird features at all.

Here's a fun one for you though:

create table blah (
id integer,
"FIRST" VARCHAR(10));
commit;
insert into blah
values (1, 'parsnips');
insert into blah
values (2, 'turnips');
insert into blah
values (3, 'carrots');
insert into blah
values (4, 'spinach');
commit;

select FIRST from blah;

id FIRST
=== ========
1 parsnips
2 turnips
3 carrots
4 spinach

select FIRST 2 FIRST from blah;

FIRST
========
parsnips
turnips

:-) heLen





Yahoo! Groups Links