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

Calculate the total shopper spending, Many of the reports generated from th...

Many of the reports generated from the system calculate the total dollars in purchases for a shopper. Complete the following steps to create a function named TOT_PURCH_SF that acce

Running the pl/sql wrapper, Running the PL/SQL Wrapper To run the PL/SQ...

Running the PL/SQL Wrapper To run the PL/SQL Wrapper, go through the wrap command at your operating system prompt by using the syntax as shown: wrap iname=input_file [oname=

Using set transaction, Using SET TRANSACTION You use the SET TRANSACTI...

Using SET TRANSACTION You use the SET TRANSACTION statement to begin the read-only or read-write transaction, start an isolation level, or assign your present transaction to a

Keyword and parameter description - if statement, Keyword and Parameter Des...

Keyword and Parameter Description: boolean_expression: This is an expression which results the Boolean value TRUE, FALSE, & NULL. It is related with a series of statement

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

Scope rules - user-defined exceptions, Scope Rules You cannot declare ...

Scope Rules You cannot declare an exception twice in the similar block. Though, you can, declare the similar exception in 2 different blocks. The Exceptions declared in a bloc

Example of table literal - sql, Example of Table Literal - SQL Exampl...

Example of Table Literal - SQL Example: A Table Literal (correct version) VALUES ('S1', 'C1', 'Anne'), ('S1', 'C2', 'Anne'), ('S2', 'C1', 'Boris'), ('S3', 'C3'

Declare keyword description in pl sql, DECLARE : This keyword signals t...

DECLARE : This keyword signals the beginning of the declarative section of the PL/SQL block, that contains local declarations. The Items declared locally exist only within the

Data types, Datatypes Every constant and variable has a datatype that s...

Datatypes Every constant and variable has a datatype that specifies the storage format, constraints, and the valid range of values. The PL/SQL gives a variety of predefined dat

Cursor attributes in pl sql, Cursor Attributes   The Cursors and curso...

Cursor Attributes   The Cursors and cursor variables have 4 attributes which give you helpful information about the execution of a data manipulation statement. Syntax:

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