× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Common Table Expressions are part of SELECT Statements but NOT of UPDATE
statement.
Nested sub-selects can be used in conjunction with UPDATE statements.

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von Jim
Oberholtzer
Gesendet: Tuesday, 29.3 2016 14:02
An: 'Non-Technical Discussion about the IBM i (AS/400 and iSeries)';
'Midrange Systems Technical Discussion'
Betreff: RE: Common Table Expressions with UPDATE

Dave,

What Rob is trying to get at is repost your question on
midangel@xxxxxxxxxxxx.

I've cross posted it for you. If you have not signed up for that list
please do and you'll see some of the best IBM i SQL experts in the world
work with your question.

--
Jim Oberholtzer
Agile Technology Architects


-----Original Message-----
From: Midrange-NonTech [mailto:midrange-nontech-bounces@xxxxxxxxxxxx] On
Behalf Of Rob Berendt
Sent: Tuesday, March 29, 2016 6:35 AM
To: Non-Technical Discussion about the IBM i (AS/400 and iSeries)
Subject: Re: Common Table Expressions with UPDATE

I think this definitely qualifies as a 'technical' topic and not a
'nontechnical' topic.
I am not nit picking. There are a lot of good technical people on the
technical list who simply do not have the time nor desire for some of the
stuff on the 'nontechnical' list.
http://lists.midrange.com/


Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1 Group Dekko Dept 1600 Mail
to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





From: dlclark@xxxxxxxxxxxxxxxx
To: Midrange-Nontech <midrange-nontech@xxxxxxxxxxxx>
Date: 03/28/2016 06:10 PM
Subject: Common Table Expressions with UPDATE
Sent by: "Midrange-NonTech" <midrange-nontech-bounces@xxxxxxxxxxxx>



Sorry if this has been asked before -- I am new to this list. Are

Common Table Expressions (CTE) not supported for UPDATE statements? Since

I am getting Message: [SQL0199] Keyword UPDATE not expected. Valid tokens:

( SELECT VALUES. this leads to me to this conclusion -- unfortunately.
Tell me it ain't so.

With SequList (WaitId, ItemName, ItemType, ItemAttr, WaitSequ)
as (Select UTWAITLT_ID, Item_Name, Item_Type, Item_Attribute,
Wait_Sequence
From Waiting_List
Where Item_Name = 'UTWAITBRSM'
And Item_Type = '*MODULE'
And Item_Attribute = 'SQLRPM'
Order by Item_Name, Item_Type, Item_Attribute, Wait_Sequence
)
Update SequList as cte
Set cte.WaitSequ = NEXT VALUE FOR TEMP_SEQ Where cte.WaitId IN (Select
WaitId from SequList) Order by Item_Name, Item_Type, Item_Attribute,
Wait_Sequence;

Basically, what I am trying to accomplish is to resequence, in
place, a numeric column from 10 by 10. This is used in a priority list
where an entry's priority can change. Thus, for example, if there are 5
entries in a particular group and the entry at priority 30 is changed to
priority 5, I then want to resequence that group of entries from 10 such
that the changed entry will remain with the highest priority of 10 -- i.e.,
raising it from 30 to 10 -- and moving all other entries in the group down
by 10 for each existing entry. I've been able to resequence the column but
I have not been able to resequence according to the new priority sequence --
rather, it resequences by the primary identity key no

matter what I try. How can I accomplish this?

Sincerely,

Dave Clark
int.ext: 91078
direct: (937) 531-6378
home: (937) 751-3300

Winsupply Group Services
3110 Kettering Boulevard
Dayton, Ohio 45439 USA
(937) 294-5331



****************************************************************************
*****************
This email message and any attachments is for use only by the named
addressee(s) and may contain confidential, privileged and/or proprietary
information. If you have received this message in error, please immediately
notify the sender and delete and destroy the message and all copies. All
unauthorized direct or indirect use or disclosure of this message is
strictly prohibited. No right to confidentiality or privilege is waived or
lost by any error in transmission.
****************************************************************************
*****************
--
This is the Non-Technical Discussion about the IBM i (AS/400 and iSeries)
(Midrange-NonTech) mailing list
To post a message email: Midrange-NonTech@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-nontech
or email: Midrange-NonTech-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/midrange-nontech.



--
This is the Non-Technical Discussion about the IBM i (AS/400 and iSeries)
(Midrange-NonTech) mailing list
To post a message email: Midrange-NonTech@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-nontech
or email: Midrange-NonTech-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/midrange-nontech.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.