Understanding SQL & Java Together: A Guide to SQLJ, JDBC, and Related Technologies

7.5: Using Structured Types

7.5 Using Structured Types

Of course, creating and giving values to structured type instances is not nearly as interesting if you're not able to store them in your database, get them back out, and modify them.

7.5.1 Storing in the Database

If you want to store a structured type instance into a column of a table let's use that movie_table we declared earlier then you'll naturally use SQL's INSERT statement, as shown in Example 7.26.

Example 7.26: Inserting a New MOVIE Instance Using a Constructor.
INSERT INTO movie_table  VALUES ( '152208-A'  -- STOCK_NUMBER           <b class="bold">NEW movie(</b>           'The Game',           'A chilling thriller in which Michael Douglas'            'plays a man given a "gift" by his younger'            'brother...a gift that threatens his life'            'and his sanity.',           128 ),                -- new MOVIE instance           23                    --...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Backup and Recovery Software
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.