Primero, listamos los ficheros a utilizar en el ejemplo y mostramos en la pantalla el contenidos de sentencia.sql.
[monitor@DESA]ls sentencia.sql
sentencia.sql
Podemos ver que el fichero sentencia1.sql sólo contiene una sentencia SELECT 1 FROM DUAL la barra (/) para ejecutarla y el comando EXIT para indicar la salida del SQL*Plus.
[monitor@DESA]cat sentencia.sql
SELECT 1
FROM DUAL
/
EXIT
Para ejecutar este SELECT debemos invocar al SQL*Plus pasándole por parámetro el usuario (monitor) y la password (colopass) para conectarnos y arroba (@) el nombre del fichero (sentencia.sql) que contiene la sentencia SQL. Ejecutamos la línea donde se conecta, ejecuta el select, muestra una fila con el valor uno y se desconecta.
[monitor@DESA]sqlplus monitor/colopass07 @sentencia.sql
SQL*Plus: Release 9.2.0.8.0 - Production on Fri Sep 28 14:16:33 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
1
----------
1
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
No hay comentarios:
Publicar un comentario