insert record with TOraQuery

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
samuel

insert record with TOraQuery

Post by samuel » Thu 07 Apr 2005 12:30

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.

samuel

Post by samuel » Fri 08 Apr 2005 03:48

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.

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Fri 08 Apr 2005 06:24

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.

Post Reply