Long data type Urgent [message #373331] |
Wed, 11 April 2001 13:32 |
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 #373334 is a reply to message #373333] |
Wed, 11 April 2001 14:51 |
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 |
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 #373337 is a reply to message #373333] |
Wed, 11 April 2001 15:42 |
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 |
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 #373340 is a reply to message #373333] |
Wed, 11 April 2001 16:02 |
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;
|
|
|