Go to http://www.oracle.com find "Downloads" link and find the place from which you can download Oracle XE database, you'll need to select the Operating System for that. At the time of writing of this post the URL for downloading is the following : http://www.oracle.com/technology/software/products/database/xe/htdocs/102xewinsoft.html
From this page download Oracle Database 10g Express Edition. Before you start downloading you will be asked to enter your name and password for Oracle site. If you don't have them - go ahead and register, the registration is free and according to my experience they don't sp@m you.
After you download OracleXE.exe, start it.
Install and Configure Oracle XE. Configure schema HR.
- Run OracleXE.exe.
- After a while (and a couple of minutes of some unpacking operations) you are presented with a welcome screen. Click "Next" on it.
- Accept license terms on the next screen.
- On the next screen leave C:\oraclexe as the destination location and click Next
- Enter password twice on the next screen. I usually use the letter "a" - for simplicity you can use this password too. This password is for schemas SYS and SYSTEM. These schemas are used for administrative purposes. You should remember this password in order to access the database as an administrator.
- Press Install on the next screen
- Oracle will start installation. It will take several minutes.
- Finally you see the message that Setup has finished installing Oracle Database... On this screen check the checkbox "Launch the Database homepage" and press Finish (or you can later go to "Programs->Oracle Database...->Go to Oracle Database Home page"
- Now you are asked about username and password. These are username and password of admin account (the one that we entered during installation process). Enter "sys" for username and "a" for password (or the password that you entered yourself)
- One the next page click on the triangle on the "Administration" icon and select "Database Users->Manage Users":
- On the manage page you should see user HR - when you move mouse over it it says "Expired and Locked".
- Click on this user and on the next page enter the new password for this user "HR" and change the account status from "Locked" to "Unlocked". Leave all other default values and press "Alter User" button:
Next post will be about downloading, running and connecting SQL Developer with this HR schema.
This is an example of PL/SQL code:
declare
wealth VARCHAR2(20);
begin
for emp in (select * from employees) loop
if emp.salary < 5000 then
wealth := 'poor';
elsif emp.salary >=5000 and emp.salary < 15000 then
wealth := 'middle class';
else
wealth := 'rich';
end if;
dbms_output.
put_line(emp.first_name||' '||emp.last_name
||'-'||emp.salary||'-'||wealth);
end loop;
end;