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
❇️ OrclQA.Com is a question and answer forum for programmers.
❇️ Here anyone can ask questions and anyone can answer to help others.
❇️ It hardly takes a minute to sign up and it is 100% FREE.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
OrclQA.Com is a question and answer forum for programmers.
Here anyone can ask questions and anyone can answer to help others.
It hardly takes a minute to sign up and it is 100% FREE.
Vinish Kapoor
There is a space between two values, you can extract on this behalf. Below is an example:
Bheem
Thanks for the immediate reply. Everything working fine but time is missing.
Bheem
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;
Vinish Kapoor
To view the time you need to use the to_char() function: