Database Reference
In-Depth Information
Example 1: Add a new department to the database with the following details:
Code = D500; Name = Engineering; Head = S20:
Example 2: Save all students enrolled in the BSc in MIS program:
From the above example, the following should be noted:
1.
The result of the SELECT is placed into table MajorsMIS .
When used in this way, the Insert statement can insert a
set of several rows at once; it illustrates what was referred to as
set-at-a-time insertion in Chapter 9.
2.
Table MajorsMIS is an example of a temporary relation or
snapshot as discussed in Chapter 3.
Example 3: The following example illustrates a PL/SQL procedure to insert data into
the Course table, where the values come from program variables:
Note: This procedure can be called from the SQL prompt, or from within an
application program by issuing the call statement as in the following example:
Call InsertCourse ('CS101', 'Computer Applications');
An alternate way of specifying the above procedure is to remove the parameters and
write the Insert-Statement with execution-time variables . An execution-time variable is
a variable with an ampersand (&) preceding it. This indicates to the SQL parser that the
user will be prompted to supply a value for the variable. You will see examples of the use
of such variables in upcoming examples.
 
Search WWH ::




Custom Search