Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Oracle view question

 
   Database Forums (Home) -> Oracle RSS
Next:  Cannot install SP4 on 2k3 Standard x64 (could not..  
Author Message
sameergn

External


Since: Mar 09, 2005
Posts: 4



(Msg. 1) Posted: Wed Aug 03, 2005 3:58 pm
Post subject: Oracle view question
Archived from groups: comp>databases>oracle>misc (more info?)

Hi,

The source table has a column which is varchar2(100).
If I create a view new_view on the column as
select substr(column_name, 1, 20) new_col from table,
then "desc new_view" command shows size of new_col as 60 i.e. 3 times
the intended size. Why is that? Is it because of multibyte characters?

Thanks,
Sameer.

 >> Stay informed about: Oracle view question 
Back to top
Login to vote
Malcolm Dew-Jones

External


Since: Aug 05, 2003
Posts: 165



(Msg. 2) Posted: Wed Aug 03, 2005 4:38 pm
Post subject: Re: Oracle view question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

wrote:
: Hi,

: The source table has a column which is varchar2(100).
: If I create a view new_view on the column as
: select substr(column_name, 1, 20) new_col from table,
: then "desc new_view" command shows size of new_col as 60 i.e. 3 times
: the intended size. Why is that? Is it because of multibyte characters?

It is certainly related to utf-8 (i.e. multiple-byte, though utf-8 is not
the same as older "multibyte" characters).

Not sure if "because" is the right word.

One "solution" is to use "substrb" (look it up though, I don't have the
manual with me). substrb takes bytes, not characters. IFF your data does
not have multiple-byte characters then that will work. That will be true
if you have nothing but ascii data, or, if the original character set was
an 8 bit character set.

The last point brings up the issue that this could be due to a
misunderstanding within oracle about what character sets are in use. If
the original table was not utf-8, and if the view presents its data in the
same character set as the table, then presumably oracle would not need to
magnify the width of the column in the view. However, I haven't played
with those details so I don't know exactly how the various settings would
interelate (or even if a view can present data in an alternate character
set than the table, never even thought about that one before!).


--

This space not for rent.

 >> Stay informed about: Oracle view question 
Back to top
Login to vote
sameergn

External


Since: Mar 09, 2005
Posts: 4



(Msg. 3) Posted: Wed Aug 03, 2005 6:38 pm
Post subject: Re: Oracle view question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

The database character set is UTF8 but the table itself does not
contain any multibyte data.
 >> Stay informed about: Oracle view question 
Back to top
Login to vote
Carlos

External


Since: Apr 07, 2005
Posts: 15



(Msg. 4) Posted: Thu Aug 04, 2005 4:56 am
Post subject: Re: Oracle view question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

>>The database character set is UTF8 but the table itself does not contain any multibyte data.

So, what?

If your view must hold 20 characters (substr(column_name, 1, 20)), it
will need up to 3 bytes x each in UTF8. (In AL32UTF8 it will need up to
4 bytes x each.)

It doesn't matter what the table *contains*. It's about the view
structure.

Cheers.

Carlos.
 >> Stay informed about: Oracle view question 
Back to top
Login to vote
sameergn

External


Since: Mar 09, 2005
Posts: 4



(Msg. 5) Posted: Fri Aug 05, 2005 2:38 pm
Post subject: Re: Oracle view question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks for your reply, it all makes sense now.

BTW, my earlier reply was just to provide additional information and
not to contradict Malcolm's comments
 >> Stay informed about: Oracle view question 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Question regarding view - Hi everyone I'm building datawarehouse using classical star schema. I have dimension called sellto_dim and second dimension called shipto_dim which is identical as sellto_dim. My idea is to create only view based on sellto_table instead of creating secon...

View vs Underlying Query Performance Question - I have a query that runs fast (second or less). I put this query into a view minus one condition (userid = '<the users userid>'). When I query the view and add the condition, the query (see 1 below) is slow (minutes). I tried running the view witho...

Oracle Index Question - Hello everyone, I need some help in formatting a query to make use of indices. The front end application collects user inputs and sends to our application and our application queries a database table and sends the results back. The user can choose any....

Oracle 9 Query question... - Hello, I am no Query expert so I would appreciate it very much if someone could help me out. We use Oracle 9. I have 1 table named contents. This table has the following fields: NR number(9) NOT NULL - the unique identifier PARENT number(9) NOT..

Oracle Index Question - I work primarily in SQL Server and have run across a situatiion in Oracle that's troubling me.... I have a query that contains a where clause with 2 restrictions. Both these fields are in a composite index of 3 fields. If I add the third field to the....
   Database Forums (Home) -> Oracle All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]