Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Substring Function

Srikkanth.MJan 16 2010 — edited Jan 16 2010
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
This post has been answered by Dora on Jan 16 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 13 2010
Added on Jan 16 2010
3 comments
1,089 views