Run script file directly in PLSQL

Asked

Viewed 6,120 times

1

I have a arquivo.sql, which has thousands of lines of scripts, containing, creations, changes, etc.

I need to run this file directly in PLSQL at SQL Window, and nay can be via Command Window.


Via Command Window, that way it works:

@c:\arquivo.sql


Via SQL Window, tried in the following ways, but without success:

1. By directly executing

@c:\arquivo.sql

Error:

ORA-00900: Invalid SQL statement

2. By executing directly

EXECUTE IMMEDIATE '@c:\arquivo.sql'

Error:

ORA-00900: Invalid SQL statement

3. Creating a precedent

CREATE OR REPLACE PROCEDURE p_run_script IS
BEGIN
  EXECUTE IMMEDIATE '@c:\arquivo.sql';
END p_run_script;
/
BEGIN
    p_run_script;
END;
/

Error:

ORA-00900: Invalid SQL statement ORA-06512: in
"P_RUN_SCRIPT", line 3 ORA-06512: in line 2

Observing: I cannot send this file to the server, nor create a directory on oracle, or use dbms_pipe.

It doesn’t have to be a script-complete answer, but if you only talk about what you search for it helps.

  • Running remotely? Using SQL Plus?

  • No, via plsql mesmo.. Vlw @Inq

  • It is only possible to do this via sql plus. I recommend you to create a precedent with your script.

1 answer

1

Good afternoon, I managed to do so:

1 - Opening the command window option

2 - SQL> @"c:\arquivo.sql"

Note that the "@" is out of quotation marks and does not have ";".

  • Thanks Odisley for the reply, but can not be Windows Vice Command :/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.