Home » RDBMS Server » Server Administration » Long data type Urgent
Long data type Urgent [message #373331] Wed, 11 April 2001 13:32 Go to next message
aish74
Messages: 19
Registered: March 2001
Junior Member
Hi ,

I am trying to do this

SELECT * FROM table WHERE seqno > value
(seqno is a long data type)
I am getting error "Illegal use of long data type.

Could anybody tell me how do I put the condition?
Re: Long data type Urgent [message #373333 is a reply to message #373331] Wed, 11 April 2001 14:41 Go to previous messageGo to next message
CHACKO
Messages: 11
Registered: March 2001
Junior Member
LONG datatype can store variable aswellas Number so it is not possible..
Re: Long data type Urgent [message #373334 is a reply to message #373333] Wed, 11 April 2001 14:51 Go to previous messageGo to next message
aish74
Messages: 19
Registered: March 2001
Junior Member
Then I want to change the datatype from long to no is it possible.
I tried creating another table and copying the data but was unable to do so bcos of the long datatype in the old table.
Please anybody let me know
1.How do I change the datatype long to number.
2.or copy the long datatype in to a number column
or insert londata type column in to another table
of number datatype column?

Please help
Re: Long data type Urgent [message #373335 is a reply to message #373333] Wed, 11 April 2001 15:12 Go to previous messageGo to next message
Andrew again...
Messages: 270
Registered: July 2000
Senior Member
CREATE TABLE new_tab(col1 date, col2 VARCHAR2(4000));

LOCK TABLE old_tab IN EXCLUSIVE MODE NOWAIT;

DECLARE
CURSOR datacursor IS SELECT col1, col2 FROM old_tab;
datarecord datacursor%ROWTYPE;
BEGIN
OPEN datacursor;
LOOP
FETCH datacursor INTO datarecord;
EXIT WHEN (datacursor%NOTFOUND);
INSERT INTO new_tab(col1, col2) VALUES (datarecord.col1, datarecord.col2);
END LOOP;
END;
/
Re: Long data type Urgent [message #373336 is a reply to message #373333] Wed, 11 April 2001 15:41 Go to previous messageGo to next message
Jaco
Messages: 23
Registered: August 2000
Junior Member
alter table tablename modify (sqlno number);
if there is no data
Re: Long data type Urgent [message #373337 is a reply to message #373333] Wed, 11 April 2001 15:42 Go to previous messageGo to next message
aish
Messages: 44
Registered: March 2001
Member
Hi Andrew ,

I tried your SQl but I got error like
" expression is of wrong type"

please let me know what do I do next.
Note :I tried your statement without col(long datatype) and it worked.
Re: Long data type Urgent [message #373338 is a reply to message #373333] Wed, 11 April 2001 15:42 Go to previous messageGo to next message
aish
Messages: 44
Registered: March 2001
Member
Hi Andrew ,

I tried your SQl but I got error like
" expression is of wrong type"

please let me know what do I do next.
Note :I tried your statement without col(long datatype) and it worked.
Re: Long data type Urgent [message #373339 is a reply to message #373333] Wed, 11 April 2001 15:45 Go to previous messageGo to next message
aish
Messages: 44
Registered: March 2001
Member
Thanks Jaco,

I have data in the table
Re: Long data type Urgent [message #373340 is a reply to message #373333] Wed, 11 April 2001 16:02 Go to previous message
Andrew again...
Messages: 270
Registered: July 2000
Senior Member
it works for me from sql*plus on 8i...

CREATE TABLE old_tab(col1 date, col2 long);

-- 5000 long!
insert into old_tab values (sysdate, lpad('a', 5000, 'b'));
insert into old_tab values (sysdate, lpad('x', 5000, 'y'));

CREATE TABLE new_tab(col1 date, col2 VARCHAR2(4000));

LOCK TABLE old_tab IN EXCLUSIVE MODE NOWAIT;

DECLARE
CURSOR datacursor IS SELECT col1, col2 FROM old_tab;
datarecord datacursor%ROWTYPE;
BEGIN
OPEN datacursor;
LOOP
FETCH datacursor INTO datarecord;
EXIT WHEN (datacursor%NOTFOUND);
INSERT INTO new_tab(col1, col2) VALUES (datarecord.col1, datarecord.col2);
END LOOP;
END;

-- Trimmed to length 4000!
select length(col2) from new_tab;
Previous Topic: RecordCount is -1 problem in Oracle
Next Topic: query
Goto Forum:
  


Current Time: Sat Jun 29 00:18:19 CDT 2024