SQL*Plus (MOSC)

MOSC Banner

Running dynamic scripts

edited Aug 24, 2012 5:50AM in SQL*Plus (MOSC) 4 commentsAnswered ✓
DB: Oraclle 11g
OS: AIX 6.1

I need to run sql scripts dynamically and build the following code in file script.sql:
declare
    i int;
    linha char(5);
    conexao char(50);
begin
    for i in 1..&&QUANT_LINHAS loop
        linha := substr('&&ORACLE_SID', 1, 3) || to_char(i);
        conexao := '/cmdlib/oracle/connect/' || '&&ORACLE_SID' || '/connect_' || trim(linha) || '.sql';
        @conexao;
    end loop;
end;
/

In define.sql I have:
DEFINE ORACLE_SID   = BRMB
DEFINE QUANT_LINHAS = 5

When I run the file script.sql get the following error:
SP2-0310: unable to open file "conexao.sql"

How can I fix this?

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center