DECLARE my_projects ProjectList; BEGIN SELECT projects INTO my_projects FROM department WHERE name = 'Accounting'; END; / Related Topics Collection Methods , Object Types , Records
Comments 13-26 PL/SQL User's Guide and Reference Comments Comments let you include arbitrary text within your code to explain what the code does. You can also disable obsolete or unfinished pieces of code by turning them into comments. PL/SQL supports two comment styles: single-line and multi-line. A double hyphen ( -- ) anywhere on a line (except within a character literal) turns the rest of the line into a comment. Multi-line comments begin with a slash-asterisk ( /* ) and end with an asterisk-slash ( */ ). For more information, see "Comments" on page 2-7. Syntax Usage Notes Single-line comments can appear within a statement at the end of a line. You can include single-line comments inside multi-line comments, but you cannot nest multi-line comments. You cannot use single-line comments in a PL/SQL block that will be processed dynamically by an Oracle Precompiler program. End-of-line characters are ignored, making the single-line comments extend to the end of the block. Instead, use multi-line comments. While testing or debugging a program, you might want to disable a line of code. The following example shows how you can "comment-out" the line: -- UPDATE department SET location_id = my_loc WHERE department_id = my_deptno; You can use multi-line comment delimiters to comment-out whole sections of code. Examples The following examples show various comment styles: DECLARE area NUMBER; pi NUMBER; radius NUMBER; BEGIN -- Compute the area of a circle area := pi * radius**2; -- pi is approx. 3.14159 /* Compute the area of a circle. */ area := pi /* pi is approx. 3.14159 */ * radius**2; END; / - - text /* text */ comment
COMMIT Statement PL/SQL Language Elements 13-27 COMMIT Statement The COMMIT statement makes permanent any changes made to the database during the current transaction. A commit also makes the changes visible to other users. For more information, see "Overview of Transaction Processing in PL/SQL" on page 6-29. Syntax Keyword and Parameter Description COMMENT Specifies a comment to be associated with the current transaction. Typically used with distributed transactions. The text must be a quoted literal no more than 50 characters long. WORK Optional, for readability only. Usage Notes The COMMIT statement releases all row and table locks, and erases any savepoints you marked since the last commit or rollback. Until your changes are committed: ■ You can see the changes when you query the tables you modified, but other users cannot see the changes. ■ If you change your mind or need to correct a mistake, you can use the ROLLBACK statement to roll back (undo) the changes. If you commit while a FORUPDATE cursor is open, a subsequent fetch on that cursor raises an exception. The cursor remains open, so you should still close it. For more information, see "Using FOR UPDATE" on page 6-33.
You've reached the end of your free preview.
Want to read all 492 pages?
- Fall '14
- Computer Architecture, Subroutine, ........., Oracle Corporation