Page 1 of 1

insert record with TOraQuery

Posted: Thu 07 Apr 2005 12:30
by samuel
Hi,
I use TOraQuery to insert data into the database and I use TDBEdit to allow the user to insert data. In my OraQuery's SQLInsert, I have write the following:

INSERT INTO tprofile
(PF_PROFILE_ID, PF_ENG_NAME, PF_REGION, PF_CRE_DATE, PF_CRE_UID, PF_UPD_DATE, PF_UPD_UID)
VALUES
(QPROFILE.NEXTVAL, :PF_ENG_NAME, :PF_REGION, SYSDATE, :PF_CRE_UID, SYSDATE, :PF_UPD_UID)

Where PF_PROFILE_ID, PF_REGION, PF_CRE_UID and PF_UPD_UID cannot be NULL in the database.
If the use input all the values, it works fine. But if the user, say didn't input the PF_ENG_NAME, then it got the error: ORA-01400: cannot insert NULL into PF_REGION. But the only field that the user didn't input is PF_ENG_NAME which is a field allowed to be NULL. Can you help me to solve the problem, thanks.

Posted: Fri 08 Apr 2005 03:48
by samuel
I found that while using the SQLInsert of the TOraQuery to insert new record, if some field is null, then it cannot work correctly, mainly the order of the values insert will be disordered.

Posted: Fri 08 Apr 2005 06:24
by Alex
We couldn't reproduce the problem.
Please send us complete sample to demonstrate it and include script to create server objects to ODAC support address.