PSP Oracle Application Server. Configurations Database Access Descriptor (DAD) –Username: scott –Password: tiger –Connect String: localhost:1521:orc Create.

Slides:



Advertisements
Similar presentations
Owners Roles DB Objects Grant Revoke Grant Revoke Grant Revoke (*) with admin option Il ruolo …. È un set di system & object privileges Non appartiene.
Advertisements

Web Programming with PL/SQL Erdogan Dogdu Georgia State University Computer Science Department
Oracle PL/SQL IV Exceptions Packages.
Part 2.  Arrays  Functions  Passing Variables in a URL  Passing variables with forms  Sessions.
My_Demo_Test : Air –Pollution measured at certain time points in a day t0t1t2t3t
Introduction to MVC Adding a View Page NTPCUG Tom Perkins, Ph.D.
K Wassily Kandinsky - Composition IV, Web Publishing using PL/SQL and Java Eric Grancher CERN (Geneva), IT/DB European Organization.
INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Introduction to PL/SQL – Lecture 6.
PL/SQL Server Pages (Web Programming with PL/SQL)
PL/SQL (Embedded SQL) Introduction Benefits Basic Constructs
PL/SQL Agenda: Basic PL/SQL block structure
PHP Scripts HTML Forms Two-tier Software Architecture PHP Tools.
07/19/04 NorCal OAUG Training Day, Paper 2.4 John Peters, JRPJR, Inc.1 Oracle Workflow Notifications John Peters JRPJR, Inc.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Databases Illuminated Chapter 13 Databases and the Internet.
Advanced Databases Advanced PL/SQL Programming: Procedure, Function and Package.
Overview of JDBC and Pro*C 1 Overview of JDBC,Pro*C and Oracle connectivity on Omega CSE 5330 – Database Systems.
Cursor and Exception Handling By Nidhi Bhatnagar.
An Improved Approach to Generating Configuration Files from a Database Jon Finke Rensselaer Polytechnic Institute.
Intro To Oracle :part 1 made by: Fahad Hussain 1.Save your Memory Usage & Performance. 2.Oracle Login ways. 3.Adding Database to DB Trees. 4.How to Create.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Lecture 4 PL/SQL language. PL/SQL – procedural SQL Allows combining procedural and SQL code PL/SQL code is compiled, including SQL commands PL/SQL code.
1 JumpStart PL/SQL Wang Hao. 2 Outline PL/SQL Programming SQL*Plus and SQL commands.
MySQL Databases & PHP Integration Using PHP to write data to, and retrieve data from, a MySQL database.
Overview of JDBC and Pro*C 1 CSE 5330 – Database Systems.
Overview · What is PL/SQL · Advantages of PL/SQL · Basic Structure of a PL/SQL Block · Procedure · Function · Anonymous Block · Types of Block · Declaring.
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Cursors These slides are licensed under.
April 2-5 Orlando, Florida Create Your Own Self-Service Pages Presented by: Robert Nitsos & Jim Keene, SJ Loyola Marymount University April 4, 2006 Evaluation.
Subqueries.
SELECT Statements Lecture Notes Sree Nilakanta Fall 2010 (rev)
Autonomous Transactions: Extending the Possibilities Michael Rosenblum Dulcian, Inc. April 14, 2008 Presentation #419.
Procedure Function Trigger. create table employee ( id number, name varchar2(100), deptno number, salary float, primary key(id) ) create table deptincrease.
1. 1. Which type of argument passes a value from a procedure to the calling program? A. VARCHAR2 B. BOOLEAN C. OUT D. IN 2.
PL/SQL Cursors Session - II. Attributes Attributes %TYPE %ROWTYPE % Found % NotFound % RowCount % IsOPen %TYPE %ROWTYPE % Found % NotFound % RowCount.
PL SQL Block Structures. What is PL SQL A good way to get acquainted with PL/SQL is to look at a sample program. PL/SQL combines the data manipulating.
Copyright  Oracle Corporation, All rights reserved. 4 Accessing a Database Using JBCL.
In Oracle.  A PL/SQL block stored in the database and fired in response to a specified event ◦ DML statements : insert, update, delete ◦ DDL statements.
Advanced SQL: Cursors & Stored Procedures
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Maintaining Session State in the Data.
Copyright  Oracle Corporation, All rights reserved. 7 Accessing a Database Using SQLJ.
PL/SQL Procedural Language / Structured Query Language.
PL/SQL Block Structure DECLARE - Optional Variables, cursors, user-defined exceptions BEGIN - Mandatory SQL Statements PL/SQL Statements EXCEPTIONS - Optional.
1 All Powder Board and Ski Oracle 9i Workbook Chapter 10: Distributed Databases Jerry Post Copyright © 2003.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
School of Computing and Management Sciences © Sheffield Hallam University SQL is non-procedural –designed to be relatively approachable to non- programmers.
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Maintaining Session State in the Data.
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Implementing The Middle Tier These slides.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
16 Java Database Connectivity. 2 Understand the JDBC Understand the steps of the JDBC: 1.) Importing packages 2.) Opening a connection to a database 3.)
Web Service Calls from Within PL/SQL The Bare Necessities.
Introduction to PL/SQL Francis Thottungal. The outline The basic PL/SQL code structure is : DECLARE -- optional, which declares and define variables,
Last Updated : 27 th April 2004 Center of Excellence Data Warehousing Group Teradata RDBMS Concepts.
©Computer Resource Team, Inc All Rights Reserved. 1 Eliminating Tedious Work for the Oracle Web Developer By David Oranchak Computer Resource Team,
CS422 Principles of Database Systems Oracle PL/SQL Chengyu Sun California State University, Los Angeles.
1 Copyright © 2004, Oracle. All rights reserved. PL/SQL Programming Concepts: Review.
PHP – Hypertext Preprocessor.
4 Copyright © 2009, Oracle. All rights reserved. Working with Packages.
CS322: Database Systems PL/ SQL PL/SQL by Ivan Bayross.
Introduction to SQL Programming Techniques
Introduction to Dynamic Web Programming
SQL PL/SQL Presented by: Dr. Samir Tartir
Oracle Accounts on Campus
Interacting with the Oracle Server
Brief History of OA Framework
PL/SQL week10.
Oracle Architectural Components
Chapter 8 Advanced SQL Pearson Education © 2009.
SQL Stored Procedures and Functions Presented by: Dr. Samir Tartir
Database Programming Using Oracle 11g
Database Programming Using Oracle 11g
Presentation transcript:

PSP Oracle Application Server

Configurations Database Access Descriptor (DAD) –Username: scott –Password: tiger –Connect String: localhost:1521:orc Create a Procedure Go to url: – Database Access Descriptor (DAD) –Username: scott –Password: tiger –Connect String: localhost:1521:orc Create a Procedure Go to url: –

Example CREATE OR REPLACE PROCEDURE myhello AS BEGIN htp.print(' My First Page Hello, Web! '); END; CREATE OR REPLACE PROCEDURE myhello AS BEGIN htp.print(' My First Page Hello, Web! '); END;

Example 2 CREATE OR REPLACE PROCEDURE myhello AS BEGIN htp.htmlOpen; htp.headOpen; htp.title('My First Page'); htp.headClose; htp.bodyOpen( cattributes => 'BGCOLOR="white"'); htp.header(1, 'Hello, Web!'); htp.bodyClose; htp.htmlClose; END; CREATE OR REPLACE PROCEDURE myhello AS BEGIN htp.htmlOpen; htp.headOpen; htp.title('My First Page'); htp.headClose; htp.bodyOpen( cattributes => 'BGCOLOR="white"'); htp.header(1, 'Hello, Web!'); htp.bodyClose; htp.htmlClose; END;

Reference htp and htf packages htp – hypertext procedures Htf – hypertext functions (returns varchar2) htp and htf packages htp – hypertext procedures Htf – hypertext functions (returns varchar2)

Reuse code Create procedures to reuse code: CREATE OR REPLACE PACKAGE hutil AS PROCEDURE hOpen( p_title IN VARCHAR2 DEFAULT NULL,p_bgcolor IN VARCHAR2 DEFAULT '"white"' ); PROCEDURE hClose; END; Create procedures to reuse code: CREATE OR REPLACE PACKAGE hutil AS PROCEDURE hOpen( p_title IN VARCHAR2 DEFAULT NULL,p_bgcolor IN VARCHAR2 DEFAULT '"white"' ); PROCEDURE hClose; END;

CREATE OR REPLACE PACKAGE BODY hutil AS PROCEDURE hOpen( p_title in varchar2,p_bgcolor in varchar2 ) IS BEGIN htp.htmlOpen; htp.headOpen; htp.title( p_title ); htp.headClose; htp.bodyOpen( cattributes=> 'BGCOLOR=' || p_bgcolor ); END; PROCEDURE hClose IS BEGIN htp.bodyClose; htp.htmlClose; END; CREATE OR REPLACE PACKAGE BODY hutil AS PROCEDURE hOpen( p_title in varchar2,p_bgcolor in varchar2 ) IS BEGIN htp.htmlOpen; htp.headOpen; htp.title( p_title ); htp.headClose; htp.bodyOpen( cattributes=> 'BGCOLOR=' || p_bgcolor ); END; PROCEDURE hClose IS BEGIN htp.bodyClose; htp.htmlClose; END;

Use hutil CREATE OR REPLACE PROCEDURE myhello3 AS BEGIN hutil.hOpen('My First Page'); htp.header(1, 'Hello, Web!'); hutil.hClose; END; CREATE OR REPLACE PROCEDURE myhello3 AS BEGIN hutil.hOpen('My First Page'); htp.header(1, 'Hello, Web!'); hutil.hClose; END;

CREATE OR REPLACE PROCEDURE show_max_sal as maxSal scott.emp.sal%TYPE; cursor salCur IS SELECT MAX(sal) FROM scott.emp; noEmp exception; BEGIN hutil.hOpen( 'Salary Max'); OPEN salCur; FETCH salCur INTO maxSal; if salCur%NOTFOUND then raise noEmp; end if; CLOSE salCur; htp.print('The highest salary is: ' || maxSal); hutil.hClose; EXCEPTION WHEN noEmp THEN htp.print('Warning: There are no employees.'); hutil.hClose; END; CREATE OR REPLACE PROCEDURE show_max_sal as maxSal scott.emp.sal%TYPE; cursor salCur IS SELECT MAX(sal) FROM scott.emp; noEmp exception; BEGIN hutil.hOpen( 'Salary Max'); OPEN salCur; FETCH salCur INTO maxSal; if salCur%NOTFOUND then raise noEmp; end if; CLOSE salCur; htp.print('The highest salary is: ' || maxSal); hutil.hClose; EXCEPTION WHEN noEmp THEN htp.print('Warning: There are no employees.'); hutil.hClose; END; Display database data

CREATE OR REPLACE PROCEDURE empPrint AS BEGIN hutil.hOpen('Employees'); htp.tableOpen('BORDER'); htp.tableRowOpen; htp.tableHeader('Emp#'); htp.tableHeader('Name'); htp.tableHeader('Sal'); htp.tableRowClose; FOR theEmp IN (SELECT empno, ename, sal FROM scott.emp ORDER BY empno) LOOP htp.tableRowOpen; htp.tableData( theEmp.empno ); htp.tableData( theEmp.ename ); htp.tableData( theEmp.sal ); htp.tableRowClose; END LOOP; htp.tableClose; hutil.hClose; END; CREATE OR REPLACE PROCEDURE empPrint AS BEGIN hutil.hOpen('Employees'); htp.tableOpen('BORDER'); htp.tableRowOpen; htp.tableHeader('Emp#'); htp.tableHeader('Name'); htp.tableHeader('Sal'); htp.tableRowClose; FOR theEmp IN (SELECT empno, ename, sal FROM scott.emp ORDER BY empno) LOOP htp.tableRowOpen; htp.tableData( theEmp.empno ); htp.tableData( theEmp.ename ); htp.tableData( theEmp.sal ); htp.tableRowClose; END LOOP; htp.tableClose; hutil.hClose; END; Table

Dynamic Result CREATE OR REPLACE PROCEDURE empPrint2( p_deptno IN VARCHAR2 DEFAULT '%' ) AS BEGIN hutil.hOpen('Employees'); htp.tableOpen('BORDER'); FOR theEmp IN (SELECT empno, ename, sal FROM scott.emp WHERE deptno like p_deptno ORDER BY empno ) LOOP htp.tableRowOpen; htp.tableData( theEmp.empno ); htp.tableData(theEmp.ename ); htp.tableData(theEmp.sal ); htp.tableRowClose; END LOOP; htp.tableClose; hutil.hClose; END; CREATE OR REPLACE PROCEDURE empPrint2( p_deptno IN VARCHAR2 DEFAULT '%' ) AS BEGIN hutil.hOpen('Employees'); htp.tableOpen('BORDER'); FOR theEmp IN (SELECT empno, ename, sal FROM scott.emp WHERE deptno like p_deptno ORDER BY empno ) LOOP htp.tableRowOpen; htp.tableData( theEmp.empno ); htp.tableData(theEmp.ename ); htp.tableData(theEmp.sal ); htp.tableRowClose; END LOOP; htp.tableClose; hutil.hClose; END;

Create the input form To send parameter use the address: – Html form: To send parameter use the address: – Html form: