![]() |
CORSO DI JSP |
![]() |
<< Indice
FAQ su Java/JSP e Oracle


$CATALINA_HOME/webapps/applicazione/WEB-INF/classes/pack1in CLASSPATH citare solo
$CATALINA_HOME/webapps/applicazione/WEB-INF/classes/


create table tab( campo1 varchar2(10), ... constraint pk_tab primary key (id) using index tablespace INDX );oppure separatamente dalla istruzione di create:
create index indice1 on tabella(campo) tablespace INDX; alter table tab add constraint un_1 unique(campo1, campo2) using index tablespace INDX;Se non viene specificato, l'indice occupa spazio nel medesimo table space della tabella. E' dunque buona norma tenere separati gli indici dalle tabelle.



OK - Reloaded application at context path /olimpiadiSe username/password non vanno bene, li potete trovare nel file tomcat/conf/tomcat-users.xml.

conn = DriverManager.getConnection(url,nome,pass); Statement stmt1 = conn.createStatement(); Statement stmt2 = conn.createStatement();




CREATE OR REPLACE PROCEDURE Updatecategorie (p_idcategoria IN NUMBER, p_descr IN VARCHAR) AS BEGIN UPDATE CATEGORIE SET descr = p_descr WHERE idcategoria = p_idcategoria; COMMIT; END; /
Per una SP che ha un parametro di uscita invece
PL/SQL:
create function snuffed_it_when (VARCHAR) returns integer '
declare
poet_id NUMBER;
poet_age NUMBER;
begin
-- first get the id associated with the poet.
SELECT id INTO poet_id FROM poets WHERE name = $1;
-- get and return the age.
SELECT age INTO poet_age FROM deaths WHERE mort_id = poet_id;
return age;
end;
JSP
connection.setAutoCommit(false);
CallableStatement proc =
connection.prepareCall("{ ? = call snuffed_it_when(?) }");
proc.registerOutParameter(1, Types.INTEGER);
proc.setString(2, poetName);
cs.execute();
int age = proc.getInt(2);
Notate l'uso di registerOutParameter per dichiarare il tipo della variabile ritornata (per l'allocazione) e
l'istruzione che permette di leggere il risultato proc.getInt.
Ulteriori dettagli in http://www.onjava.com









