Answers to Chapter 9

Reviewing It

1: Explain the difference between the HTP package and the HTF package.
A1: The HTP package contains PL/SQL procedures that generate HTML output, whereas the HTF package contains PL/SQL functions that return HTML code as the return value
2: What is htp.p used for?
A2: htp.p can be used to pass the text <HTML> to the HTML output
3: Why would you want to call another PL/SQL procedure in a Web environment?
A3: This called pl/sql is a way of giving a consistent look with appearances and error messages across the Web site
4: In Listing 9.9, line 4, why is the p_inv_id variable set to null?
A4: To provide the procedure with a default value in the case that no value was passed, the Web page displays with the lowest inv_id record in the database
5: In Listing 9.10, what error message will be displayed if the car requested cannot be found?
A5: 42:p_text => 'The auto selected could not be found'.

Checking It

1: If you have an htp.bodyopen command you need an
  1. Htp.htlmopen

  2. Htp.htlmclose

  3. Htp.bodyclose

  4. Htp.textopen

A1: c
2: What happens if an input parameter does not have a default value and none is passed?
  1. Nothing happens, the Web page displays as programmed

  2. An error is returned to the user complaining about a missing mandatory parameter

  3. The results may be unpredictable as the Web page will try to display the variable

  4. The Web server will crash

A2: b
3: When using PL/SQL, you do not need a virtual path at all.

True/False

A3: False, the virtual path tells the Web server that this is a PL/SQL.

Applying It

Independent Exercise 1:

  • Start your favorite editor and put the few HTML commands in to simply display your name.

  • Name this file Ch9_ex1.htm.

  • Access this file with your favorite Web browser.

Independent Exercise 2:

  • Start your favorite editor and build and compile a simple PL/SQL procedure that performs the same task as Exercise 1 except use the PL/SQL htp package to create the HTML.

Independent Exercise 3:

  • Create a small table object with one character field.

  • Build a simple PL/SQL Web-based procedure that

    • Prompts the user for a variable.

    • Checks to make sure something was entered.

    • Inserts into your table object the contents of this variable.

    • Displays what has been inserted.

    • Clears the entry field so that additional information can be entered.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.146.178.165