473,326 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

BEGIN ATOMIC, COMMAND CENTRE SCRIPT

Hi,

Here is an example of what I am trying to do. Can I not access (echo or
print or dump to file) the variables within the "BEGIN ATOMIC" ? I get
the error "SQL0104N An unexpected token "ECHO" was found following "a
= cur.TABLE_NAME "

Constraint : I cannot create new tables or procedures.

BEGIN ATOMIC

DECLARE v_counter INTEGER DEFAULT 0;
DECLARE not_found CONDITION FOR SQLSTATE '02000';

DECLARE a VARCHAR(500);
FOR cur AS SELECT TABLE_NAME FROM SYSIBM.TABLES DO
SET a = cur.TABLE_NAME;
ECHO a; <----- Error
<-------------------------------------------
END FOR;

SET v_counter = (SELECT count(*) FROM SYSIBM.TABLES AS TABLE WHERE
TABLE.TABLE_SCHEMA = 'COMP' );

END
@

Randy

May 2 '06 #1
4 10057
Is this just for debugging? If it is, here's a couple ideas.

DECLARE a GLOBAL TEMPORARY TABLE and INSERT data INTO it. After
execution of the FUNCTION, you can read what it was.

User a CURSOR WITH RETURN TO CLIENT, for VALUES <variable name>. OPEN
the CURSOR and let the client display its data.

B.

May 2 '06 #2

"TheSpongebob" <ga*****@sympatico.ca> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
Hi,

Here is an example of what I am trying to do. Can I not access (echo or
print or dump to file) the variables within the "BEGIN ATOMIC" ? I get
the error "SQL0104N An unexpected token "ECHO" was found following "a
= cur.TABLE_NAME "

Constraint : I cannot create new tables or procedures.

BEGIN ATOMIC

DECLARE v_counter INTEGER DEFAULT 0;
DECLARE not_found CONDITION FOR SQLSTATE '02000';

DECLARE a VARCHAR(500);
FOR cur AS SELECT TABLE_NAME FROM SYSIBM.TABLES DO
SET a = cur.TABLE_NAME;
ECHO a; <----- Error
<-------------------------------------------
END FOR;

SET v_counter = (SELECT count(*) FROM SYSIBM.TABLES AS TABLE WHERE
TABLE.TABLE_SCHEMA = 'COMP' );

END
@


Have a look at this article:
http://www-128.ibm.com/developerwork...0302izuha.html

--
Rhino
May 2 '06 #3
thanx guys. all excellent solutions.

May 2 '06 #4
Randy wrote:
thanx guys. all excellent solutions.

FYI: ECHO is a CLP command, not an SQL statement, that's why it can't be
used.
If you want to do client side scripting use a language of your choice
like PHP, Python, PERL, ....
IBM has made a choice not to add its own flavor.
Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
May 2 '06 #5

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

Similar topics

42
by: Shayan | last post by:
Is there a boolean flag that can be set atomically without needing to wrap it in a mutex? This flag will be checked constantly by multiple threads so I don't really want to deal with the overhead...
2
by: gabriel | last post by:
Greetings, I am adding foreign keys to a database and saving the generated scripts. What I do not understand is that all script begin with empty transactions. Why ? Example follows : /*
2
by: Lyn Duong | last post by:
Hi In SQL Server query analyser, I have the follwoing query if exists (select * from dbo.sysobjects where id = object_id(N'.') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table . GO
8
by: Ben Young | last post by:
Hi there, I am having a problem with the following code: CREATE TABLE temp ( num integer UNIQUE ); INSERT INTO temp (num) VALUES (1); INSERT INTO temp (num) VALUES (2); INSERT INTO temp (num)...
6
by: blackstreetcat | last post by:
consider this code : int i; //gobal var Thread1: i=some value; Thread2: if (i==2) dosomething(); else dosomethingelse();
1
by: mstraczynski | last post by:
Hello, I've written a procedure that extracts records from the source table and migrates them into several other tables. For each source record several records in destination tables have to be...
10
by: jimmy | last post by:
Hi again, sorry for posting two questions so close together but im working on a school project which is due in soon and running into some difficulties implementing the database parts. I have the...
2
by: Freedom fighter | last post by:
Hello, Is a singleton class the same as an atomic class? I know that a singleton class can only be instantiated once, but does that concept apply to an atomic class? Thank you.
11
by: Jon Harrop | last post by:
Can read locks on a data structure be removed safely when updates are limited to replacing a reference? In other words, is setting a reference an atomic operation? I have been assuming that all...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.