Skip to Main Content

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, gaurang.

Asked: August 16, 2001 - 5:37 pm UTC

Last updated: September 11, 2007 - 8:00 am UTC

Version: 8.1.6

Viewed 10K+ times! This question is

You Asked

hi tom,

why i am getting this message.
why can't i use below statement if there is LONG data type

CREATE TABLE EIM_ACCNT_DTL AS SELECT * FROM SIEBEL.EIM_ACCNT_DTL@GUI_RCR320
*
ERROR at line 1:
ORA-00997: illegal use of LONG datatype

Thanks

and Tom said...

In 8i you should not be using LONGS (long raws) they are deprecated types.

There are many restrictions with them -- this is one of them (not so with CLOBS/BLOBS)

See
</code> http://asktom.oracle.com/Misc/MoveLongs.html <code>
for how to copy a long from table to table.

Rating

  (12 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Use COPY COmmand

Gopal, August 17, 2001 - 10:58 am UTC

Baby USE COPY COMMAND
BUT BE VERY CAREFUL
BE COMPLETELY AWARE OF
COPY -Insert
REPLACE--DROPS AND RECREATES THE TABLE
TRUNCATE--TRUNCATES DATA.

Moving Longs

A reader, March 30, 2003 - 9:43 am UTC

In the url
</code> http://asktom.oracle.com/~tkyte/Misc/MoveLongs.html <code>
for copying long datatypes

How can I find the sine of my longest long
set long N -- size of your longest long

Thank you

Tom Kyte
March 30, 2003 - 10:01 am UTC

you would have to know it, unless the application stored it (like we do in ALL_VIEWS). Otherwise you have to write a program to read the long and see how big it is.

Moving longs

A reader, March 30, 2003 - 12:03 pm UTC

We are not storing the length of the long datatypes. Is there a Oracle package that can give this kind of information.

Thank you

Tom Kyte
March 30, 2003 - 2:41 pm UTC

see
</code> http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:834827040715 <code>

it'll be slower then molasses in feburary in alaska if you have more then a trivial amount of data.

Since you are moving them -- have you considered using a better datatype? Like CLOB? Then

a) you can use CREATE TABLE NEW as select ...., to_lob(long) from old;
b) never have this problem again.

Long datatype

A reader, March 30, 2003 - 8:39 pm UTC

We have about 300000 + records in the table.

Thank you


ORA-00997 on selecting a view

Muthu, July 13, 2004 - 9:30 am UTC

Sir,

I am getting ORA-00997 on selecting a view.

Scenario:
========

1. A view(v1) is created on a table using dblink (the table contains long column)

2. Another view(v2) is created on this view(v1).

3. Select on this view(v2) throws ORA-997

4. Source and destination database version is 9.2.0.5


The query is not falling on any restriction of LONG.

Views:
=====

V1:
==
CREATE OR REPLACE VIEW PS_SQS_NOTICE AS
SELECT a.effdt_from , a.seqnum , a.descr , a.effdt_to , a.yes_delete ,
a.sqs_display_to_all , a.lastupdoprid , a.last_dttm_update , a.htmlArea
FROM PS_SQS_NOTICE@S76LNK a;

v2:
==
CREATE OR REPLACE VIEW PS_SQS_NOTICE_VW AS
SELECT EFFDT_FROM ,SEQNUM ,SQS_DISPLAY_TO_ALL ,HTMLAREA
FROM PS_SQS_NOTICE
WHERE TO_DATE(TO_CHAR(EFFDT_FROM,'DD-MON-YYYY'),'DD-MON-YYYY')
<= TO_DATE(TO_CHAR(SYSDATE,'DD-MON-YYYY'),'DD-MON-YYYY')
AND TO_DATE(TO_CHAR(EFFDT_TO,'DD-MON-YYYY'),'DD-MON-YYYY')
>= TO_DATE(TO_CHAR(SYSDATE,'DD-MON-YYYY'),'DD-MON-YYYY')
ORDER BY EFFDT_FROM DESC, SEQNUM DESC;



In the above views, only the column HTMLAREA is of type LONG.


Please, clarify the reason.


Thanks in advance
Muthu

Tom Kyte
July 13, 2004 - 12:13 pm UTC

if you do it without the view -- does it work.

what is the query plan you see.

the date stuff would be more efficient and legible as:

where effdt_from between trunc(sysdate) and trunc(sysdate)+1
and effdt_from <> trunc(sysdate)+1;

it would actually be able to use an index to process the query that way.

Length of Long datatype

Tarra, July 21, 2005 - 12:30 pm UTC

How can I check on the length of a long field?

Long datatype

Tarra, July 21, 2005 - 12:34 pm UTC

I forgot to tell you that I am using oracle 8i. Please tell me how to check on the length of a long field in a table

Long Datatype

Cathy Tao, March 01, 2007 - 4:31 pm UTC

Hi Tom,

I create a table with a column of long datatype. I insert a string more than 3000 characters. When I select this column, it returns the string in double byte format. Please help why it is happening?

Thanks,
- Cathy
Tom Kyte
March 02, 2007 - 1:01 pm UTC

eh? what is "double byte format"

Long Datatype

Kathy, March 05, 2007 - 9:33 am UTC

The data is feteched back as "I N S T ..." instead of "INST...". Is there any set up on Server side? I saw this problem on oracle8i, oracle9i, but not on oracle 10g.
Tom Kyte
March 05, 2007 - 2:04 pm UTC

I've never seen that happen - it would be odd. I'll have to refer you to support, it is not what is expected.

LONG deprecated?

ysid, April 03, 2007 - 7:28 pm UTC

Tom,

You mentioned LONG is deprecated in 8i, is it a good idea to use it in 10G R2? We have a situation where the column datatype is blob but the actual data is charecter with maximum size being 1MB (average being 10KB). This column gets lot's of update/inserts so performance with blob is really slow (Especially updates). Which one do you suggest for this column datatype conversion LONG or CLOB?

Thanks
Tom Kyte
April 04, 2007 - 10:05 am UTC

no, i would not.

do you know about all of the options available with your CLOB (it should be a clob, not a blob) column? Or are you just using the "defaults" (nocache for example...)

LONG is long gone ;)

ysid, April 04, 2007 - 8:10 am UTC

Tom,

I found in documentation that LONG is only for backward compatibility. http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_sqltypes.htm#sthref347

It seems like my only chioce is CLOB and reading about optimizing them.

Thanks

Fetching from long column

A reader, September 06, 2007 - 4:40 am UTC

Hi Tom,

I need to get the name of the partition (column partition_name) that holding
the value 'MAXVALUE' at column high_value in dba_tab_partitions.
Since the high_value column is LONG datatype , i used the following
function in pl/sql block to get the value.

Its work , but im not feeling that this the way its should be done.
Could You please suggest alternative way ?

create Function GetPartHighValue (i_table_name varchar2,i_partition_name varchar2)
return varchar2
is
temp varchar2(32000);
begin
select high_value
into temp
from dba_tab_partitions
where table_name = i_table_name
and partition_name = i_partition_name ;
return temp;
exception
when no_data_found then
return(null);
end;

set serveroutput on

declare
v_max_partition_name dba_tab_partitions.partition_name%type;
begin
select partition_name
into v_max_partition_name
from dba_tab_partitions
where TABLE_NAME = 'BB_CALLS'
and GetPartHighValue(table_name,partition_name) = 'MAXVALUE';

dbms_output.put_line('v_max_partition_name='||v_max_partition_name);
exception
when no_data_found then
dbms_output.put_line('NOTHING FOUND');
end;

v_max_partition_name=BB_CALLS_MAX_VALUE

PL/SQL procedure successfully completed.

Thanks

Tom Kyte
September 11, 2007 - 8:00 am UTC

you need to refine your query in the function a little, you need more identifying information (owner) to get just the row you are interested in.

but other than that - perfect, you got it right.

More to Explore

CLOB/BLOB/etc

Complete documentation on Securefiles and Large Objects here