Plain SQL and PL/SQL program
SQL>
SQL>
SQL> CREATE TABLE myTable(
2 e INTEGER,
3 f INTEGER
4 );
Table created.
SQL>
SQL>
SQL>
SQL> DELETE FROM myTable;
0 rows deleted.
SQL> INSERT INTO myTable VALUES(1, 3);
1 row created.
SQL> INSERT INTO myTable VALUES(2, 4);
1 row created.
SQL>
SQL> /* Above is plain SQL; below is the PL/SQL program. */
SQL> DECLARE
2 a NUMBER;
3 b NUMBER;
4 BEGIN
5 SELECT e,f INTO a,b FROM myTable WHERE e > 1;
6 INSERT INTO myTable VALUES(b,a);
7 END;
8 /
PL/SQL procedure successfully completed.
SQL> drop table myTable;
Table dropped.
SQL>
Related examples in the same category