473,480 Members | 1,688 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

print values

I am developing a new trigger and I would like to print Old and New
values of few columns. I know I can create new table and insert Old
and New values, but I would like to have simpler solution for this.

In Oracle,
DBMS_OUTPUT.PUT_LINE('Old Total wages = ' || TO_CHAR(O.total_wages));
DBMS_OUTPUT.PUT_LINE('New Total wages = ' || TO_CHAR(N.total_wages));
would print Old and New values. How to do it in DB2?

Thanks.

Mar 27 '07 #1
3 5245
On Mar 27, 2:02 pm, "annecarterfr...@gmail.com"
<annecarterfr...@gmail.comwrote:
I am developing a new trigger and I would like to print Old and New
values of few columns. I know I can create new table and insert Old
and New values, but I would like to have simpler solution for this.

In Oracle,
DBMS_OUTPUT.PUT_LINE('Old Total wages = ' || TO_CHAR(O.total_wages));
DBMS_OUTPUT.PUT_LINE('New Total wages = ' || TO_CHAR(N.total_wages));
would print Old and New values. How to do it in DB2?

Thanks.
Someone out there might be wonderign why I need this...here is my
trigger outline:

CREATE TRIGGER trig.sal_B
NO CASCADE BEFORE UPDATE OF total_wages, num_of_years
ON EMP_T
REFERENCING OLD AS O
NEW AS N
FOR EACH ROW
MODE DB2SQL
BEGIN ATOMIC
SET N.commision = (N.total_wages*N.num_of_years/1000.00);
END
;

I want to verify what would be Old and New values in these scenarios:
During update of both total_wages, num_of_years
During update of only num_of_years
During update of only total_wages

Thanks.

Mar 27 '07 #2
an*************@gmail.com wrote:
On Mar 27, 2:02 pm, "annecarterfr...@gmail.com"
<annecarterfr...@gmail.comwrote:
>I am developing a new trigger and I would like to print Old and New
values of few columns. I know I can create new table and insert Old
and New values, but I would like to have simpler solution for this.

In Oracle,
DBMS_OUTPUT.PUT_LINE('Old Total wages = ' || TO_CHAR(O.total_wages));
DBMS_OUTPUT.PUT_LINE('New Total wages = ' || TO_CHAR(N.total_wages));
would print Old and New values. How to do it in DB2?

Thanks.

Someone out there might be wonderign why I need this...here is my
trigger outline:

CREATE TRIGGER trig.sal_B
NO CASCADE BEFORE UPDATE OF total_wages, num_of_years
ON EMP_T
REFERENCING OLD AS O
NEW AS N
FOR EACH ROW
MODE DB2SQL
BEGIN ATOMIC
SET N.commision = (N.total_wages*N.num_of_years/1000.00);
END
;

I want to verify what would be Old and New values in these scenarios:
During update of both total_wages, num_of_years
During update of only num_of_years
During update of only total_wages
SELECT * FROM NEW TABLE(UPDATE ....)

:-)

If you insist on DBMS_OUTPUT style logging. I propose to write said
stored procedure in SQL and log to a DECLARE GLOBAL TEMPORARY TABLE ..
NOT LOGGED ON ROLLBACK PRESERVE ORWS ON COMMIT PRESERVE ROWS.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Mar 27 '07 #3
Serge Rielau wrote:
an*************@gmail.com wrote:
>On Mar 27, 2:02 pm, "annecarterfr...@gmail.com"
<annecarterfr...@gmail.comwrote:
>>I am developing a new trigger and I would like to print Old and New
values of few columns. I know I can create new table and insert Old
and New values, but I would like to have simpler solution for this.

In Oracle,
DBMS_OUTPUT.PUT_LINE('Old Total wages = ' || TO_CHAR(O.total_wages));
DBMS_OUTPUT.PUT_LINE('New Total wages = ' || TO_CHAR(N.total_wages));
would print Old and New values. How to do it in DB2?

Thanks.

Someone out there might be wonderign why I need this...here is my
trigger outline:

CREATE TRIGGER trig.sal_B
NO CASCADE BEFORE UPDATE OF total_wages, num_of_years
ON EMP_T
REFERENCING OLD AS O
NEW AS N
FOR EACH ROW
MODE DB2SQL
BEGIN ATOMIC
SET N.commision = (N.total_wages*N.num_of_years/1000.00);
END
;

I want to verify what would be Old and New values in these scenarios:
During update of both total_wages, num_of_years
During update of only num_of_years
During update of only total_wages

SELECT * FROM NEW TABLE(UPDATE ....)

:-)

If you insist on DBMS_OUTPUT style logging. I propose to write said
stored procedure in SQL and log to a DECLARE GLOBAL TEMPORARY TABLE ..
NOT LOGGED ON ROLLBACK PRESERVE ORWS ON COMMIT PRESERVE ROWS.
Alternatively, use a UDF as is described here: http://tinyurl.com/lu4wg

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Mar 28 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3381
by: babu | last post by:
Hello All, How are you? I am facing an issue to print all the form control values (including datagrid values). Is there a way to print all the control values in VB.NET. If the grid...
2
1945
by: ashtonn | last post by:
Hello, How do i print values returned by Py_BuildValue in Linux? PyObject *obj = Py_BuildValue("{s:i}", "Status", status); I need to print the Status value here -Thanks, Ashton
16
660
by: John Baker | last post by:
HI; I feel like a fool..I put CUTE FTP in my last request for help --it should have been CUTE PDF! I have FTP on my mind because I have been working on a web based application, and somehow my...
4
1927
by: Matt Mercer | last post by:
Hi, I have a asp .net/VB web app that does the typical submitting and retrieving from a SQL database. I am lost as to how I should create a print friendly page for the data. Here is the...
4
2337
by: rom | last post by:
I need to print a html table when the user clicks on a key. the problem is that i don't want the printer dialog box to appear. i guess this is impossible in javascript so i think to create an...
2
22203
by: polilop | last post by:
I have a class with 50 string variables. I need to see in my main program which ones are set to some values. To do this i need to print them to the screen. I'm getting fed up writting...
6
1251
by: Why Tea | last post by:
print format % values An optional minimum width of the conversion, specified using one or more digits or an asterisk (*), which means that the width is taken from the next item in values That's...
12
1898
by: jt2 | last post by:
Hello Perl Gurus! I'm quite a perl neophyte so I'm looking for help understanding why print doesn't print correctly. This may be a totally stupid error.... He is my program. What it is doing...
4
2650
by: Mtek | last post by:
Hi, We have a combo box on our page, which gets populated via a MySQL Query in PHP. What we want to do is to print the values on the page in a table that correspond the to selection from the...
2
1273
by: Geethu03 | last post by:
Hi i got the array values from the html page using foreach. In this i can get multiple array values to print in the table. the values are Date Forward Process 12/9/8008 5 3...
0
7037
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7034
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6732
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6886
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5324
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4768
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4472
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2976
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
558
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.