Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Insert into one empty table from another table

Re: Insert into one empty table from another table

From: Brian Peasland <peasland_at_edcmail.cr.usgs.gov>
Date: Tue, 29 Aug 2000 13:08:23 GMT
Message-ID: <39ABB5C7.75E928E5@edcmail.cr.usgs.gov>

> INSERT INTO emp1
> SELECT empno, ename
> FROM emp_2;

This won't work if the ename field contains an entry that is longer than 50 characters. Are error will be raised. To copy only the first 50 characters into the new table, try:

  INSERT INTO emp_1

     SELECT empno, SUBSTR(ename,1,50)
     FROM emp_2;
 

> If your coping the tables just to reduce the varchar2(100) to varchar2(50) it
> would be easier to use an ALTER TABLE statement.

Again, if the column contains data with more than 50 characters, an error will be raised.

HTH,
Brian

-- 
========================================
Brian Peasland
Raytheons Systems at
  USGS EROS Data Center
These opinions are my own and do not
necessarily reflect the opinions of my 
company!
========================================
Received on Tue Aug 29 2000 - 08:08:23 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US