473,387 Members | 1,440 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,387 software developers and data experts.

DB2 compound sql giving delimiter error

I am on DB2/AIX64 9.5.8
The script is below
Expand|Select|Wrap|Line Numbers
  1. DB=test
  2. SCHEMA=mine
  3. SCRIPT=`basename $0`
  4. . ~/db2profile
  5. db2 -tv +p <<EOQ
  6. UPDATE COMMAND OPTIONS USING s ON;
  7. UPDATE COMMAND OPTIONS USING z ON $PWD/$SCRIPT.$DB.log;
  8. connect to $DB;
  9.  
  10. Begin Atomic
  11.         For credit_rows as
  12.             select cacc.CUST_ID as caid
  13.             from  $SCHEMA.SS_CUSTACC_B cacc
  14.             where (cacc.CREDIT_NUM between 950 and 999
  15.             or  cacc.CREDIT_NUM between 1950 and 1999 )
  16.                and cacc.TU_ENABLE_IND = 'Y'
  17.                order by cacc.CUST_NUM
  18.         Do
  19.             update $SCHEMA.SS_CUSTACC_B ca
  20.             set ca.CREDIT_NUM = 1
  21.             where ca.CUST_ID = credit_rows.caid; 
  22.         End For;
  23. End     
  24. EOQ
When I run this I get error
DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token "END-OF-STATEMENT" was found following "D = credit_rows.caid". Expected tokens may include: "<delim_semicolon>". LINE NUMBER=22. SQLSTATE=42601


Not sure what delimiter should I set to fix this.
Can you please help.
Jul 19 '13 #1
2 3451
Finally I sort it out using a terminator smart tags as below.

Expand|Select|Wrap|Line Numbers
  1. --#SET TERMINATOR @
  2.  Begin Atomic
  3.          For credit_rows as
  4. -- snip code --- 
  5.              where ca.CUST_ID = credit_rows.caid; 
  6.          End For;
  7.  End @
  8. --#SET TERMINATOR ;     
I was trying to use the smart tag SET DELIMITER but TERMINATOR worked. So if anyone has solution using DELIMITER please post a relpy.

cheers
Jul 22 '13 #2
The supported way of calling statements like 'BEGIN ATOMIC END', 'CREATE PROCEDURE', 'CREATE TRIGGER' from CLP is to define an alternate termination character other than the default termination character(;)

Ref : http://pic.dhe.ibm.com/infocenter/db...69%6e%65%22%20
Jul 25 '13 #3

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

Similar topics

3
by: Bidarkota | last post by:
Hi, I built a windows application, when i run the executable in the machine where i built the application it is running good, but when i copy it to other machines and run the exe and i am...
12
by: prasi | last post by:
hi all, I have executed the following program, I was expecting some errors in the program but it didn't give any ERRORS!!!!!!!!!!!!!!!!!!!!!!!!!!! please can anybody explain me ?...
0
by: sandeep pandit via .NET 247 | last post by:
hello sir, i read your article on URL rewriting in asp.net on msdn.i have also used the same in my project.URL rewriting is working fine in our LAN and on our configured IP but problem is that...
2
by: edsuslen | last post by:
I am migrating working code (HTTPRequest with Authentication) from vb to vb.net vb: Set objXMLHTTPServer = New MSXML2.XMLHTTP30 objXMLHTTPServer.Open strMethod, strGetRequest, False, "UserId",...
5
by: washoetech | last post by:
Hello, I have tried to run my ASP.NET 2.0 application from IIS and I get a page not found error. When I debug from within Visual Studio.NET 2005 my application works fine. Any ideas? ...
7
by: John Øllgård Jensen | last post by:
Hi Using MS Asccess 2000: In a query I'm trying to create a new field with following expression: FilmDate: Left(,4) The field "FilmNo" is another text field in the query. This is...
0
by: bennett | last post by:
I posted in the WordPress tech support forum asking how to create a "sidebar" page that showed the last 3 posts from my blog, and someone replied telling me to create a php page with a certain...
6
by: DH Johnson | last post by:
Recent use in Access of Built-In Functions gets an error "The expression you entered has invalid vertical bars (|)." with any multi-argument function. This happened in Access 2002. I just upgraded...
1
by: b singh | last post by:
In iis 7 http:/site/x.aspx/pp%3f is giving runtime error Instaed of invalid virtual path. x.aspx is not existing in the server. What setting of IIS 7 is reuired so that it will give invalid...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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...
0
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,...
0
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...

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.