Some ways to update table oracle sql

Wednesday, April 19th, 2017 (0 Comment)

Sometime, we need to update some table in database and we have some ways to update table oracle sql, update directly or from other tables.

Example: we have two tables, parent table_a and child table_b with id_a column reference to key id of table_a

TABLE_A

TABLE_B

We will update TABLE_A : username and note = username and note of TABLE_B with ID_A reference to TABLE_A

1) Create two tables and insert data for example update table oracle sql

2) update table oracle sql

2.1 the first way

or

2.2 the second way

This way, we can modify sql that we want ex: update, insert, …

2.3 the third way

The script below is tables have to primary key and condition base on two these key

The script below will update child (table_b) that have reference to table parent (table_a) base on id_a column

If do not have primary key or update parent base on reference key then appear error “ORA-01779: cannot modify a column which maps to a non key-preserved table.

3) update table oracle pl\sql script

 

Tags: , , ,

Related Posts

database
How to create function return table or cursor in oracle
database
Create group user class by using object oriented plsql
database
Functions encrypt decrypt and checksum oracle
database
Create stored procedure pl/sql in oracle

Related Posts

database
How to create function return table or cursor in oracle
database
Create group user class by using object oriented plsql
database
Functions encrypt decrypt and checksum oracle
database
Create stored procedure pl/sql in oracle

Leave a Reply

Your email address will not be published. Required fields are marked *