Substring Function
Oracle Forms6i
Hai
I need to breakdown a long string and give to three text fields.
My coding is this
declare
pin_no varchar2(200);
pin_date date;
pin_time varchar2(25);
mstr varchar2(2000);
m_line_no number:=0;
m_file TEXT_IO.FILE_TYPE;
m_file_path varchar2(100) :=:global.filename;
line_count number;
begin
If m_file_path is not null then
m_file:= TEXT_IO.fopen(m_file_path, 'r'); /*w to overwrite and a to append data*/
go_block('TEST_SRI');
clear_block(no_validate);
loop
exit when line_count =1;
begin
TEXT_IO.get_line(m_file,mstr);
mstr := ltrim(rtrim(mstr));
:barcode := mstr;
pin_no := substr(mstr,1,16);
pin_date := to_date( substr(mstr,17,8),'fmDD/MM/YYYY');
pin_time := substr(mstr,25);
next_record;
Exception
when no_data_found then
text_io.fclose(m_file);
exit;
end;
end loop;
first_record;
--test_sri('commit');
--message('No of pins Read:'||(m_line_no));
--message ('No of pins Read:'||(m_line_no));
end if;
exception
when others then
message (sqlerrm);
end;
My string is
0000000012345687100120100815
First 16 is pinno
second 8 is date
third 4 is time
when i was generating all the string will coming in the same field.Pls tell me what are the solutons.
Regards
Srikkanth.M