Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> "Safe" copying from one table column to another
While writing a small PL/SQL program (ORACLE 7.3) I encountered the following problem: How do I copy a VARCHAR2 field from one table column to another, assuming that the two columns can be of different length and I don't want to hardcode the column lengths in my sourcecode (I don't want to change my sourcecode if the column definitions change). e.g. emp1.name is defined as VARCHAR2(30) emp2.name is defined as VARCHAR2(20) and I want to copy emp1.name into emp2.name (which of course raises a VALUE ERROR upon direct assignment if LENGTH(emp1.name) > 20), with emp1.name truncated on the right. I could not find any SQL function which returns the defined maximum length of a VARCHAR2 datatype.
Gerald
-------------------==== Posted via Deja News ====----------------------- http://www.dejanews.com/ Search, Read, Post to UsenetReceived on Fri Jan 02 1998 - 00:00:00 CST
![]() |
![]() |