everythingOracle.bizhat.com

 

'Everything you wanted
to know about Oracle'

Training References Syntax Tell A Friend Contact Us

 

 

Manuscript: 16

 

 

Topics:  Hands-On 13

 

Your organization wants to use the �managers_pkg� package that you created to insert, delete, update, lock, and count a record.

 

You have been assigned to develop an application form to manipulate the managers table using transactional triggers.

 

   
   

Manuscript

-- Hands-on 13 (Form Block and Transactional Triggers using Developer v6i tool)

Click on the "+" sign next to "Database objects" to expand it.

Expand the ORACLE schema.

Then, expand the "Stored Program Units" item.

Open the "Managers" package body.

Browse through the package body that had been created during the previous hands-on exercise.
We are going to use these delete, update, and insert procedures to manipulate the "FORM BLOCK" object.


Close "WINDOWS." 

Browse through the package specification and then close the window.

Change the "FORM" name to "MANAGERS_INFORMATION."

Highligh or select the "Data Blocks" item, and then click on the "Create" icon.

Use the Data Block Wizard to create a new Data Block.

Click the "NEXT" button to continue.

Click "NEXT" again.

Click on the "Browse" button and select the "MANAGERS" table.

Then, click "OK."

Select all items and click "NEXT."

Select the "Just Create the data block" option and click "FINISH."

Now, open the "MANAGERS" data block's property palette.

Change the "Query Data Source Type" item to "procedure,"

the "Source Name" item to "MANAGERS_PKG.MANAGERS_REFCUR."

On "Source Columns," you do not need to set anything in its property, as Forms has already done this since you began by creating the block with a data block as a Table. 

Close it.

On "Source Arguments," type "MANAGERS_DATA."

Set the Type to "REFCURSOR."

Set "Type Name" to "MANAGERS_PKG.C_MANAGERS."

set the "Mode" to "IN OUT."

Close the window.

Change the "DML Data Target Type" item to "Transactional Triggers."

Close the window.

Highlight "Triggers" and click on the "Create" icon.

Type the letter "O," then "I" and click "OK."

Write a stored procedure to insert a record into the "MANAGERS" table.

Notice that the "MANAGERS_INSERT" procedure was created during the previous Hands-On.

Compile the trigger.

Let's copy the code so we can use it to create other triggers.

Click on "New" and type the letter "O" and "L."

Click on "OK."

Write a stored procedure to lock a record. 
Use "MANAGERS_LOCK" that was created from the previous Hands-On.

Compile the trigger.

Click on "New" and type the letter "O" and "U." Then click "OK."

Write a stored procedure to update a record.
Use the "UPDATE" procedure from your created package.

Compile then trigger, then click on "New" and type the letter "O" and "D."

Click "OK."

Write a stored procedure to delete a record.
Use the "Delete" procedure from your create package.

Compile it then click on "New" and type a letter "O" and "C."
Click "ON-COUNT" and then click "OK."

Write a stored procedure to count the "MANAGERS" records.
Then set the block property to refresh the number of records.

Compile the trigger and close the window.

Go to the "Tools" menu and select the "Layout Wizard" option.

Click on "next" to continue.

Use the default canvas type.

Select all items and then click on the "Next" button.

Change the prompt if it is needed.

Use the "Form" option.

Change title to "Managers Name" and click "Next."

Click on the "Finish" button.

On the layout FORM, run the program to test it.

Insert records into the Managers table.

Save the inserts. Two records were added.

Update a record and navigate through your changes.
The record was changed.

Save the update. 

Delete record and test the delete action.

Close the application and save the FORM.


Now, you should practice this over and over, until you become a master at it.

Good Luck!

 

     Reviews and Templates for FrontPage
     

Copyright � everythingOracle.bizhat.com 2006 All Rights Reserved.