dbTalk Databases Forums  

Does Trim function is automatically apply to char datatype in 9i

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Does Trim function is automatically apply to char datatype in 9i in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
cschang
 
Posts: n/a

Default Does Trim function is automatically apply to char datatype in 9i - 02-18-2005 , 11:08 PM






We have an old database. Some of the columns were built with char data
type. We used to use the Trim() or RTRIM() to trim off the space before
comparison, such as in left side of where condition ( where Trim(col1) =
value). Our DBA told us that using the 9i applies the Trim
automatically already so we do not need the RTrim(). Apparently that
was not what I saw. I search some web sites and other places, found no
mentioned about these features. Because adding the trim will cause our
performance, any other way to avid to use it (besides to convert char
type to varchar2 type)? Appreciate anyone’s suggestions.

C Chang

Reply With Quote
  #2  
Old   
DA Morgan
 
Posts: n/a

Default Re: Does Trim function is automatically apply to char datatype in9i - 02-20-2005 , 04:53 PM






cschang wrote:

Quote:
We have an old database. Some of the columns were built with char data
type. We used to use the Trim() or RTRIM() to trim off the space before
comparison, such as in left side of where condition ( where Trim(col1) =
value). Our DBA told us that using the 9i applies the Trim
automatically already so we do not need the RTrim(). Apparently that
was not what I saw. I search some web sites and other places, found no
mentioned about these features. Because adding the trim will cause our
performance, any other way to avid to use it (besides to convert char
type to varchar2 type)? Appreciate anyone’s suggestions.

C Chang
Two suggestions:

1. Rather than asking create a little table and check it out.

CREATE TABLE t (
testcol CHAR(20));

INSERT INTO t VALUES ('x');
COMMIT;

SELECT LENGTH(testcol) FROM t;

ALTER TABLE t
MODIFY testcol VARCHAR2(20);

SELECT LENGTH(testcol) FROM t;

UPDATE t SET testcol = TRIM(testcol);
COMMIT;

SELECT LENGTH(testcol) FROM t;

2. Get a new DBA.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace 'x' with 'u' to respond)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.