RSS: articles

PL/SQL Tutorial 2

11/6/13 at 10:39AM, News, cryancaire, Comments

Tutorial Part 2

Section 1

Now that we are connected to the database, we are going to do a little bit of modification.

1 Expand "OE Connection" by clicking the + next to it.
2 At the bottom of the list, expad "Other Users" by clicking the + next to it.
3 Right click on the "HR" user and click "Edit user"
4 Uncheck the boxes saying "Password Expired" and "Account is Locked"
5 Enter a new password and confirm it.
6 Click Apply, and then click Close

Section 2

With the "HR" user now accessible, it is now time to create another connection.

1 Click the + button near the top, left-hand side of the screen.
2 In the Connection Name box, type "HR Connection".
3 In the Username box, type "HR".
4 In the Password box, type the password you assigned to the HR user in Section 1 - Step 5.
5 Check the box next to "Save Password"
6 Leave all other options as default and click "Test"
7 If you see "Status: Success" in the bottom, left-hand corner of the window, click Save and then Connect.
8 If you see "Failure" in the bottom, left-hand corner, ensure you typed the username and password correctly, and try again.

Section 3

Now its time to learn the basics.

1 PL/SQL scripts are called "BLOCKS" and have a strict structure to them, which is as follows:
        [Declare your variables here.]
        [All executable commands are placed here.]
    EXCEPTION (Optional)
        [Exception handling is placed in this section.]
2 All PL/SQL statements must end with a semicolon (;).
3 Single-line comments look like this:
    -- this is a comment
4 Multi-line comments look like this:
    *This is a multi-line comment
    *Any code placed on this line, will not be executed.

The next tutorial will help you run your first PL/SQL block, Hello World.

Last Edited: 11/5/13 at 12:09PM



Recent Articles