I don't understand. I'm trying to create the first table for a database in Oracle APEX - oracle

It's telling me to provide a FK and a table reference when there is no FK in the table, nor a relevant table to reference.

You do not need to define a FK. Just scroll down and click Next.

Related

How to add new column to oracle editioning view

Oracle EBS R12.2.9
I have to add a new column to an editioning view of a custom table in oracle EBS R12.2.9.
Table was created like this...
From AMTO: create table amto.mci_jjtest1(a number)
From APPS: exec ad_zd_table.upgrade('AMTO', 'MCI_JJTEST1') -- This creates editioning view and also synonym under APPS
Now, new column B number with data type, needs to be added to the table, and the editioning view needs to be modified to add that column to the editioning view. Kindly let me know what commands and steps, I need to follow. I understand the traditional approach, where we would alter table to add column, and create or replace view to add the column to the SELECT, Not sure how to add column to table and editioning view the correct recommended way. Please suggest.
For table alterations - after running the DDL run below script to regenerate the editioning view for syncing any table changes.
exec AD_ZD_TABLE.PATCH('AMTO','MCI_JJTEST1')

Create a sequence not related to any primary key in Oracle SQL Developer Data Modeler

I need to create a sequence whose value is going to be read by call to .NEXTVAL in PL/SQL code and saved in more then one record of a specific table column, so my design doesn't require to define a PK on the aforementioned column.
I cannot find out how to edit the sequence tab in Oracle Data Modeler (I'm on version 4.1.1) when the PK checkbox is not selected (all the sequence related fields are disabled).
Any idea?
In the relational model, choose your DB and within that you will find sequence as an item to create. You can also create other types of object here.

how to make oracle apex wizard steps with multiple related tables?

In Oracle Apex, I have some related tables i.e:
**Person Table**
Id
Name
**Person_Contact Table**
Id
PersonFK
Tel
Address
**Person_Account Table**
Id
PersonFK
BankName
AccountNumber
these are 1-to-1 tables and PersonFK is the Foreign Key.
Now, I want to create a wizard with 3 steps.
how can I do this?
should I define 3 tables with 1-to-1 relation (like above) or create just one big table?
and
what is the best practice in Oracle Apex (in wizard steps forms) for this purpose?
If you are sure that all three tables will remain have common attributes then the option of single table is fine. More detail can be find
here

Moving dependencies (PK, FK and indexes) from one table to another within the same database in Oracle

Please tell me how can I move dependencies (such as PK, FK and indexes) from one table to another within the same database in Oracle? The second table is a copy of the first, only created later for partition reasons. Thank you in advance! :)
You could look at using the dictionary views in oracle, specifically the USER_CONSTRAINTS view. Then either construct a SQL statement dynamically or use DBMS_METADATA.get_ddl procedure to get the ddl for the constraint. You could do a REPLACE on the SQL to replace the original table name and constraint name with a new constraint name and the name of the new table.

Can I create an Oracle view that automatically checks for new monthly tables?

I'm wondering if its possible to create a view that automatically checks if there is a new monthly created table and if there is include that one?
We have a new table created each month and each one ends with the number of the month, like
table for January: table_1
table for February: table_2
etc...
Is it possible to create a view that takes data from all those tables and also finds when there is a new one created?
No, a view's definition is static. You would have to replace the view each month with a new copy that included the new table; you could write a dynamic PL/SQL program to do this. Or you could create all the empty tables now and include them all in the view definition; if necessary you could postpone granting any INSERT access to the future tables until they become "live".
But really, this model is flawed - see Michael Pakhantsov's answer for a better alternative - or just have one simple table with a MONTH column.
Will be possible if you instead of creating new table each month will create new partition for existing table.
UPDATE:
If you have oracle SE without partitioning option you can create two tables: LiveTable and ArchiveTable. Then each month you need move rows from Live to ArchiveTable and clean live table. In this case you need create view just from two tables.
Another option is to create the tables in another schema with grants to the relevant user and create public synonyms to them.
As the monthly tables get created in the local schema, they'll "out-precedence" the public synonyms and the view will pick them up. It will still get invalidated and need recompiling, but the actual view text should need changing, which may be simpler from a code-control point of view.
You can write a procedure or function that looks at USER_TABLES or ALL_TABLES to determine if a table exists, generate dynamic sql, and return a ref cursor with the data. The same can be done with a pipelined function.

Resources