Problem with a form in insert statement [message #430953] |
Fri, 13 November 2009 06:59 |
@M.salah@
Messages: 4 Registered: November 2009 Location: Saudi arbia
|
Junior Member |
|
|
Hi,
i make a form on 10g to import from excel sheet to forms using OLE2 , it works fine , but the problem is with a date field, the OlE2 don't support date so i make the field as char and at the insert i will convert it to date using to_date function.
this my code for the OLE2:
name_var5 := ole2.get_CHAR_property(cell,'TEXT'); --cell value of the argument
it works fine and import the value of date as a text at the form
but when i make insert statement from this code it doesn't work
BEGIN
GO_BLOCK('EMPLOYEES');
FIRST_RECORD;
LOOP
INSERT INTO EMPLOYEES(EMPLOYEE_ID,FIRST_NAME,LAST_NAME,HIRE_DATE,JOB_ID, SALARY)
VALUES (:EMPLOYEE_ID,:FIRST_NAME,:LAST_NAME,TO_DATE(:HIRE_DATE,'DD/MM/YY'),:JOB_ID, :SALARY);
COMMIT;
EXIT WHEN :SYSTEM.LAST_RECORD='TRUE';
CLEAR_RECORD;
NEXT_RECORD;
END LOOP;
FIRST_RECORD;
END;
and the form itself is attached.
Regards
|
|
|
|
|
|
Re: Problem with a form in insert statement [message #430962 is a reply to message #430959] |
Fri, 13 November 2009 07:34 |
@M.salah@
Messages: 4 Registered: November 2009 Location: Saudi arbia
|
Junior Member |
|
|
let me tell you the story is that import from excel sheet all the data is imported good except the hire date because ole2 don't support date , so i make the hire date as a char in the form and when insert the record i use to_date method.
the value is already exist but can't be inserted
if you check the attached form you will find what i tell you
Regards
|
|
|
Re: Problem with a form in insert statement [message #430965 is a reply to message #430953] |
Fri, 13 November 2009 07:48 |
cookiemonster
Messages: 13938 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
If :hire_date has a value then it's not the cause of this problem - you'd get a different error if it was.
So assuming it has a value it's a different column that is causing the problem.
Post a desc of the employees table.
|
|
|