473,385 Members | 1,311 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,385 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 2952
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...
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...
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$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.