Call (800) 766-1884 for Oracle support & training
Free Oracle Tips


Oracle Consulting Support
Oracle Upgrades
Use New Oracle Features
Oracle Replication Support
Oracle Training
Remote Oracle DBA
System Documentation
Oracle Tips
Oracle Performance
 

Free Oracle Tips


 

HTML Text

BC Oracle tuning

Oracle training

Oracle support

Remote Oracle

 

 

   
  Oracle Tips by Burleson

Session State

To the seasoned developer, session state can best be defined in terms of global variables.  Session state is the storing of page item values in the database.  Their values can be referenced from any page in an application.  Since they are stored in a database table and are specific to each HTML DB session, their values can be referenced in stored procedures.

A big benefit any experienced web developer will notice immediately is that session state is managed by HTML DB.  Nothing special like saving them in hidden page values has to be done.  Just being able to reference session state from a stored procedure will show how valuable it is to have HTML DB provide this ability.

Session state for page items are tied to a page so all the page items can be set to NULL values by clearing the cachefor a page.  It is also possible to set all the page items in the entire application to NULL by clearing the cache for the application.

Viewing the values in session state can be done by using the Session link on the developer toolbar.  It is also possible to view session state for the whole workspace by logging in as an administrator and navigating to HTML DB Workspace Administration à Manage Services à Session State

Navigating to the HTML DB Workspace Administration is accomplished by clicking on the Administration tab.

Reference Types for Page Items

While using HTML DB, it will be necessary to reference the session state for page items.  There are several ways, or reference types, for referring to the page item depending on the type of code the HTML DB engine is executing.  For the most part, page items in SQL are referenced using the Bind Variable syntax and when editing page items, their values are set using the Substitution String syntax.

Bind Variable:  Syntax  :P100_CUSTOMER_ID

This syntax is used within the SQL statements for page processes, page computations, and page validations.

Substitution String:  Syntax  &P100_CUSTOMERID.

When a page is rendered, the HTML DB engine will substitute the text of the substitution string &P100_CUSTOMER_ID. with the value of the session state, such as the value 231.  The syntax of the substitution string includes a leading ampersand (&) and a trailing period (.).  The substitution strings can be used in region titles, page items, URL’s, and other locations.

PL/SQL:  Syntax  V( 'P100_CUSTOMER' )

This is used to reference the session state of page items from a PL/SQL stored procedure.  When the page is submitted, the session state is stored in HTML DB tables for each of the page items.  The session state can then be referenced by using the V and NV functions.  The V function is for alphanumeric values and the NV function will return the value as a number.

Template Substitution:  Syntax  #P100_CUSTOMER_ID#

This syntax is primarily used in templates to reference attributes set on attributes pages such as application attributes, page definition, etc.  This syntax is also used on reports to reference the values returned for columns in an SQL select statement.  One example is to use this syntax in a report column link to refer to the column in the SQL statement.

Preferences

Preferences comprise a persistent session state that is maintained between user sessions.  That is, when a user logs out and logs back in, the Preferences can be re-read and used.  They are like variables that last forever between uses of the application.

In HTML DB, the developer may have chosen to modify the default view from Icons to Details, so HTML DB saved that selection as a user preference.  HTML DB then uses the stored user preference to know how to display the screen the next time the developer logs in to do development.

Preferences are user specific.  If public authentication, Page Is Public, is being used for web pages, all users are authenticated with the same user preferences.  Since public pages do not require a valid user login id, HTML DB uses the username of NOBODY; therefore, since everyone using public pages is known to HTML DB as nobody, the preferences are shared among all web users.  If the previous visitor to the web page sorted the report by the Payment Type column, the next user to visit would see the same sorting due to the preference being reused.  In this case, the developer may want to create a page process that will reset the preferences as the page is being rendered.  That can be done by creating a Session State page process with the type set to Reset Preferences (remove all preferences for current user).  This can be handy on report pages where data can be sorted.  In the description above, the preferences are being reset before loading a report page to restore the default sorting of how the report was designed.  The section in this book on HTML DB APIs provides more information on the htmldb_util.remove_sort_preferencesprocedure.


The above book excerpt is from:

Easy HTML-DB Oracle Application Express

Create Dynamic Web Pages with OAE

ISBN 0-9761573-1-4   

Michael Cunningham & Kent Crotty

http://www.rampant-books.com/book_2005_2_html_db.htm

  
 

Oracle performance tuning software 
 
 
 
 

Oracle performance tuning book

 

 
 
 
Oracle performance Tuning 10g reference poster
 
 
 
Oracle training in Linux commands
 
Oracle training Excel
 
Oracle training & performance tuning books
 

 

   

Copyright © 1996 -  2011 by Burleson Enterprises. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.