Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Begin when the first DML SQL statement is executed End with one of the following events:
A COMMIT or ROLLBACK statement is issued A DDL or DCL statement executes (automatic commit) The user exits iSQL*Plus The system crashes
Create a marker in a current transaction by using the SAVEPOINT statement. Roll back to that marker by using the ROLLBACK TO SAVEPOINT statement.
UPDATE... SAVEPOINT update_done; Savepoint created. INSERT... ROLLBACK TO update_done; Rollback complete.
Data changes are made permanent in the database. The previous state of the data is permanently lost. All users can view the results. Locks on the affected rows are released; those rows are available for other users to manipulate. All savepoints are erased.
Committing Data
DELETE FROM EMP WHERE EMPNO = 7639; 1 row deleted. INSERT INTO DEPT VALUES (290, 'Corporate Tax', NULL, 1700); 1 row inserted.
Using the UNION ALL Operator Display the current and previous departments of all employees.
SELECT EMPNO, JOB, DEPTNO FROM EMP
UNION ALL
SELECT EMPNO, JOB, DEPTNO FROM JOB_HISTORY EMPNO;
ORDER BY
SELECT EMPNO,JOB
FROM
MINUS
EMP
The expressions in the SELECT lists must match in number and data type. Parentheses can be used to alter the sequence of execution. The ORDER BY clause:
Can appear only at the very end of the statement Will accept the column name, aliases from the first SELECT statement, or the positional notation
Duplicate rows are automatically eliminated except in UNION ALL. Column names from the first query appear in the result. The output is sorted in ascending order by default except in UNION ALL.
SELECT DEPTNO, TO_CHAR(null) LOC, HIREDATE FROM UNION SELECT DEPTNO, LOC, FROM DEPT; TO_DATE(null) EMP