Hi Sir,
how to extract date & time , emp id from this column. this is output from fingerprint machine. to track emp attendance.
080121161350 00000001 |
I want output :
Date & Time :08-01-21 16:13:50
Emp : 00000001
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is a space between two values, you can extract on this behalf. Below is an example:
Thanks for the immediate reply. Everything working fine but time is missing.
Got it
Declare
v_whole_string varchar2(100);
v_date varchar2(50);
v_empid varchar2(50);
d_date varchar2(50);
Begin
v_whole_string := ‘080121161350 00000001’;
v_date := substr(v_whole_string, 1, instr(v_whole_string, ‘ ‘)-1);
v_empid := substr(v_whole_string, instr(v_whole_string, ‘ ‘)+1);
d_date := to_timestamp(v_date, ‘ddmmyyhh24miss’);
dbms_output.put_line(v_date);
dbms_output.put_line(v_empid);
dbms_output.put_line(d_date);
End;
To view the time you need to use the to_char() function: