Parameter and keyword description - update statement, PL-SQL Programming

Assignment Help:

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. 


Related Discussions:- Parameter and keyword description - update statement

Interesting properties of cross join - sql, Interesting properties of CROSS...

Interesting properties of CROSS JOIN - SQL Compare these with the "interesting properties of JOIN", CROSS JOIN is associative but not commutative. Unlike JOIN and NATURAL JOI

Do you know anyone that can do this type of coding or not?, Task 2 [12 mark...

Task 2 [12 marks] Write the package body for the following package specification (the detailed description of each function and procedure is provided in the appendix below). Place

Miller-urey''s experimental procedure, MILLER-UREY' S EXPERIMENTAL PROCEDU...

MILLER-UREY' S EXPERIMENTAL PROCEDURES - They recreated the probable conditions on the primitive earth in the laboratory. An atmosphere containing hydrogen, ammonia, me

In operator-comparison operators, IN Operator The operator IN tests the ...

IN Operator The operator IN tests the set membership. This means "equal to any member of." The set may have nulls, but they are ignored. For illustration, the statement below do

Packages, Packages The package is a schema object which groups logicall...

Packages The package is a schema object which groups logically associated to the PL/SQL items, types, and subprograms. The Packages have 2 sections: the specification & the bod

Difference between ttitle and btitle, TTITLE and BTITLE are commands in Pl-...

TTITLE and BTITLE are commands in Pl-SQL to control report headings and footers. This Ttitle & Btitle are mainly used on creating SQL*PLUS report. Ttitle is used for toptitle headi

Use of table comparisons - sql, Use of Table Comparisons - SQL Table ...

Use of Table Comparisons - SQL Table comparisons where it is noted that although table expressions cannot be compared, we have TABLE (t) to convert a table expression t into

Using lock table, Using LOCK TABLE You use the LOCK TABLE statement to...

Using LOCK TABLE You use the LOCK TABLE statement to lock the whole database tables in the specified lock mode so that you can share or deny the access to them. For illustrati

An active database in pl-sql, Consider the following set of database tables...

Consider the following set of database tables (same tables from Assignment 6-1). Please take note of foreign keys (most of them carry the same names as the corresponding primary ke

Using the collection methods, Using the Collection Methods The collecti...

Using the Collection Methods The collection methods below help to generalize the code and make collections easier to use and also make your applications easier to maintain:

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd