ESERCIZIO PL/SQL e PSP



Similar documents
TabCaratteri=" abcdefghijklmnopqrstuvwxyz._~ABCDEFGHIJKLMNOPQRSTUVWXYZ";

Cifratura Dati in Tabelle MySQL

SQL Programming. CS145 Lecture Notes #10. Motivation. Oracle PL/SQL. Basics. Example schema:

Working with Oracle Database XE. Create New User Account Using SQL Run Script Files PL/SQL Objects PL/SQL Server Pages

How To Read Investire In Borsa Con I Trend Pdf

ESERCIZI ESTIVI PER IL SUPERAMENTO DEL DEBITO CLASSI PRIME a.s. 2013/14

DDL ed SQL Compravendite Immobiliari

n N e E 0 m A R sr S l /01

8Q PRQGR GL FRQWHQLWRUL $ ZRUOG RI HQFORVXUHV

6 Present perfect simple e continuous (25-27, 30-31)

FOR TEACHERS ONLY The University of the State of New York

PAESE/COUNTRY: Certificato veterinario per l'ue/veterinary certificate to EU

Nuovi domini di primo livello - Registra nuove estensioni con FabsWeb_HOST

SAFE. DESIGNED in italy CASSEFORTI PER HOTEL HOTEL SAFES

Odoo 8.0. Le nuove API.

Web Services Servizio Telematico Doganale

TDD da un capo all altro. Matteo Vaccari (cc) Alcuni diritti riservati

SAFE TOP OPEN. Sistema di chiusura Locking system

!"# $ %& '( ! %& $ ' &)* + ! * $, $ (, ( '! -,) (# *&23. mysql> select * from from clienti;

ITALIANISSIMO 1 Euro Worksheet 1

Problems and Measures Regarding Waste 1 Management and 3R Era of public health improvement Situation subsequent to the Meiji Restoration

How to renew S&S Video Italian version IBM Corporation

ipratico POS Quick Start Guide v. 1.0

- ProFTPd: - ftp://ftp.proftpd.org/distrib/source/proftpd tar.gz

1 /*ora sincrinizzata con NTP. Inserendo codice OTP si attiva un servo che ruota di 95 grad. Per chiudere il servo premere 2 "*" mentre per azzerrare

Application Lifecycle Management. Build Automation. Fabrizio Morando Application Development Manger Microsoft Italia

combiarialdo accessories & hardware for metal fittings combiarialdo.it >2010 Collection

Corso: Administering Microsoft SQL Server 2012 Databases Codice PCSNET: MSQ2-1 Cod. Vendor: Durata: 5

Percorso Mcsa Managing and Mainting Windows 8

CBC (EUROPE) Srl NOTA APPLICATIVA

Corso: Configuring and Administering Windows 7 Codice PCSNET: MSW7-8 Cod. Vendor: Durata: 5

Ferramedia Network business center Berlin Dubai, Mumbai e Palermo. sister companies

Cognome Nome Matr. Corso di laurea. CLA Sperimentazione - Lingua Inglese - (a.a 2010/2011) September session. Top Ten Countries by Immigrants

New Media Advertising Agency

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

ONLINE COLLABORATION USING DATABASES IMAGE EDITING SPECIALISED LEVEL CAD2D SPECIALISED LEVEL

Using SQL Developer. Copyright 2008, Oracle. All rights reserved.

IBM System Storage DS3400 Simple SAN Express Kit PN U

Fund Forum Lugano 25 Novembre 2013

How To Lock A File In A Microsoft Microsoft System

Serialization and Good Distribution Practices: Regulatory Impacts, Opportunities and Criticalities for Manufacturers and Drugs Distribution Chain

PRE ARRIVAL FORM FOR EXCHANGE STUDENTS

IBM System Storage DS3400 Simple SAN Ready Express

Master of Advanced Studies in Music Performance and Interpretation

INDICE / INDEX. F2 Form and Function

Geo-Platform Introduction

Belgrade 12 December Luke Brucato Manager CRIF Certification Services

Alberto Meneghini! Security Leader, IBM Italia! IBM Security IBM Corporation IBM Corporation

Corso: Core Solutions of Microsoft Skype for Business 2015 Codice PCSNET: MSKY-5 Cod. Vendor: Durata: 5

17 Sightseeing in York

Mapping ITS s File Server Folder to Mosaic Windows to Publish a Website

ESAME FINALE DI LIVELLO 3 Edizione Tipologia Studenti e Dottorandi et al

VASCO Data Security. The Authentication Company. Richard Zoni Channel Manager Italy

CATALOGO 2008 UPGRADE METAFORM

1. PERSONA RILEVANTE DICHIARANTE / DECLARER 1.1 DATI ANAGRAFICI / PERSONAL DATA DI NASCITA / BIRTH*

Supplement I.C. Creating, Compiling and Running Java Programs from the Command Window

How To Manage A Network On A Pnet 2.5 (Net 2) (Net2) (Procedure) (Network) (Wireless) (Powerline) (Wired) (Lan 2) And (Net1) (

Corso: Supporting and Troubleshooting Windows 10 Codice PCSNET: MW10-3 Cod. Vendor: Durata: 5

DTI / Titolo principale della presentazione IPHONE ENCRYPTION. Litiano Piccin. 11 ottobre 2014

PhD Student Marco Maggiali

Progetto Ombra Milano propone un nuovo progetto dal design tutto italiano. Una SCALA di prestigio accessibile a tutti.

Capitolo 14: Flussi. Capitolo 14. Flussi Apogeo srl Horstmann-Concetti di informatica e fondamenti di Java 2

Versione: 2.1. Interoperabilità del Sistema di Accettazione di SPT

From Open Data & Linked Data to Ontology. example:

LICEO C. SIGONIO MODENA TEST D INGRESSO LINGUA INGLESE PER ESERCITAZIONI IN PREPARAZIONE AL PLACEMENT TEST ENGLISH PLACEMENT TEST

To provide information on the new Blue Card yacht certificate and procedures for its use

Source code security testing

Installare Oracle su Slack 10

Developing SQL and PL/SQL with JDeveloper

ROS Robot Operating System. Robotica Prof. Davide Brugali Università degli Studi di Bergamo

F.i.D. Fama Italian Design

Analytical study on online communication tools within elearning systems

Dott. Ruggero Giorgianni. Gruppo Pre-intermediate. Il Futuro

Our analysis of the results of the experiment did not provide an explanation of its failure, because our data collection lacked the precision needed.

PROGRAMMA CORSO DI LOGIC PRO 9

The statistics used in this report have been compiled before the completion of any Post Results Services.

1 Changes in this release

Introduction to the IBM Rational Software Development Platform

*N.B.: le lunghezze riportate sono da intendere passaggio aria VERNICIATURA: Colori RAL : + 15% Altri colori: prezzi a richiesta

Italian Section 31 - Online activitites

INFORMAZIONI GENERALI / GENERAL INFORMATION

ATBONLINE BUSINESS. Customer User Guide Exporting Account Information to.ofx Format Software (Simply Accounting).

Using ORACLE in the CSLab

The secret color in 10 points. Basso contenuto ammoniacale LOW AMMONIA CONTENT. emulsione olio in acqua Oil in water emulsion COVERAGE

LED Power. Power Supplies for constant current HI-POWER LEDs 350/700mA Alimentatori per LED in corrente costante HI-POWER 350/700mA 82206/700

Setting up SQL Translation Framework OBE for Database 12cR1

Power meter. Caratterizzazione di amplificatori a RF. Amplificatori a RF. Incertezza Corso di Laboratorio di misure ad alta frequenza

Corso: Mastering Microsoft Project 2010 Codice PCSNET: MSPJ-11 Cod. Vendor: Durata: 3

Oracle 10g PL/SQL Training

Corso: Microsoft Project Server 2010 Technical Boot Camp Codice PCSNET: AAAA-0 Cod. Vendor: - Durata: 5

Transcription:

ESERCIZIO PL/SQL e PSP

LO SCHEMA create table studenti ( nome VARCHAR2(15) not null, cognome VARCHAR2(15) not null, eta NUMBER );

COPIATE I FILES Copiate i files da \\homeserver\ghelli\bdl\esercizi\eseps p oppure da http://www.di.unipi.it/~ghelli/didatti ca/bdl/esercizi/esepsp/

CREATE LO SCHEMA Caricate: createtable.sql Risposta: drop table studenti * ERRORE alla riga 1: ORA-00942: table or view does not exist Creata tabella. Creata 1 riga...

Voglio creare la pagina: <html> <head><title>mostra studenti</title></head> <body> <h1>elenco studenti </h1> <table> <tr> <td> <i> Cognome </i> </td> <td> <i>nome </i> </td> </tr> <tr> <td> Carto </td> <td> Lina </td> </tr> <tr> <td> Mando </td> <td> Lino </td> </tr> <tr> <td> Aspi </td> <td> Rina </td> </tr> <tr> <td> Compi </td> <td> Tino </td> </tr> </table> </body> </html>

Ecco il codice PL/SQL create or replace PROCEDURE provapl AS begin htp.prn(' <HTML> <HEAD><TITLE>Mostra studenti </TITLE></HEAD> <BODY> <H1>Elenco studenti </H1> <TABLE> <TR> <TD> <I>Cognome</I></TD> <TD> <I>Nome </I> </TD> </TR> '); for studente in (select nome, cognome from studenti) loop htp.prn(' <TR> <TD> ' studente.cognome ); htp.prn(' </TD> <TD> ' studente.nome ); htp.prn(' </TD> </TR> '); end loop; htp.prn(' </TABLE> </BODY> </HTML> '); end;

Compilate provapl.sql Compilate provapl.sql Test: //oracle1.cli.di.unipi.it/pls/user.prova pl

PASSARE UN PARAMETRO create or replace PROCEDURE provaparpl ( ilcognome IN VARCHAR2) AS begin htp.prn(' <HTML> <HEAD../HEAD> <BODY> <H1>Elenco studenti </H1> <TABLE> <TR> <TD> <I>Cognome</I></TD> <TD> <I>Nome </I> </TD> </TR> '); for studente in (select nome, cognome from studenti s where s.cognome = ilcognome) loop htp.prn(' <TR> <TD> studente.cognome ); htp.prn(' </TD> <TD> studente.nome ); htp.prn(' </TD> </TR> '); end loop; htp.prn(' </TABLE> </BODY> </HTML> '); end;

Compilate provaparpl.sql Compilate provaparpl.sql Test: //oracle1.cli.di.unipi.it/pls/user.provaparpl Errore //or.../pls/user.provaparpl?ilcognome=mando Successo //.../pls/user.provaparpl?ilcognome=ghelli Tabella vuota

Un modo più semplice: con un editore html: <HTML><HEAD><TITLE>Mostra studenti</title></head> <BODY> <H1>Elenco studenti </H1> <TABLE> <TR><TD> <I><font size=+1> Cognome </font></i> </TD> <TD> <I><font size=+1> Nome </TD></TR> <TR> <TD> Mario </TD> <TD> Rossi </TD> </TR> <TR> <TD> Luigi </TD> <TD> Bianchi </TD> </TR> </TABLE> </BODY> </HTML> </font></i>

Poi, modificate come segue <%@ page language="pl/sql" %> <HTML><HEAD><TITLE>Mostra studenti</title></head> <BODY> <H1>Elenco studenti </H1> <TABLE> <TR><TD> <I><font size=+1> Cognome </font></i> </TD> <TD> <I><font size=+1> Nome </font></i> </TD></TR> <% for studente in (select nome, cognome from studenti) loop %> <TR> <TD> <%= studente.cognome %> </TD> <TD> <%= studente.nome %> </TD> </TR> <% end loop; %> </TABLE> </BODY> </HTML>

COMPILATE provapsp.psp Guardate provapsp.psp Compilatelo da una command shell (run: cmd, oppure accessories command prompt) cd C:\...\esepsp loadpsp replace user user/pwd@oracle1.cli.di.unipi.it/oracle1 provapsp.psp "provapsp.psp": procedure "..." created. Test: oracle1.cli.di.unipi.it/pls/user.provapsp Verifica: dentro sqlplus worksheet scrivete: describe provapsp il sistema risponde: PROCEDURE provapsp

IL FILE GENERATO create or replace PROCEDURE provapsp AS BEGIN NULL; htp.prn(' <HTML> <HEAD><TITLE>Mostra studenti </TITLE></HEAD> <BODY> <H1>Elenco studenti </H1> <TABLE> <TR> <TD> <I><font size=+1> Cognome </font></i> </TD> <TD> <I><font size=+1> Nome </font></i> </TD> </TR> '); for studente in (select nome, cognome from studenti) loop htp.prn(' <TR> <TD> '); htp.prn(studente.cognome); htp.prn(' </TD> <TD> '); htp.prn(studente.nome); htp.prn(' </TD> </TR> '); end loop; htp.prn(' </TABLE> </BODY> </HTML> '); END;

PARAMETRO PSP <%@ page language="pl/sql" %> <%@ plsql parameter="ilcognome" %> <HTML><HEAD><TITLE>Mostra studenti</title></head> <BODY> <H1>Elenco studenti </H1> <TABLE> <TR> <TD> <I> </I> </TD> </TR> <% for studente in (select nome, cognome from studenti s where (ilcognome is null or s.cognome like ilcognome)) loop %> <TR> <TD> </TD> </TR> <% end loop; %> </TABLE> </BODY> </HTML>

COMPILATE provaparpsp.psp Guardate provaparpsp.psp Aprite provaparpsp.psp con Notepad o Wordpad Compilatelo loadpsp replace user user/pwd@oracle1.cli.di.unipi.it/oracle1 file.psp...psp": procedure "..." created.

TEST //oracle1.cli.di.unipi.it/pls/user.provaparpsp Errore //or.../pls/user.provaparpsp?ilcognome=mando Successo //.../pls/user.provaparpsp?ilcognome= Mostra il contenuto della tabella

ESERCIZI Modificate le procedure per mostrare anche l età Costruire una pagina parametrica che, ricevuto in input nomeproc, visualizzi in una tabella il risultato della query: SELECT Line, Text FROM User_source WHERE Name = nomeproc