How to enable auto increment primary key for Oracle database in PowerDesigner 16.6? - oracle

I am new to SAP PowerDesigner I am trying to created tables and link them together to get the DB model and I am having difficulties on enabling Auto increment for the primary Key column of tables. Can someone please guide me
I have looked online and there was mentioning of check marking something called as Identity. But I do not see that option on Column properties.Image2
Image1

Which version of Oracle are you using?
Oracle 12+ supports identity columns. In PowerDesigner, the Identityoption is available in the Oracle tab on the Column, when the DBMS for the Physical Data Model is ORACLE Version 12c.
create table CONTACTS (
ID int
generated always as identity ( start with 1 nocycle noorder) not null,
NAME varchar(100) not null,
constraint PK_CONTACTS primary key (ID)
);
For previous versions of Oracle, the autoincrement was implemented with sequence, and triggers. See this page of PowerDesigner online documentation for example.

Related

How to create form/report on a table which has only primary keys?

Im trying to create a form with a report on a table that has only primary keys.
I have a table:
create table WRITE
(
author varchar(5) references AUTHOR (authorcode) ,
book varchar(20) references BOOK (bookid),
primary key(author,book)
);
I'm using APEX Application Builder to create a form on a table with report;
But When I get to the "Select the columns to include in the form" , I have no options to select from because I only have unique primary keys in my table.
Which Apex version is it? I've tried it on apex.oracle.com which uses 19.1 and it doesn't have that problem.
Anyway, two options I can think of:
temporarily drop primary key constraint
then create report + form pages
after you're done, create the primary key constraint once again
create an interactive report (using the wizard)
then create a form, manually adding items
this isn't as easy as it looks like because you'll have to create all processes as well (initialization one, along with automatic row processing)
I presume that the first option is a lot simpler.

Update or Insert into postgres table without any primary key

I have a table which needs to be ingested from Oracle source to Greenland target using ETL tool talend. The table is huge , hence we want to load the data on daily basis incrementally. The table doesn't have any primary or unique key.
Table has date column, I am able to get both inserted/updated records from last update date but to insert that data, we need a primary key.
Any solution on how to load the data without using a primary key?
You need to define your key in talend in the schema of the component that insert into your target table, like this :
And you can use this key to update your table, in the advanced settings of the same component, activate the check box use fields optins and select your key :
This is tested and worked fine against Oracle table that does not have primary key, and it should work for you.

Oracle SQL Developer - using foreign keys

First of, this is a pretty basic question but I cant seem to find a basic tutorial on how to use the software.
If i have a table named COUNTRY with the field region_id
and then another table named REGION with a primary key as region_id.
I want to set the region_id field in COUNTRY table as a foreign key.
Are the following steps correct?
Go to constraints, add a new foreign key.
Select COUNTRY as table
Change local column to region_id
![enter image description here][1]
Am I doing it correctly? if not, where am i going wrong
Yes, This is the correct procedure.
If you want your foreign key to have additional behavior (e.g., ON DELETE CASCADE), you can use the "on delete" drop-down in the wizard.
I cant seem to find a basic tutorial on how to use the software.
Have you looked at the Oracle Learning Library for SQL Developer tutorials?
If you search for: Getting Started with Oracle SQL Developer 4.0 you will find a tutorial that gets you up and running SQL Developer, this tutorial includes how to create Foreign Key Constraints.

Oracle database data modeler check constraint

I need to create a check constraint on a date field on Oracle SQL developer 3.1.07 in domain administration.
I created The check constraint and assigned my domain to field in logical schema. After conversione to relational schema The constraint is not visibile in the DDL preview.
Thanks,
Mattia

ODBC with Oracle Trigger Key Column

I'm trying to update some existing code that is supposed to write data to a variety of Databases (SQL, Access, Oracle) via ODBC, but I'm having a few problems with Oracle and am looking for any suggestions.
I've set my Oracle database up using a Trigger (basic tutorial online, which I'd like to support).
CREATE TABLE TABLE1 (
RECORDID NUMBER NOT NULL PRIMARY KEY,
ID VARCHAR(40) NULL,
COUNT NUMBER NULL
);
GO
CREATE SEQUENCE TABLE1_SEQ
GO
CREATE or REPLACE TRIGGER TABLE1_TRG
BEFORE INSERT ON TABLE1
FOR EACH ROW
WHEN (new.RECORDID IS NULL)
BEGIN
SELECT TABLE1_SEQ.nextval
INTO :new.RECORDID
FROM dual;
end;
GO
I then populate a DataTable using a SELECT * FROM TABLE1. The first problem is that this DataTable doesn't know that the RecordId column is auto-generated. If I have data in my table then I can't alter it because I get a error
Cannot change AutoIncrement of a DataColumn with type 'Double' once it
has data.
If I continue, ignoring this, then I quickly get stuck. If I create a new DataRow and try to insert it, I can't set RecordID to DBNull.Value because it complains that the column has to be non-null (NoNullAllowedException). I can't however generate a value myself, because I don't know what value I should be using really, and don't want to screw up the trigger by using the next available value.
Any suggestions on how I should insert data without ODBC complaining?
It does not appear that your first problem is with an Oracle database. There is no such thing as an "Autoincrement" column in Oracle. Are you sure that message is coming from an Oracle database?
With Oracle, you should be able to provide any dummy value on insert for the primary key, and the trigger will overwrite it.
There is also nothing in your provided description that would prevent you from updating this value in Oracle (since your trigger is on insert only) unless you have foreign key references to the key.

Resources