maniupate data in a cursor or sql select
i am trying to read a column from a table that has 1's and 0's and want to translate it into T or F and then put it into a second table. My problem is.. how do i, when reading that table into a cursor, change 1's to T and 0's to F? here's the sample code i have so far.. i just need to add in the data manuplation somewhere but dont know where or how to do it. any ideas?
CURSOR c_status IS
select rdrx_des_table, rdrx_latest_time, rdrx_current_state
Fetch c_status into v_1, v_2, v_3;
EXIT WHEN c_status%NOTFOUND;
Insert into table2 (def_name, transfer_time, enabled)
values (v_1, v_2, v_3);
In the cursor, for v_3, it will fetch 1's or 0's, but before it's inserted into the 'enabled' column, i would like to change it to T or F. Thanks
Use TRANSLATE or DECODE (or CASE).
TRANSLATE(v_3, '10', 'TF')
DECODE(v_3, 1, 'T', 'F')
ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
Click Here to Expand Forum to Full Width