views:

71

answers:

1
BEGIN
  dbms_output.put_line('Welcome to PL/SQL');
END;
/

I have this code in sample.sql file.
How to run sample.sql?

+8  A: 

You can run it using SQL*Plus (using your username/password and the name of your instance):

sqlplus username/password@instance @ sample.sql

Another way would be to download free SQL Developer from Oracle, open and execute the file there.


Note that the text will not be displayed per default, you need to enable the output before.

Put the following line into your file as first line:

SET SERVEROUTPUT ON
Peter Lang
It's better to put the connect string in the sql script, or to get the password through a environment variable; a command like the one Peter Lang showed reveals the password to anyone on the host with the `ps` command.
Adam Musch
@Adam: Excellent point, thanks.
Peter Lang