Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> An Oracle Auto Generated Id Issue

An Oracle Auto Generated Id Issue

From: Norman Dunbar <Norman.Dunbar_at_lfs.co.uk>
Date: Tue, 15 Apr 2003 08:25:13 +0100
Message-ID: <E2F6A70FE45242488C865C3BC1245DA7038D9789@lnewton.leeds.lfs.co.uk>


Morning Ramon,

I'm not a VB or VBA developer but I do use Delphi and C++ Builder with varying degrees of success and expertise, so :

if I'm doing an app and the table in the database is defined as being NOT NULL then my app will barf if I do not fill in a value for that field prior to me posting the data to the database. This is a bleeding pain in the bum if I have triggers which fill in the columns for me. Delphi and C++B database components (TQuery) have a Fields property where I can override the database details with mu own, so I can tell the app that the PK columns are actually not required regardless of what the database tells it. This way, I can now post nulls in these columns and have my triggers fill in the blanks.

I would hope that VB/VBA has a similar property which allows you to specify that a field/column is not required by the app regardless of whether it is required by the database.

HTH Cheers,
Norm.



Norman Dunbar
Database/Unix administrator
Lynx Financial Systems Ltd.
mailto:Norman.Dunbar_at_LFS.co.uk
Tel: 0113 289 6265
Fax: 0113 289 3146
URL: http://www.Lynx-FS.com

-------------------------------------

-----Original Message-----
From: ramon_at_caribsurf.com (ryan) [mailto:ramon_at_caribsurf.com] Posted At: Monday, April 14, 2003 6:19 PM Posted To: server
Conversation: An Oracle Auto Generated Id Issue Subject: An Oracle Auto Generated Id Issue

Hi

I am currently developing an application with an Oracle backend after years of using Access and SQL Server.

With Access and SQL Server there was an auto-increment option that can be specified for primary keys however unless I have missed somthing in Oracle one has to use the Sequence/Trigger method

My problem occurs when I am adding a new record to a table with an auto-incremented primary key within the application. Within VB, I use a third party component to manipulate data within the database and when
I try to save the new record, the component gives an error indicating that the primary key field cannot be left empty.

When I use SQL + and an Insert SQL statement for the same table the new
record is added with no complaints about the primary key field. How can I
get around this problem? Is there a property/setting within Oracle for the control to know that the primary key is being auto generated/incremented
by use of the sequence/trigger?

thanks in advance
ryan Received on Tue Apr 15 2003 - 02:25:13 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US