By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,502 Members | 1,878 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,502 IT Pros & Developers. It's quick & easy.

Database link: Wrong column length from cursor

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.