-
data conversion from char(4) data to char(2)
I have table called packagelines contains 3220 records
SQL> desc packagelines;
Name Null? Type
----------------------------------------- -------- --------------
CORP NOT NULL NUMBER(2)
PKG NOT NULL CHAR(2)
PKGSTOP NOT NULL CHAR(6)
LINE NOT NULL CHAR(4)
RCODE NOT NULL CHAR(2)
Now i want to reduce the size of a column LINE CHAR(4) to CHAR(2).How can i do it.
only two character data is present in the column LINE
J Gangadhar
-
Think you'd have to create a new table with the char(2) column and then insert using rtrim. Then drop the old table and rename the newly created one e.g.
SQL> create table t3 (col1 char(4));
Table created.
SQL> create table t4 (col1 char(2));
Table created.
SQL> insert into t3 values ('AA');
1 row created.
SQL> commit;
Commit complete.
SQL> insert into t4 (select rtrim(col1,' ') from t3);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t4;
CO
--
AA
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|