HomeOracle Page 2 - SQL Script Support in Oracle 10G Express Edition
Sample scripts - Oracle
In an earlier tutorial we saw how to use SQL commands in the Oracle 10g Express Edition, or simply Oracle XE. We also saw how to use the PL/SQL commands as well. In another tutorial we saw how to use the Query Builder, the graphical interface for fashioning and running SQL in the Oracle XE. The present tutorial describes the SQL scripting support in Oracle XE. In order to bring out the basic features of scripting support a few example scripts are considered in the discussion.
As you can see above, the script First_Last creates a table which is populated by the statement shown by the script Adval and the script Selct queries the table First_Last. This is a set of some very simple basic scripts.
Editing an existing script
In order to edit the script Selct, place a check mark in the extreme left as shown for this script, and click on the icon for "Edit" as shown in the next picture.
This opens up the Script Editor window as shown in the next picture. The script name you selected comes up and the script itself is displayed in the text editor as shown here. You may do a number of things in this text editor, such as undo, redo, and find text. For the script itself you can save, run, delete or download script from another location.
Let's hit the Run button now to get to the next window as shown. You will be asked to confirm in this window. This was a simple select query and running it will cause no changes. But there will be times when it is better to caution the user to confirm. You may also notice that the query is using the schema of HR.
Let's hit Run again. You get the window shown in the next picture. In this screen you manage the script results. It can show the status of the script, whether still executing, completed, and so on.
If you want to see the result of running this script, click on the "View Results" icon instead of the view script Icon as suggested in the above picture (it probably is an error). You will see the summary of results (default view) as shown in the next pciture.
To see the results of this query, you need to choose the View: Details radio button and hit the Go button as shown in the next picture.
Next, we will edit the script for Adval and change the first and last names to "James" and "Bond" so that the edited query will insert new values into the First_Last table. The Selct query is run again, and you will notice that you have added another row to the returned results as shown. Several steps are not shown because they are a repetition of the steps described earlier.
INSERT INTO first_last VALUES ('James', 'Bond');
When you run this Adval script you will see the following result.
Now if you run the Selct script again, you will see the following result.