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

Database link: Wrong column length from cursor

Here's a problem

--------------------------------------------
set serveroutput on
DECLARE
CURSOR cur is select ed_no, length(ed_no) as len from
li******@pubdb.world; BEGIN
for cur_rec in cur
loop
DBMS_OUTPUT.PUT_Line
('>'||cur_rec.ed_no||'<'||to_char(cur_rec.len) );
end loop;
end;
/
-------------------------------------------

this returns
ABC <3
XYZ <3 ....

i.e. result has correct value plus six trailing spaces

Column ed_no is CHAR(3)

I have the same problem with all CHAR columns in all tables. The
column length is tripled and trailing spaces added if I define the
cursor through the database link.

However, if I login to that database directly and get rid of
"@pubdb.world" in cursor definition, everything works fine and the
code returns
ABC<3
XYZ<3

....

Any comments, suggestions, workarounds, please... This bug (I believe
it's a bug) gonna ruin a month of my work :(((

I NEED the database link and I cannot employ RTRIM() everywhere.

Regards,
Dmitry
Jul 19 '05 #1
2 3074
Dmitry Duginov wrote:
Here's a problem

--------------------------------------------
set serveroutput on
DECLARE
CURSOR cur is select ed_no, length(ed_no) as len from
li******@pubdb.world; BEGIN
for cur_rec in cur
loop
DBMS_OUTPUT.PUT_Line
('>'||cur_rec.ed_no||'<'||to_char(cur_rec.len) );
end loop;
end;
/
-------------------------------------------

this returns

ABC <3
XYZ <3


...

i.e. result has correct value plus six trailing spaces

Column ed_no is CHAR(3)

I have the same problem with all CHAR columns in all tables. The
column length is tripled and trailing spaces added if I define the
cursor through the database link.

However, if I login to that database directly and get rid of
"@pubdb.world" in cursor definition, everything works fine and the
code returns

ABC<3
XYZ<3


...

Any comments, suggestions, workarounds, please... This bug (I believe
it's a bug) gonna ruin a month of my work :(((

I NEED the database link and I cannot employ RTRIM() everywhere.

Regards,
Dmitry


Could it be someone is concatenating empty fields?
If the programmer is believing these are varchars, concatenating
not initialized (NULL) fields make no difference.
CHAR fields start off with 3 spaces. CHAR(3)||CHAR(3)||CHAR(3) yields
9 characters
--
Regards, Frank van Bortel

Jul 19 '05 #2
Dmitry Duginov wrote:
Here's a problem

--------------------------------------------
set serveroutput on
DECLARE
CURSOR cur is select ed_no, length(ed_no) as len from
li******@pubdb.world; BEGIN
for cur_rec in cur
loop
DBMS_OUTPUT.PUT_Line
('>'||cur_rec.ed_no||'<'||to_char(cur_rec.len) );
end loop;
end;
/
-------------------------------------------

this returns

ABC <3
XYZ <3


...

i.e. result has correct value plus six trailing spaces

Column ed_no is CHAR(3)

I have the same problem with all CHAR columns in all tables. The
column length is tripled and trailing spaces added if I define the
cursor through the database link.

However, if I login to that database directly and get rid of
"@pubdb.world" in cursor definition, everything works fine and the
code returns

ABC<3
XYZ<3


...

Any comments, suggestions, workarounds, please... This bug (I believe
it's a bug) gonna ruin a month of my work :(((

I NEED the database link and I cannot employ RTRIM() everywhere.

Regards,
Dmitry


Could it be someone is concatenating empty fields?
If the programmer is believing these are varchars, concatenating
not initialized (NULL) fields make no difference.
CHAR fields start off with 3 spaces. CHAR(3)||CHAR(3)||CHAR(3) yields
9 characters
--
Regards, Frank van Bortel

Jul 19 '05 #3

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

Similar topics

10
by: Bryan J Gudorf | last post by:
PDO, an open source python module for interfacing with RDBMS (SQL databases), has now reached 1.2.0! PDO provides an object oriented API, similar to that of ADO or JDBC, to python developers. PDO...
6
by: Clay Beatty | last post by:
When you create database diagrams in Enterprise Manager, the details for constructing those diagrams is saved into the dtproperties table. This table includes an image field which contains most of...
3
by: DarthMacgyver | last post by:
Hello, I recently wrote a survey application. Each question is very similar. The first questions gives me a problem when there are multiple people taking the survey (The Database connection...
2
by: Kums | last post by:
What is the maximum permissible size of a database? Is there any limitation. What is the maximum # of tablespace's allowed in a database? Thanks for your response.
2
by: Alex Guryanow | last post by:
Hi, I have windows app written in Borland C++ Builder 5.0. Using ODBC driver windows app connects to database on linux server. Database is created with UNICODE encoding. When pg-server is...
10
by: shsandeep | last post by:
The ETL application loaded around 3000 rows in 14 seconds in a Development database while it took 2 hours to load in a UAT database. UAT db is partitioned. Dev db is not partitioned. the...
0
bartonc
by: bartonc | last post by:
With one small change to the view/control: self.staticText3 = wx.StaticText(id=wxID_DBCONNECTDIALOGSTATICTEXT3, label='ODBC Data Source Name', name='staticText3',...
1
by: Muchach | last post by:
Hello, Ok so what I've got going on is a form that is populated by pulling info from database then using php do{} to create elements in form. I have a text box in each table row for the user to...
1
by: Dmitry Duginov | last post by:
Here's a problem -------------------------------------------- set serveroutput on DECLARE CURSOR cur is select ed_no, length(ed_no) as len from listtext@pubdb.world; BEGIN for cur_rec in cur...
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: 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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.