1 anniversary dating year - Updating pl sql

UPDATE summary_data SET current_category = (SELECT category_id FROM products WHERE products.product_id = summary_data.product_id) WHERE EXISTS (SELECT category_id FROM products WHERE products.product_id = summary_data.product_id); If you want to test your skills using the SQL UPDATE statement, try some of our practice exercises.

updating pl sql-4updating pl sql-82updating pl sql-16

A searched update statement depends on the table being updated, all of its conglomerates (units of storage such as heaps or indexes), all of its constraints, and any other table named in the WHERE clause or SET expressions.

A CREATE or DROP INDEX statement or an ALTER TABLE statement for the target table of a prepared searched update statement invalidates the prepared searched update statement.

I have made a procedure in PL/SQL which inserts data from one table to another on basis of primary key.

My procedure is working fine but i can't figure out how will i update column CODE_NUMBER of my table MAIN if primary key already exists.

If columns were specified in the FOR UPDATE clause of the SELECT statement used to generate the cursor, only those columns can be updated.

If no columns were specified or the select statement did not include a FOR UPDATE clause, all columns may be updated.

If I understand you, you need upsert statement, where you update if the record match some value, and you insert if it doesn't.

Also if it is equal condition you can use decode function as well.

update is sql statement and if statement is pl/sql construct.

Comments are closed.