473,883 Members | 1,576 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

db2 print message within procedure

3 New Member
Hi all :)

I like to be able to print messages throughout my long procedure statement.

I can currently use "!echo my message@" outside of my procedure BUT not able to figure out how to do this inside the procedure.

Any help would be greatly appreciated.

Deniz
Mar 14 '08 #1
3 19670
sakumar9
127 Recognized Expert New Member
You cannot print directly to standard output device from a stored procedure. However, you can redirect your output to a file. Again, this is possible only if your stored procedure definition is written in a language than SQL/PL.

You can implement file handling.

By the way, what do you want to achieve from doing this?

Regards
-- Sanjay
Mar 19 '08 #2
docdiesel
297 Recognized Expert Contributor
Hi,

Deniz, as far as I can guess you'd like to echo some debug messages, like "stored procedure at point 3", right?

Now that a direct output isn't possible (Thanks Sanjay, I wouldn't have known), I suggest another approach. Create a separate table "debugtext" with columns (when datestamp, txt varchar(255)) and insert your messages into it while inside the stored procedure:

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO
  2.   debugtext
  3. VALUES
  4.   ( current_datestamp, 'stored proc at point 7' );
Sanjay, this should be possible, shouldn't it?

Regards,

Bernd
Mar 20 '08 #3
sakumar9
127 Recognized Expert New Member
Yes Bernd, this is possible....... .....

Regards
-- Sanjay
Mar 20 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2865
by: Khalid Hussain | last post by:
hi Could someone please help me in following: I need to update Policy status base upon commencement date and then print with new Policy status. I written a stored procedure to update the policy. Now I need to work out how I can print a report. We already doing the report manually in our VB6 program but this is automatic process. So no users involve here. It would change the status by running the stored procedure and then print the...
4
14843
by: James | last post by:
Hello All, I have a stored procedure which will act like a main/controller script which will then invoke more stored procedures (~20). Basically, it looks something like below: -- start script create procedure ... print 'process started' exec sp_1
6
2323
by: Wim van Rosmalen | last post by:
I've upgraded MS-Access 2002 to a MS-Access Project (adp), so now I have to deal with more sophisticated queries (may I call them so?) like stored procedures. I have a form with a combobox for selections and a textbox to enter a certain value. Let us say I call the combobox @select and the textbox @find. The combobox always shows the first of the items to select. Now I want to return a message if nothing is found, or if nothing has been...
1
1566
by: Wim van Rosmalen | last post by:
Hi folks, I've upgraded MS-Access 2002 to a MS-Access Project (adp), so now I have to deal with more sophisticated queries (may I call them so?) like stored procedures. I have a form with a combobox for selections and a textbox to enter a certain value. Let us say I call the combobox @select and the textbox @find. The combobox always shows the first of the items to select. Now I want to return a message if nothing is found, or if...
1
1849
by: Richard Hollenbeck | last post by:
I noticed I can't push a value into a text box by saying something like, "txtThisTextBox = intSomeVariable * 0.5" because I get an run-time error saying I can't assign a value to this object. So instead I made the control source a function to pull the value from the function. That works. Inside the text box I simply write something like =SomeFunction(). Beautiful. Works great.
4
2174
by: franchdream | last post by:
DELPHI code: unit test1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type
2
22884
by: Bill_DBA | last post by:
I have the following stored procedure that is called from the source of a transformation in a DTS package. The first parameter turns on PRINT debug messages. The second, when equals 1, turns on the openning, fetching, and closing of a cursor. Things are fine if only one of the two parameters was set to 1. When run with both parameters turned on, "dba_test_dts 1, 1", DTS source (tab) preview fails because it thinks no row was returned....
2
24035
by: GUILLAUME LECOMTE | last post by:
Hi, I am a bit new to db2, and I am unable to find a proper command syntax where I can print values during execution in a stored procedure Pls help. regards, guillaume
11
7360
by: Gord | last post by:
When I open a certain report, it runs some code that generates the records that will be displayed in that report. This works fine. When I go to print preview the report it appears that the code is run again? This is causing certain error problems. 1 Why does the code run for a print preview when the report already exists? 2 What command do I use in code to find out if a report (or any other object for that matter) is already...
0
9777
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11109
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10728
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10833
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10405
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9558
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5980
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4602
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3227
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.