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

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

1 Answer 1

9

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
Sign up to request clarification or add additional context in comments.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.