Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask PL-SQL Expert

Parameter and Keyword Description: 

table_reference:

This keyword identifies the table or view that should be accessible when you execute the UPDATE statement, and for which you should have the UPDATE privileges.

Subquery:

This is a SELECT statement which gives a set of rows for the processing. 

TABLE (subquery2):

The operand of the TABLE is a SELECT statement which returns a single column value, that should be a nested table or a varray cast as the nested table. The Operator TABLE informs the Oracle that the value is a collection, however not a scalar value.

alias:

This is the other (typically short) name for the referenced table or view and is usually used in the WHERE clause.

column_name:

This is the name of the column which is to be updated. It should be the name of a column in the referenced table or the view. The column name cannot be repetitive in the column_name list. The Column names do not require appearing in the UPDATE statement in similar order that they appear in the table or view.

sql_expression:

This is any of the valid SQL expression.

SET column_name = sql_expression:

This clause assigns the value of the sql_expression to the column recognized by the column_name. If the sql_expression contains the references of the columns in the table being updated, the references are solved in the phrase of the present row. The older column values are used on the right side of the equal sign.

In the illustration below, you raise every employee's salary by 10%. The real value of the sal column is multiplied by 1.10, and then the result is assigned to the sal column overwriting the real value.

UPDATE emp SET sal = sal * 1.10;

SET column_name = (subquery3):

This clause assigns the value retrieve from the database by the subquery3 to the column recognized by the column_name. The sub query should return specifically one row & one column.

SET (column_name, column_name, ...) = (subquery4):

This clause assigns the values retrieve from the database by the subquery4 to the columns in the column_name list. The sub query should return exactly one row which includes all the columns listed.

The columns values return by the sub query are assigned to the columns in the column list in order. The initial value is assigned to the first column in the list; the second value is assigned to the second column in the list, and so on. In the correlated query below, the column item_id is assigned the value stored in the item_num, and the column price is assigned to the value stored in the item_price:

UPDATE inventory inv -- alias

SET (item_id, price) =

(SELECT item_num, item_price FROM item_table

WHERE item_name = inv.item_name);

WHERE search_condition:

This clause prefers that rows to update in the database table. Only the rows that meet the search condition are updated. If you omit the search situation, all the rows in the table are updated

WHERE CURRENT OF cursor_name:

This clause refers to the newest row processed by the FETCH statement related with the cursor identified by the cursor_name. The cursor should be FOR UPDATE and should be open and situated on a row. When the cursor is not open, the CURRENT OF the clause causes an error. If the cursor is open, however no rows have been fetched or the last fetch returned no rows, the PL/SQL raises the predefined exception NO_DATA_FOUND.

returning_clause:

This clause lets you return values from the updated rows, thereby removing the need to SELECT the rows later. You can retrieve the column values into the variables and/or host variables, or into the collections and/or host arrays. Though, you cannot use the RETURNING clause for remote or parallel updates. 

PL-SQL, Programming

  • Category:- PL-SQL
  • Reference No.:- M9510706

Have any Question?


Related Questions in PL-SQL

Assignment - queries functions and triggersaimthe aims of

Assignment - Queries, Functions and Triggers Aim The aims of this assignment are to: formulate SQL queries; populate an RDBMS with a real dataset, and analyse the data; design test data for testing SQL queries; create SQ ...

Complete the following tasksin microsoft access create the

Complete the following tasks: In Microsoft Access, create the database and tables that you identified in W3 Assignment 2. In Microsoft Word, write the SQL statements to create the database and tables. Write SQL statement ...

For this assignment you will be provided a database backup

For this assignment, you will be provided a database backup for a database called FinanceDB. You will have to restore this backup to your own version of SQL Server. All of the questions in this assignment relate to the F ...

Continuing the project you have worked on in weeks 1-4 in

Continuing the project you have worked on in Weeks 1-4, in this final week, complete the following tasks: Refine your database and SQL statements by incorporating your instructor's feedback. Verify that the database comp ...

Purpose of the assessment with ulo mapping the purpose of

Purpose of the assessment (with ULO Mapping) The purpose of this assignment is to develop skills in managing data in databases and to gain understanding of data model development and implementation using a commercially a ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As