Program using cursor for updating salary of employee

Rated 3.84/5 based on 615 customer reviews
emp_last_name); END; / CREATE TABLE employees_temp AS SELECT first_name, last_name FROM employees; DECLARE x VARCHAR2(20) := 'my_first_name'; y VARCHAR2(25) := 'my_last_name'; BEGIN INSERT INTO employees_temp VALUES(x, y); UPDATE employees_temp SET last_name = x WHERE first_name = y; DELETE FROM employees_temp WHERE first_name = x; COMMIT; END; / statement that is explained in "Using the EXECUTE IMMEDIATE Statement in PL/SQL".

Points to remember while fetching a row: · We can fetch the rows in a cursor to a PL/SQL Record or a list of variables created in the PL/SQL Block.Native Dynamic SQL is an alternative to PL/SQL differs somewhat from other common programming languages, such as C. For example, addresses (also called pointers) are not user-visible in PL/SQL. When the second batch is fetched in the loop, the rows go to positions 0 to 9; and so on. DATE_TABLE; indx NUMBER := 10; BEGIN c := DBMS_SQL. PARSE(c, 'select * from multi_tab order by 1', DBMS_SQL. PL/SQL also conforms to the current ANSI/ISO SQL standard.In addition to static SQL discussed in this chapter, PL/SQL also supports dynamic SQL, which enables you to execute SQL data definition, data control, and session control statements dynamically.

Leave a Reply