× 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.



Thanks Raul...I'll give that BEFORE a try...seems it would be more efficient.

Steve Needles


-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Raul A Jager W
Sent: Friday, June 13, 2014 3:14 PM
To: Midrange Systems Technical Discussion
Subject: Re: SQL Insert Trigger issues

To change data in a newly inserted Row I use "before" and update the data in the buffer. (mostly in RPG)

When you create the table the default for timestamp is "now", so if you insert without that field, it will contain the actual time.

_____________________________________________________________________________
On 06/13/2014 03:27 PM, Needles,Stephen J wrote:
I'm trying to create a trigger to update the row just written to a table. I'm having difficulties because it cannot resolve the correlation of the variables. The example only has one of 4 columns that I need to update.

Here is the entire code for the trigger:

Create trigger needles.WBXMLDtg01
after insert on needles.WBXMLD
referencing new row as new_row
for each row
mode db2row
update needles.wbxmld set wbxtsp = now() where wbxprc = new_row.wbxprc

this is the error:

SQL State: 42703
Vendor Code: -206
Message: [SQL0206] Column or global variable WBXPRC not found. Cause . . . . . : WBXPRC was not found as a column of table *N in *N and was not found as a global variable in *N. If the table is *N, WBXPRC is not a column of any table or view that can be referenced. Recovery . . . : Do one of the following and try the request again: -- Ensure that the column and table names are specified correctly in the statement. -- If this is a SELECT statement, ensure that all the required tables were named in the FROM clause. -- If the column was intended to be a correlated reference, qualify the column with the correct table designator. -- If the column was intended to be a global variable, qualify the name with the schema where the global variable exists or ensure the schema is in the path.

Why can't WBXPRC be found? It is the key for the table and as such exists in needles.WBXMLD. It is also identified using the referencing name for the new row, new_row.

My experience with triggers is very low and after spending much of the day looking online and in many manuals, I'm stuck.

Steve Needles

________________________________
This communication, including attachments, is confidential, may be subject to legal privileges, and is intended for the sole use of the addressee. Any use, duplication, disclosure or dissemination of this communication, other than by the addressee, is prohibited. If you have received this communication in error, please notify the sender immediately and delete or destroy this communication and all copies.

TRVDiscDefault::1201


-- Este e-mail fue enviado desde el Mail Server del diario ABC Color --
-- Verificado por Anti-Virus Corporativo Symantec --
--
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.


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.