©Computer Resource Team, Inc. 1998. All Rights Reserved. 1 Eliminating Tedious Work for the Oracle Web Developer By David Oranchak Computer Resource Team,

Slides:



Advertisements
Similar presentations
Business Development Suit Presented by Thomas Mathews.
Advertisements

AN INTRODUCTION TO PL/SQL Mehdi Azarmi 1. Introduction PL/SQL is Oracle's procedural language extension to SQL, the non-procedural relational database.
Edoclite and Managing Client Engagements What is Edoclite? How is it used at IU? Development Process?
Lecture-5 Though SQL is the natural language of the DBA, it suffers from various inherent disadvantages, when used as a conventional programming language.
1 Chapter 12 Working With Access 2000 on the Internet.
A Guide to Oracle9i1 Advanced SQL And PL/SQL Topics Chapter 9.
Performed by:Gidi Getter Svetlana Klinovsky Supervised by:Viktor Kulikov 08/03/2009.
Mgt 240 Lecture Website Construction: Software and Language Alternatives March 29, 2005.
Creating Web Page Forms
Introduction to PL/SQL. Procedural Language extension for SQL Oracle Proprietary 3GL Capabilities Integration of SQL Portable within Oracle data bases.
8 Copyright © 2004, Oracle. All rights reserved. Creating LOVs and Editors.
6/1/2001 Supplementing Aleph Reports Using The Crystal Reports Web Component Server Presented by Bob Gerrity Head.
JSP Standard Tag Library
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
Bordoloi and Bock CURSORS. Bordoloi and Bock CURSOR MANIPULATION To process an SQL statement, ORACLE needs to create an area of memory known as the context.
PL / SQL P rocedural L anguage / S tructured Q uery L anguage Chapter 7 in Lab Reference.
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
Page: 1 Creating AJAX-Powered Forms with the Dojo Toolkit Presented By: James Harmon Object Training Group, Inc.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 7-1 David M. Kroenke’s Chapter Seven: SQL for Database Construction and.
Oracle9 i JDeveloper for Database Developers and DBAs Brian Fry Principal Product Manager Oracle JDeveloper Oracle Corporation.
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 11 Introduction to Dynamic SQL and Object Technology.
JSP Java Server Pages Softsmith Infotech.
COLD FUSION Deepak Sethi. What is it…. Cold fusion is a complete web application server mainly used for developing e-business applications. It allows.
OracleAS Reports Services. Problem Statement To simplify the process of managing, creating and execution of Oracle Reports.
Chapter 7 Advanced SQL Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Dinamic SQL & Cursor. Why Dinamic SQL ? Sometimes there is a need to dynamically create a SQL statement on the fly and then run that command. This can.
CMPS 211 JavaScript Topic 1 JavaScript Syntax. 2Outline Goals and Objectives Goals and Objectives Chapter Headlines Chapter Headlines Introduction Introduction.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
1 Optimizing Your ColdFusion Applications for Oracle Justin Fidler, CNA, CPS, CCFD Chief Technology Officer Bantu, Inc. 8 May 2001.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
INTRODUCTION TO PL/SQL. Class Agenda Introduction Introduction to PL/SQL Declaring PL/SQL Variable Creating the Executable Section Interacting with the.
1 Copyright © 2004, Oracle. All rights reserved. Introduction to PL/SQL.
Overview · What is PL/SQL · Advantages of PL/SQL · Basic Structure of a PL/SQL Block · Procedure · Function · Anonymous Block · Types of Block · Declaring.
PSP Oracle Application Server. Configurations Database Access Descriptor (DAD) –Username: scott –Password: tiger –Connect String: localhost:1521:orc Create.
Using Procedures & Functions Oracle Database PL/SQL 10g Programming Chapter 9.
CERN - IT Department CH-1211 Genève 23 Switzerland t DB Development Tools Benthic SQL Developer Application Express WLCG Service Reliability.
PL / SQL By Mohammed Baihan. What is PL/SQL? PL/SQL stands for Procedural Language extension of SQL. PL/SQL is a combination of SQL along with the procedural.
1 Copyright © 2004, Oracle. All rights reserved. Introduction to PL/SQL.
8 1 Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Chapter 15 Introduction to PL/SQL. Chapter Objectives  Explain the benefits of using PL/SQL blocks versus several SQL statements  Identify the sections.
Database Application Development using PL/SQL Programming.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
School of Computing and Management Sciences © Sheffield Hallam University SQL is non-procedural –designed to be relatively approachable to non- programmers.
6/1/2001 Supplementing Aleph Reports Using The Crystal Reports Web Component Server Presented by Bob Gerrity Head.
Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
ASP.NET in Definition: 1.ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites,
CS562 Advanced Java and Internet Application Introduction to the Computer Warehouse Web Application. Java Server Pages (JSP) Technology. By Team Alpha.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Text TCS INTERNAL Oracle PL/SQL – Introduction. TCS INTERNAL PL SQL Introduction PLSQL means Procedural Language extension of SQL. PLSQL is a database.
Lab 2 Writing PL/SQL Blocks CISB514 Advanced Database Systems.
Last Updated : 27 th April 2004 Center of Excellence Data Warehousing Group Teradata RDBMS Concepts.
Kingdom of Saudi Arabia Ministry of Higher Education Al-Imam Muhammad Ibn Saud Islamic University College of Computer and Information Sciences Overview.
WebScan: Implementing QueryServer 2.0 Karl Geiger, Amgen Inc. BRS NA UG August 1999.
Introduction to PL/SQL N. Dimililer. About PL/SQL –PL/SQL is an extension to SQL with design features of programming languages. –Data manipulation and.
5 Copyright © 2004, Oracle. All rights reserved. PL/SQL Server Pages.
What Are Subprograms? Subprograms are named PL/SQL blocks that can take parameters and be invoked. Subprograms allow decomposition of a program into logical.
CS422 Principles of Database Systems Stored Procedures and Triggers Chengyu Sun California State University, Los Angeles.
COMP 430 Intro. to Database Systems
SQL and SQL*Plus Interaction
Using SQL*Plus.
UNIT - V STORED PROCEDURE.
Knowledge Byte In this section, you will learn about:
Using SQL*Plus.
ISC440: Web Programming 2 Server-side Scripting PHP 3
PL/SQL week10.
Chapter 8 Advanced SQL.
Using SQL*Plus.
…and web frameworks in general
MATERI PL/SQL Procedures Functions Packages Database Triggers
Presentation transcript:

©Computer Resource Team, Inc All Rights Reserved. 1 Eliminating Tedious Work for the Oracle Web Developer By David Oranchak Computer Resource Team, Inc. November 8, Phone: (540) extension 210

©Computer Resource Team, Inc All Rights Reserved. 2 Goals Free stuff for your tool box Examine PL/SQL coding habits and common pitfalls PL/SQL encapsulation of client-side JavaScript data validation The Power of DBMS_SQL for quick deployment Alternatives to expensive development packages

©Computer Resource Team, Inc All Rights Reserved. 3 TOAD What is it? Tool for Oracle Application Developers From the webpage: Written by an Oracle application developer for Oracle application developers, TOAD is a Win95/NT tool for Oracle developers. TOAD will help develop queries, perform Explain Plan, browse and edit database objects, edit table data, edit and debug PL/Sql. TOAD also has configurable syntax highlighting, direct OCI access to Oracle, optimization statistics, shared pool recall, AutoTrace, and reports. TOAD is both free and fully usable on your first download.

©Computer Resource Team, Inc All Rights Reserved. 4 TOAD Benefits Completely free and un-crippled Easy to use Provides an extremely large amount of database-related information in an easy-to-digest manner. Feature-rich Routinely updated, and new features are typically requested by other developers. Eliminates tedious work!

©Computer Resource Team, Inc All Rights Reserved. 5 Tips and Tricks How to help guard your application code against changes in database design Removing duplicate database information in applications Coding style HTML style encapsulation Encapsulation of client-side JavaScript data validation

©Computer Resource Team, Inc All Rights Reserved. 6 Anchored Declarations Operator used to assign the datatype of a database element dynamically to a PL/SQL variable Allows for flexibility in PL/SQL applications whenever the database is changed Example syntax: –f_employee_id employees.id%TYPE; Prevents local variables from being mistyped.

©Computer Resource Team, Inc All Rights Reserved. 7 Anchored Declarations Example: procedure parameters (old way) PROCEDURE update_ssn ( f_employee_id NUMBER, f_new_ssn VARCHAR2, f_dob VARCHAR2 )

©Computer Resource Team, Inc All Rights Reserved. 8 Anchored Declarations Example: procedure parameters (new way) PROCEDURE update_ssn ( f_employee_id employees.id%TYPE, f_new_ssn employees.ssn%TYPE, f_dob employees.dob%TYPE )

©Computer Resource Team, Inc All Rights Reserved. 9 Anchored Declarations Moral of the story: –Push database-specific knowledge back to the database. –Anchored declarations allow you to push datatype information back to the database.

©Computer Resource Team, Inc All Rights Reserved. 10 Coding Style One of the biggest PL/SQL headaches: finding mismatched HTML tags Structured code helps to streamline the debugging process

©Computer Resource Team, Inc All Rights Reserved. 11 Coding Style Old style: htp.p(‘ ’); htp.p(‘ Name ’); htp.p(‘ Social Security Number ’); htp.p(‘ ’); htp.p(‘ <tr valign=top’); htp.p(‘ Jello Biafra ’); htp.p(‘ ’); htp.p(‘ ’);

©Computer Resource Team, Inc All Rights Reserved. 12 New style: htp.tableOpen ( '0', cattributes => 'CELLPADDING=3 CELLSPACING=0' ); htp.tableRowOpen ( cvalign => 'TOP' ); htp.tableData('Name'); htp.tableData('Social Security Number'); htp.tableRowClose; htp.tableRowOpen ( cvalign => 'TOP' ); htp.tableData('Jello Biafra'); htp.tableData(' '); htp.tableRowClose; htp.tableClose;

©Computer Resource Team, Inc All Rights Reserved. 13 New style: unpaired tags in HTP: htp.tableRowOpen ( cvalign => 'TOP' ); htp.p(' '); htp.italic('Name'); htp.p('</B'); htp.p(' '); htp.italic('Social Security Number'); htp.p('</B'); htp.p(' '); htp.tableRowClose;

©Computer Resource Team, Inc All Rights Reserved. 14 New style: unpaired tags in HTP: htp.tableRowOpen ( cvalign => 'TOP' ); htp.tableData ( htf.bold ( htf.italic('Name') ) ); htp.tableData ( htf.bold ( htf.italic('Social Security Number') ) ); htp.tableRowClose;

©Computer Resource Team, Inc All Rights Reserved. 15 Coding Style New style (with concatenated nesting): htp.tableData ( htf.fontOpen ( quidlib_constants.g_main_table_header_text ) || htf.bold('Report Name:') || htf.fontClose, cattributes => 'BGCOLOR="#000000' );

©Computer Resource Team, Inc All Rights Reserved. 16 HTML Style Encapsulate HTML style information in: –PL/SQL packages –Database tables –HTML v4.0 Cascading Style Sheets Benefits: –Provides consistency throughout applications –Makes it easier to make global changes to the appearance of the web application –Provides flexible mechanism to add web-based maintenance capabilities to the application itself

©Computer Resource Team, Inc All Rights Reserved. 17 HTML Style Example of PL/SQL encapsulation of HTML style information: create or replace package emp_constants as g_body_bgcolor constant char(7) := '#FFFFFF'; g_body_text constant char(7) := '#000000'; g_main_table_header_bgcolor constant char(7) := '#0099CC'; g_main_table_header_text constant char(7) := '#FFFFFF'; g_sub_table_header_bgcolor constant char(7) := '#003366'; g_sub_table_header_text constant char(7) := '#FFFFFF'; end; Usage: htp.fontOpen(emp_constants.g_main_table_header_text); htp.bold(‘Employee Name:’); htp.fontClose;

©Computer Resource Team, Inc All Rights Reserved. 18 Client-Side JavaScript Data Validation Used to process form input before data is sent to the database. Allows client machines to do some of the work involved with maintaining data integrity Streamlines data flow and business rules

©Computer Resource Team, Inc All Rights Reserved. 19 Client-Side JavaScript Data Validation Example: htp.p (' function verifyNotNull() { val_check = document.edit_form.employee_name.value; if (val_check == "") { alert("The name of the employee must be entered."); return false; } ');

©Computer Resource Team, Inc All Rights Reserved. 20 Client-Side JavaScript Data Validation Usage: htp.formSubmit ( cvalue => 'Update', cattributes => 'onClick = "return verifyNotEmpty()"' );

©Computer Resource Team, Inc All Rights Reserved. 21 Client-Side JavaScript Data Validation Problems: –Tedious to repeatedly write validation routines for fields which cannot be null fields that can only contain numerical data –Also, how do we handle maximum data sizes? Using hard-coded maxlength parameter in htp.formInput duplicates information already in the database. Solution: –Build JavaScript library that can generate JavaScript code on the fly, dependent on database information.

©Computer Resource Team, Inc All Rights Reserved. 22 Encapsulated Client-Side JavaScript Data Validation Approach: –Use DBMS_SQL (discussed later) to fetch information from data dictionary view user_tab_columns based on the tables and columns you want information for. –For a given table and column, find its entry in the view, then pull out relevent info, such as data_type, data_length, data_precision, and nullable. –Use this info to drive generation of JavaScript functions.

©Computer Resource Team, Inc All Rights Reserved. 23 Encapsulated Client-Side JavaScript Data Validation Contents of USER_TAB_COLUMNS for EMPLOYEES table: TABLE_NAME COLUMN_NAME DATA_TYPE DATA_LENGTH DATA_PRECISION NULLABLE EMPLOYEES FIRST_NAME VARCHAR2 20 N EMPLOYEES LAST_NAME VARCHAR2 20 N EMPLOYEES SSN VARCHAR2 9 Y EMPLOYEES DOB DATE 7 Y EMPLOYEES HEIGHT NUMBER 22 5 Y

©Computer Resource Team, Inc All Rights Reserved. 24 The Power of DBMS_SQL What is DBMS_SQL? –Standard PL/SQL package for creating, executing, and manipulating arbitrary queries. Why use DBMS_SQL? –Provides ability to define and process PL/SQL cursors that are based on dynamic SQL queries instead of static, hard-coded ones. –Provides the means to push more tedious, repetitive work back to the database and away from applications.

©Computer Resource Team, Inc All Rights Reserved. 25 The Power of DBMS_SQL How does it work?

©Computer Resource Team, Inc All Rights Reserved. 26 QUIDLIB What is it? –Quick Deployment Library –PL/SQL package I made to demonstrate the usefulness of DBMS_SQL, JavaScript encapsulation, and other ideas in this presentation –Web-based form/report generator that can make master/detail reports and maintenance forms for any database tables. –Shows a basic homemade implementation of generic maintenance and reporting

©Computer Resource Team, Inc All Rights Reserved. 27 Alternatives WebDB –Oracle’s tool for quick deployment of web applications. –Provides robust mechanism to create database reports and forms. –Similar to Developer 2000, but it is completely web- based. –Currently available in Beta version; full release not expected until (sometime) 1999.

©Computer Resource Team, Inc All Rights Reserved. 28 Conclusion Free tools are out there to help you save time Pushing as much as you can back to the database makes a database and its applications more flexible and reusable Web-based deployment is a rapidly-changing environment. Problems can be prevented and time can be saved by making application behaviors as generic as possible.