Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: need help
"C.K." <cklok2000_at_sinaman.com> a écrit dans le message news:
99rm67$q7i$1_at_charm.magnus.acs.ohio-state.edu...
>
> i'm trying to make a trigger which will send some records to table B
> after/before insert to table A
> however, one of the field of table A must be a "LONG" datatype, while that
> field in table B must be a "VARCHAR2" datatype for some reason.
> can you help me out of how to convert it or whatever way i can archieve
> that goal?
> i will appreicate it
>
>
>
>
You can split your LONG in small pieces to record it in the VARCHAR2. Something like:
create trigger ...
longValue varchar2(32767);
colLength integer := <varchar2 col size>;
i integer := 1;
lg integer;
pieceNb integer := 0;
begin
longValue := :new.<long col>;
lg := length(longValue);
while ( i <= lg ) loop
insert into <tableB> (<varchar2 col>) values (pieceNb, substr(longValue,i,colLength); pieceNb := pieceNb + 1; i := i + lg;
-- Hope this helps MichelReceived on Wed Mar 28 2001 - 01:41:36 CST
![]() |
![]() |