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

Do I need to create a field type LONG?

P: n/a
Hello
I am going to copy a data from MS Access table into Oracle table. One
of fields is memo type and data in this field range from 1 character
to 551 long string. Do I need to create a field type LONG in the
Oracle table to accommodate this data? If not, what field type would
suit best?
Any help will be greatly appreciated.
Thank you.
Galina
Jul 19 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
x
"Galina" <ga****@mail.ru> wrote in message
news:ec*************************@posting.google.co m...
Hello
I am going to copy a data from MS Access table into Oracle table. One
of fields is memo type and data in this field range from 1 character
to 551 long string. Do I need to create a field type LONG in the
Oracle table to accommodate this data? If not, what field type would
suit best?
Any help will be greatly appreciated.
Thank you.
Galina


varchar2 should be enough, iz can store up to 4000 characters.
Jul 19 '05 #2

P: n/a
Galina wrote:
Hello
I am going to copy a data from MS Access table into Oracle table. One
of fields is memo type and data in this field range from 1 character
to 551 long string. Do I need to create a field type LONG in the
Oracle table to accommodate this data? If not, what field type would
suit best?
Any help will be greatly appreciated.
Thank you.
Galina


You want type VARCHAR2.

Since Oracle 8.0 there are limited, if any, circumstances that justify LONG.
If the limit of 4000 bytes in VARCHAR2 is not enough, switch to the LOB
family (eg: CLOB) not the LONG family.

Check out Oracle's online documentation at http://docs.oracle.com for more.

/Hans
Jul 19 '05 #3

P: n/a
Thank you both for answering. I have already re-created the table with
the field type Varchar2 length 1000.
Simply for curiosity, when I copy a string shorter then 1000 into this
field, will Oracle use memory necessary to store the string, or to
store 1000 characters long string? Sorry for silly question, I
understand that I could have found it somewhere...
Galina
ga****@mail.ru (Galina) wrote in message news:<ec*************************@posting.google.c om>...
Hello
I am going to copy a data from MS Access table into Oracle table. One
of fields is memo type and data in this field range from 1 character
to 551 long string. Do I need to create a field type LONG in the
Oracle table to accommodate this data? If not, what field type would
suit best?
Any help will be greatly appreciated.
Thank you.
Galina

Jul 19 '05 #4

P: n/a

"Galina" <ga****@mail.ru> wrote in message
news:ec*************************@posting.google.co m...
Thank you both for answering. I have already re-created the table with
the field type Varchar2 length 1000.
Simply for curiosity, when I copy a string shorter then 1000 into this
field, will Oracle use memory necessary to store the string, or to
store 1000 characters long string? Sorry for silly question, I
understand that I could have found it somewhere...
Galina
ga****@mail.ru (Galina) wrote in message

news:<ec*************************@posting.google.c om>...
Hello
I am going to copy a data from MS Access table into Oracle table. One
of fields is memo type and data in this field range from 1 character
to 551 long string. Do I need to create a field type LONG in the
Oracle table to accommodate this data? If not, what field type would
suit best?
Any help will be greatly appreciated.
Thank you.
Galina

It stores the string as is. It does not pad the string. So if the string
is of length 2 then it takes up 2 (plus one for the column delimiter)
Jim
Jul 19 '05 #5

P: n/a
Hi Jim
Thank you for your answer. Of course, it should be this way. Any
respectable database stores strings allocating disk space as much as
necessary and not more. If Access does so, how can it be different
with Oracle, which is much more superiour!
Yesterday I copied my table from Access to Oracle with that field,
which can be any length, set as Varchar2 1000. I was very baffled to
find that the tablespace lost after copying about 70 MBt of space.
Previously, when I set up the field type long and wizard didn't allow
me to enter initial allocations, the tablespace after copying was
about 8 MBt less.
I even doubted for a short while, that your answer was right. But then
I decided that Oracle allocated all this space to my table, because
every record might have have 1000 character long string, but didn't
use it and new records will be added into the same allocated space.
Which means, that for a while the tablespace will not grow, despite
records being added. We shall see. The performance, if the field is
set as Varchar2, is noticeably better then when it was long.
Galina
"Jim Kennedy" <ke****************************@attbi.net> wrote in message news:<nmNlc.20901$IG1.865525@attbi_s04>...
"Galina" <ga****@mail.ru> wrote in message
news:ec*************************@posting.google.co m...
Thank you both for answering. I have already re-created the table with
the field type Varchar2 length 1000.
Simply for curiosity, when I copy a string shorter then 1000 into this
field, will Oracle use memory necessary to store the string, or to
store 1000 characters long string? Sorry for silly question, I
understand that I could have found it somewhere...
Galina
ga****@mail.ru (Galina) wrote in message

news:<ec*************************@posting.google.c om>...
Hello
I am going to copy a data from MS Access table into Oracle table. One
of fields is memo type and data in this field range from 1 character
to 551 long string. Do I need to create a field type LONG in the
Oracle table to accommodate this data? If not, what field type would
suit best?
Any help will be greatly appreciated.
Thank you.
Galina

It stores the string as is. It does not pad the string. So if the string
is of length 2 then it takes up 2 (plus one for the column delimiter)
Jim

Jul 19 '05 #6

P: n/a
ga****@mail.ru (Galina) wrote in message news:<ec*************************@posting.google.c om>...
Hi Jim
Thank you for your answer. Of course, it should be this way. Any
respectable database stores strings allocating disk space as much as
necessary and not more.


That's why it's called varchar ==> variable character length.
char data type on the other hand will pad your string up to specified
length, see example:

SQL> create table temp (varname varchar2(20), fixname char(20));
Table created.

SQL> insert into temp values ('short string', 'short string');
1 row created.

SQL> insert into temp values ('longer string', 'longer string');
1 row created.

SQL> select '|'||varname||'|' "varname" from temp;

varname
----------------------
|short string|
|longer string|

SQL> select '|'||fixname||'|' "fixname" from temp;

fixname
----------------------
|short string |
|longer string |
Jul 19 '05 #7

P: n/a
Thank you., especially for taking your time to explain the difference
with the example. Not that I see a need for fixed length string at the
moment, but I am sure in some situations it would be needed.
Galina
sh******@yahoo.com (Sharkie) wrote in message news:<42**************************@posting.google. com>...
ga****@mail.ru (Galina) wrote in message news:<ec*************************@posting.google.c om>...
Hi Jim
Thank you for your answer. Of course, it should be this way. Any
respectable database stores strings allocating disk space as much as
necessary and not more.


That's why it's called varchar ==> variable character length.
char data type on the other hand will pad your string up to specified
length, see example:

SQL> create table temp (varname varchar2(20), fixname char(20));
Table created.

SQL> insert into temp values ('short string', 'short string');
1 row created.

SQL> insert into temp values ('longer string', 'longer string');
1 row created.

SQL> select '|'||varname||'|' "varname" from temp;

varname
----------------------
|short string|
|longer string|

SQL> select '|'||fixname||'|' "fixname" from temp;

fixname
----------------------
|short string |
|longer string |

Jul 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.