Administración y Optimización de Bases de Datos Oracle
Copyright 1999-2004
Manuel de la Herrán Gascón
Acceso a Bases de Datos Oracle mediante Html, Pl/sql y WebDB
Configuración de Oracle WebDB 2.1 |
- webdb/webdb
- http://servidor:80/webDB/
- http://servidor:80/admin_/gateway.htm
- http://servidor:80/admin_/listener.htm
- c:\orant\bin\wdblsnr.exe /?
- c:\orant\bin\wdblsnr.exe -console servidor 80 stop
- c:\orant\bin\wdblsnr.exe -console servidor 81 start
- wdbsvr.cfg
Inicio
Configuración
Panel de Control
Oracle WebDB Listener
CREATE OR REPLACE PROCEDURE helloWorld IS
BEGIN
htp.print('<HTML>');
htp.print('<HEAD>');
htp.print('<TITLE>Ejemplo PL/SQL</TITLE>');
htp.print('</HEAD>');
htp.print('<BODY>');
htp.print('Hola');
htp.print('</BODY>');
htp.print('</HTML>');
END;
/
show errors
|
Creación mediante SQL * Plus |
Inicio
Programas
Oracle for Windows NT
SQL * Plus 8.0
http://servidor/WebDB/WEBDB.home
Build
Database Objects
Procedure
http://servidor/WebDB/scott.helloWorld
CREATE OR REPLACE PROCEDURE helloWorld2 IS
BEGIN
htp.htmlopen;
htp.headopen;
htp.title('helloWorld2');
htp.headclose;
htp.bodyOpen('/images/wsd.gif', 'text="#000088"');
htp.line;
htp.img('/images/home.gif');
htp.header(1,'helloWorld2');
htp.line;
htp.print('Hola');
htp.paragraph;
htp.anchor('/WebDB/WEBDB.home','Home');
htp.line;
htp.address('(c)2001 Reservados todos los derechos');
htp.bodyclose;
htp.htmlclose;
END;
/
show errors
|
http://servidor/WebDB/scott.helloWorld2
CREATE OR REPLACE PROCEDURE helloWorld3 IS
BEGIN
htp.htmlopen;
htp.headopen;
htp.title('helloWorld3');
htp.headclose;
htp.bodyOpen('/images/wsd.gif', 'text="#000088"');
htp.line;
htp.img('/images/home.gif');
htp.header(1,'helloWorld3');
htp.line;
If 1=2 Then
htp.print('Hola');
Else
htp.print('Adios');
End If;
htp.paragraph;
htp.anchor('/WebDB/WEBDB.home','Home');
htp.line;
htp.address('(c)2001 Reservados todos los derechos');
htp.bodyclose;
htp.htmlclose;
END;
/
show errors
|
http://servidor/WebDB/scott.helloWorld3
--Función que duplica la cantidad recibida como parámetro
CREATE OR REPLACE FUNCTION duplicador(
valor number
) RETURN number IS
BEGIN
return (valor * 2);
END;
/
show errors
--Función que llama a duplicador
CREATE OR REPLACE PROCEDURE helloWorld4 IS
BEGIN
htp.htmlopen;
htp.headopen;
htp.title('helloWorld4');
htp.headclose;
htp.bodyOpen('/images/wsd.gif', 'text="#000088"');
htp.header(1,'helloWorld4');
htp.print(duplicador(4));
htp.line;
htp.anchor('/WebDB/WEBDB.home','Home');
htp.bodyclose;
htp.htmlclose;
END;
/
show errors
|
http://servidor/WebDB/scott.helloWorld4
--Función que duplica la cantidad recibida como parámetro
CREATE OR REPLACE FUNCTION duplicador(
valor number
) RETURN number IS
BEGIN
return (valor * 2);
END;
/
show errors
--Interfaz de salida: función que llama a duplicador,
CREATE OR REPLACE PROCEDURE calculadoraSalida(
valor number
) IS
BEGIN
htp.htmlopen;
htp.headopen;
htp.title('calculadora');
htp.headclose;
htp.bodyOpen('/images/wsd.gif', 'text="#000088"');
htp.header(1,'Resultado de la calculadora');
htp.print(duplicador(valor));
htp.line;
htp.anchor('/WebDB/WEBDB.home',' [Home] ');
htp.anchor('/WebDB/scott.calculadoraEntrada',' [calculadoraEntrada] ');
htp.bodyclose;
htp.htmlclose;
END;
/
show errors
--Interfaz de entrada
CREATE OR REPLACE PROCEDURE calculadoraEntrada IS
BEGIN
htp.htmlopen;
htp.headopen;
htp.title('calculadoraEntrada');
htp.headclose;
htp.bodyOpen('/images/wsd.gif', 'text="#000088"');
htp.header(1,'calculadoraEntrada');
htp.print('<FORM ACTION="WEBDB.wwv_qbe_proc.exec" METHOD="POST">');
htp.print('<INPUT TYPE="hidden" NAME="p_owner" VALUE="SCOTT">');
htp.print('<INPUT TYPE="hidden" NAME="p_object" VALUE="CALCULADORASALIDA">');
htp.print('<INPUT TYPE="hidden" NAME="p_type" VALUE="PROCEDURE">');
htp.print('<INPUT TYPE="hidden" NAME="p_col_displays" VALUE="1">');
htp.print('<INPUT TYPE="hidden" NAME="p_data_types" VALUE="NUMBER">');
htp.print('<INPUT TYPE="hidden" NAME="p_col_names" VALUE="valor">');
htp.print('<INPUT TYPE="hidden" NAME="p_in_out" VALUE="IN">');
htp.print('<INPUT TYPE="text" NAME="p_curr_values" SIZE="8" MAXLENGTH="2000" VALUE="5">');
htp.print('<INPUT TYPE="submit" NAME="p_request" VALUE="Execute">');
htp.print('</FORM>');
htp.line;
htp.anchor('/WebDB/WEBDB.home',' [Home] ');
htp.anchor('/WebDB/scott.calculadoraEntrada',' [calculadoraEntrada] ');
htp.bodyclose;
htp.htmlclose;
END;
/
show errors
|
http://servidor/WebDB/scott.calculadoraSalida(6)
http://servidor/WebDB/scott.calculadoraSalida?valor=6
http://servidor/WebDB/scott.calculadoraEntrada
http://servidor/WebDB/WEBDB.home
Build
User Interface Components
Forms
On stored procedures
Este curso esta incluido en el CD-ROM de REDcientífica. Solicítalo por correo haciendo click aquí. http://www.redcientifica.com/cdrom/
|