Delete cascading constraints from result in Oracle's SQL Developer - oracle

How can I delete a record from the grid of Oracle SQL Developer (3.1) with the option to cascade constraints?

You can't "delete with cascade" through SQL (and therefor not through any SQL client - including SQL Developer)
The option "cascade" is an attribute of the foreign key constraint.
It's nothing you can enable on demand

Related

Oracle SQL - Column shows nullable yes despite check constraint

I'm working on migrating all the tables in my schema to be partitioned tables. Since I'm on 11g instead of 12.2 I have to use DBMS_REDEFINITION. I've automated this with some Ruby code that executes the redefinition procedures for each table in my schema.
My issue is that after migrating, all of my non-nullable columns show NULLABLE - YES. This isn't actually true however, as I can check the constraints and there are check constraints defined for each of the columns that used to be NOT NULL, still enforcing the NOT NULL status. It seems like DBMS_REDEFINITION successfully copied the constraints, but it didn't reflect the NULLABLE status.
Is there a way to tell Oracle to get this back in sync?
I found the answer elsewhere:
https://dba.stackexchange.com/questions/55081/why-is-sqlplus-desc-table-not-showing-not-null-constraints-after-using-dbms-re
Oracle copies the constraints but never turns validate back on. You have to manually do that with:
ALTER TABLE <table_name> ENABLE VALIDATE CONSTRAINT <constraint_name>;

What is CASCADE CONSTRAINTS equivalent for IBM DB2?

I have two environments for my application and in one environment I am using DB2 and Oracle in the other one.
I am using some existing SQL as it's an old application, to drop a table with cascade effect existing SQL is like - DROP TABLE xyz CASCADE CONSTRAINTS;
Above SQL is for Oracle and now I want to write similar SQL for DB2, what I can use in place of CASCADE CONSTRAINTS?
Depends on the Db2-platform and Db2-version...
If your Db2-server runs on Linux/Unix/Windows then there is no syntax equivalent to 'cascade constraints', and if the table being dropped is referenced in an RI constraint either as parent or dependent then the RI constraint gets dropped.
If your Db2-server runs on i-series, then Db2 also has DROP TABLE ... CASCADE (which seems to be functionally equivalent to Oracle cascade-constraints clause), in addition to DROP TABLE ...RESTRICT.
If your Db2-server runs on Z/OS, the there is no syntax equivalent, but as with Db2-LUW, any RI constraints in which the table is parent or dependent get dropped.

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

How to see the table relationships in ORACLE

I had an Access database.
Now I have created a connection with this Access DB and copied it to ORACLE.
I hope the keys and constraints must be recreated in Oracle.
I couldn't find out how to create the relationships between the tables.
And also visualizing them.
First of all your db keys and constraints should be maintained if you have completed migration from Access DB to Oracle successfully.
Having said that, there are products for Oracle database that will help you to visualize table relationships. There is a product called "PL/SQL Developer by Allround Automations", which we use as company, that includes this in their GUI interface - they have both "foreign keys" and "foreign key references" branches in their navigation tree for a table node (The product is not free though..). You can check here for detailed information about the 'Diagram Window' feature of PL/SQL Developer.
Secondly Oracle's SQL Developer (which is free) has a feature called 'Data Modeling' for visual representation of displaying the Relational. Check here for Oracle SQL Developer's Data Modeling.
Furthermore if you want to find out the tables that have references to a specific table you can also use the following query:
select table_name from user_constraints
where r_constraint_name in
(select constraint_name
from user_constraints
where constraint_type in ('P','U')
and table_name = upper('&tableOfInterest')
)
I recommend getting Oracle SQL Developer. It is a free tool from Oracle that allows you to view and modify your database within a GUI. It also has a data modeler built in. It is also free (you just need to have Oracle first)

How to create refresh statements for TableAdapter objects in Visual Studio?

I am working on developing an ADO.NET data provider and an associated DDEX provider. I am unable to convince the Visual Studio TableAdapater Configuration Wizard to generate SQL statements to refresh the data table after inserts and updates. It generates the insert and delete statements but will not produce the select statements to do the refresh.
The functionality referred to can be accessed by dropping a table from the Server Explorer (inside Visual Studio) onto a DataSet (e.g., DataSet1.xsd). It creates a TableAdapter object and configures SELECT, UPDATE, DELETE, and INSERT statements. If you right click on the TableAdapter object, the context menu has a “Configure” option that starts the “TableAdapter Configuration Wizard”. The first dialog of that wizard has an Advanced Options button, which leads to an option titled “Refresh the data table”. When used with SQL Server tables, that option causes a statement of the form “select field1, field2, …” to be added on to the end of the commands for the TableAdapter’s InsertCommand and UpdateCommand.
Do you have any idea what type property or interface might need to be exposed from the DDEX provider (or maybe the ADO.NET data provider) in order to make Visual Studio add those refresh statements to the update/insert commands?
The MSDN documentation for the Advanced SQL Generation Options Dialog Box has a note stating, “Refreshing the data table is only supported on databases that support batching of SQL statements.” This seems to imply that a .NET data provider might need to expose some property indicating such behavior is supported. But I cannot find it. Any ideas?
The refresh functionality in TableAdapter means that the associated datatable for the tableadapter operation will have updated data after the operation is completed.
If you call insert method of the tableadapter and pass the datarow or the datatable for the insert operation, the tableadapter will refresh the datatable/datarow to reflect the latest values from the database after the insert operation. If your table in database has generate a unique-id or auto-number for the insert command for the given row to insert, the original datarow's p.key coloumn will reflect the auto-generate id value from the database. This refreshing will be taken care by the tableadapter provided you have set the refresh option to true in the wizard configuration.
Now to this 'refresh' tableadapter will execute 2 queries in single batch, first will be the Insert, then the select with the scope_identity.
EDIT
My default Insert command would fire this single SQL if Refresh is turned OFF on the TableAdapter
INSERT INTO Table (coloumns) VALUES (values);
But My default Insert command would fire these SQL statement batch if Refresh is turned ON on the TableAdapter. Datarow that is passed as argument to Insert() will also be updated after successful execution.
INSERT INTO Table (coloumns) VALUES (values);
SELECT coloumns FROM Table WHERE (PKeyID = SCOPE_IDENTITY())

Resources