Page 1 of 1

Oracle sequence

Posted: Wed 29 Aug 2012 10:39
by hgyula
Hi,
I have an application on MSSql, now I'm migrating it to Oracle.
In MsSQL I use identity columns for PrimeryKeys. In Oracle I'm using sequence for PKs, and I have a trigger for each table, which fill the appropriate value for the PK.
In my application I not care directly about fill the PK, becaues the database makes it for me, but when I'm conncted to Oracle, I got the error message "Field ID must have a value"!
(with MSSQL it works fine!)
Can I switch off somehow the TUniTable, or TUniQuery component feater for checking the PK ?
I tried to set then RequiredField = False, but it counts nothing.

Thanks,
gyula

Re: Oracle sequence

Posted: Thu 30 Aug 2012 12:09
by AlexP
hello,


To have a possibility to insert data to the fields with the NOT NULL flag in the database, you should set the UniQuery1.Options.RequiredFields to False, or if you created Persistent fields, then the UniQuery1ID.Required option of the correspondent field should be set to False.

To return the generated value to DataSet exactly after insert, you should change the INSERT query in the UniQuery1.SQLInsert.Text property in the following way:

Code: Select all

INSERT INTO TABLE
  (FIELD_1, .... , FIELD_N)
VALUES
  (:FIELD_1, .... , :FIELD_N)
RETURNING
ID
INTO
:ID
and set the UniQuery1.Options.ReturnParams property to True