how to check string as a data or number
592815Feb 15 2009 — edited Feb 17 2009Hi Experts,
I read a string from text files. However, client can not keep source data fromat. That means there are a comma (,) if it is not data.
However, we get source data as
POS,SAL,500159,54.5501,-163.248100,65,017,20090209,05
POS,SAL,500166,20090208,080207
from 2 th position, miss 4 data column(3,4,5,6) . the last data is data and time.
in sencond line it should be as
POS,SAL,500166, , , , , 20090208,080207.
my procedure abrot it when I sign a LATITUDE
l_cnt number;
l_cntend number;
vn_LATITUDE NUMBER(9,6) default 0;
vn_LONGITUDE NUMBER(9,6) default 0;
vd_DADATE DATE;
vNewLine varchar2(200);
l_cnt := l_cntend +1;
DBMS_OUTPUT.PUT_LINE('lt-- l_cnt --'|| l_cnt );
l_cntend := instr(vNewLine, ',',(l_cnt +1) );
vn_LATITUDE :=substr(trim(vNewLine), l_cnt, (l_cntend - l_cnt));
the data time assign syntax as
vd_DADATE :=to_date(to_char(substr(trim(vNewLine), (l_cnt +1), (l_cntend - (l_cnt +1)))), 'yyyymmdd');
Do we have a way to check string is a data or number by SQL so that we can use two procedure to handle 2 data format?
Thanks
Jim