473,406 Members | 2,356 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,406 software developers and data experts.

PL/SQL problem with Updates that specify varchar

Hi,
I'm having a bit of trouble with an update performed by a PL/SQL
routine that is updating more rows than it should be. Here's some of
the code:

Note that ZENT.APPID is NUMBER and ZENT.UCLS is VARCHAR(12)

OPEN APPAccessCursor;
LOOP
FETCH APPAccessCursor INTO appid,ucls;
EXIT WHEN APPAccessCursor%NOTFOUND;

UPDATE ZENT SET "ZENT"."ACCLEVEL"='N' WHERE "ZENT"."UCLS"=ucls AND
"ZENT"."APPKEY"=appid;

END LOOP;
CLOSE APPAccessCursor;

appid and ucls are populated successfully by the fetch but when the
update is performed, all rows matching appid are updated and the value
of ucls is essentially ignored. I've tried =, like, and in for the
ucls portion of the update statement and they all produce the same
result. What am I doing wrong?
Jul 19 '05 #1
1 2956
pa*******@sanchez.com (Beelzehubub) wrote in message news:<df*************************@posting.google.c om>...
Hi,
I'm having a bit of trouble with an update performed by a PL/SQL
routine that is updating more rows than it should be. Here's some of
the code:

Note that ZENT.APPID is NUMBER and ZENT.UCLS is VARCHAR(12)

OPEN APPAccessCursor;
LOOP
FETCH APPAccessCursor INTO appid,ucls;
EXIT WHEN APPAccessCursor%NOTFOUND;

UPDATE ZENT SET "ZENT"."ACCLEVEL"='N' WHERE "ZENT"."UCLS"=ucls AND
"ZENT"."APPKEY"=appid;

END LOOP;
CLOSE APPAccessCursor;

appid and ucls are populated successfully by the fetch but when the
update is performed, all rows matching appid are updated and the value
of ucls is essentially ignored. I've tried =, like, and in for the
ucls portion of the update statement and they all produce the same
result. What am I doing wrong?


By any chance does the table zent has a column named ucls. If so you
are comparing the column to itself, which always matches. In this
case rename the plsql variable to v_ucls.

That is all I can think of with the code segment provided.
HTH -- Mark D Powell --
Jul 19 '05 #2

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

Similar topics

0
by: Morten Gulbrandsen | last post by:
Dear MySQL developers, Could some experienced Database developer please take a look at this ? It is supposed to be plain SQL2. How can it be coded under MySQL Especially all referential...
2
by: skidvd | last post by:
Hello: I have just recently converted to using the InnoDB table type so that I can enforce FOREIGN key constraints. I have been using MyISAM tables (accessed via JDBC) successfully for some...
3
by: Curtis Gilchrist | last post by:
I'm trying my hand at triggers and it doesn't seem to be working for me. I have a very simple database that consists of one table: Employees. I want to create a trigger that will limit the...
5
by: Teo | last post by:
Hi! Sorry for my many postings on this Newsgroup. I am new to ADO.NET and I got Sceppa's book on ADO.NET. It's a great book but covers a lot on the DataAdapter and Offline Data. Now, if I want to...
3
by: shorti | last post by:
I know this subject has come up many times but I am not finding what I am looking for after a couple days of searching. I know some months ago I saw an indirect solution for this but I cant seem...
1
by: ozzii | last post by:
Hi, I have a table called products which consist of various supplier products and has the following fields: ID int not null primary key auto_increment SupplierID int not null ProductCode...
3
by: Shestine | last post by:
I am trying to add a column to a current table, with data in it. I am only learning, and i have no idea how to change this to make it work. Here is the script I have right now it, but what it does is...
1
by: Beelzehubub | last post by:
Hi, I'm having a bit of trouble with an update performed by a PL/SQL routine that is updating more rows than it should be. Here's some of the code: Note that ZENT.APPID is NUMBER and ZENT.UCLS...
9
by: Keith G Hicks | last post by:
I'm having a lot of trouble with "file in use" errors in my "folder watcher" project. Starting and stopping the watcher and reading my XML file work fine. Once the watcher is started, I'm reading...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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
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,...
0
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...

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.