I am preparing SQL scripts that can deploy a set of code to a target environment with minimal fuss. I want the executing DBA to just sign on to the target database and execute "install_release.sql". That file "includes" (via the "@" command, which is supported by SQL Developer) other scripts:
PROMPT Compile package specs...
PROMPT ...package A
@../../../path/to/packageA/spec.sql
PROMPT ...package B
@../../../path/to/packageB/spec.sql
PROMPT Compile package bodies...
PROMPT ...package A
@../../../path/to/packageA/body.sql
PROMPT ...package B
@../../../path/to/packageB/body.sql
This part of the process seem to work great.
However, each of the package bodies tries to include common, repeated, SQL snippets (for example, standard EXCEPTION declarations) that are to be included in the package's definition. As an example, "exception_declarations.sql" contains code like this:
EMPTY_PARAMTER EXCEPTION
INSUFFICIENT_ACCESS EXCEPTION
Whereas "packageA/body.sql" contains code like this:
CREATE OR REPLACE PACKAGE BODY My_Schema.PackageA AS
@../../../path/to/exception_declarations.sql
FUNCTION ETC(...etc...
When I attempt to execute "install_release.sql" as a script from SQL Developer, I can see from the resulting logs that the compiler follows the paths to compile the specs (no problem), and into the package bodies...but once inside the package bodies, it throws this error when attempting to execute @../../../path/to/exception_declarations.sql:
Encountered the symbol "@" when expecting on of the following: begin end function pragma procedure subtype type current cursor delete exists prior
Adding to the mystery, this exact same code compiles as expected (no error) when executed via SQL Plus (I'd just use SQL Plus, but I'm working remotely through a fairly locked-down virtual machine that wont let me install SQL Plus...but does let me "install" SQL Developer...it's complicated...I don't like talking about it because then the demons start to laugh at me).
What am I doing wrong here? Why will the compiler follow the pathing in set of scripts, but not from within the package body code? I assume it's because the @ command is embedded within the DDL...so...How can I get SQL Developer to compile code that includes code within the DDL?