|
Doesn't seem like that should work as the outside construct is an insert,
and the prepared statements allowed are select. I will try though.
Mark Murphy
Atlas Data Systems
mmurphy@xxxxxxxxxxxxxxx
-----Charles Wilt <charles.wilt@xxxxxxxxx> wrote: -----
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
From: Charles Wilt <charles.wilt@xxxxxxxxx>
Date: 03/07/2017 11:00AM
Subject: Re: Ok, I need an alternative SQL syntax
Switch to dynamic...thus allowing the use of a variable with FETCH FIRST?
Charles
On Tue, Mar 7, 2017 at 8:27 AM, Mark Murphy/STAR BASE Consulting Inc. <
mmurphy@xxxxxxxxxxxxxxx> wrote:
Here is what I need:be
insert into qtemp/wk_jcpordf (relid, relsq, uid)
select :relid, :relsq, a.iduid
from jcuidp a
join (select distinct idjyr, idjno, idbpth
from jcuidp
where iduid = :uid
and idstat = 'A') b
on (a.idjyr, a.idjno, a.idbpth) =
(b.idjyr, b.idjno, b.idbpth)
left exception join jcpordf c
on c.dpuid = a.iduid and c.pstat = 'A'
fetch first :qty rows only;
JCUIDP contains a map of serial numbers (iduid) with a reference to it's
location in a bill of materials (idbpth) for a job (idjyr, idjno). If a
part has a quantity of 5 at a particular location in the BOM, there will
5 JCUIDF records with a unique serial number for each of the 5 parts.can
JCPORF is a list of parts by UID that have been released for purchasing.
At any time, a partial quantity of the parts for a location in the BOM
be released for purchasing. If I want to release 2 of these 5 parts, Iwant
to set qty = 2, and run this insert. This would insert two unreleasedstatement
serial numbers into the wk_ file. I can get the select to work with a
constant value, but not a variable. Unfortunately, the user needs to be
able to pick the quantity so it can't be a constant. I see the following
note in the SQL Reference:
Allowed use of variable: fetch-first-row-count can be specified as a
variable only as part of the outer fullselect of a DECLARE CURSOR
or a prepared select-statement.and I
So :qty can not be specified here in this insert. I need logic to get
around this limitation. I can do it in RLA, but the logic is complex,
prefer to keep it in SQL. Any ideas?list
Mark Murphy
Atlas Data Systems
mmurphy@xxxxxxxxxxxxxxx
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxx--
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.