1

I have a spread sheet with content as below.

EMPLOYEE_ID ATT_DATE    ATT_TIME
1           10/9/2012   10:47:00
1           10/9/2012   10:47:00
1           10/9/2012   10:48:00
1           10/9/2012   10:49:00
1           10/9/2012   10:55:00

I want to create insert statements from these values. so i wrote below formula to generate insert statements.

="INSERT INTO ATTENDANCE (EMPLOYEE_ID, ATT_DATE) VALUES('" & Attendance!A2 & "', to_date('" & TEXT(Attendance!B2,"dd-mmm-yyyy") & "','DD-MON-YYYY'));"

i want to add values in ATT_TIME column to above insert statements. but i'm unable to write formula correctly for that.

how could i add values in ATT_TIME column to my insert statements ?

PS: i'm using oracle database.

2 Answers 2

3

Did you try to_date('" & Attendance!C2 & "','HH24:MI:SS') ?

Here is the complete query

="INSERT INTO ATTENDANCE (EMPLOYEE_ID, ATT_DATE, ATT_TIME) VALUES('" & Attendance!A2 & "', to_date('" & TEXT(Attendance!B2,"dd-mmm-yyyy") & "','DD-MON-YYYY'),to_date('" & Attendance!C2 & "','HH24:MI:SS'));
Sign up to request clarification or add additional context in comments.

Comments

1

i have found solution for my question.

="INSERT INTO ATTENDANCE (EMPLOYEE_ID, ATT_DATE, ATT_TIME) VALUES('"&Attendance!A2&"', to_date('"&TEXT(Attendance!B2,"dd-mmm-yyyy")&"','DD-MON-YYYY'), to_date('"&TEXT(Attendance!C2,"h:mm:ss")&"','HH24:MI:SS'));"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.