Reputation: 243
I need to write a PL/SQL bloc that executes an sql file. the thing is that the name of the sql file is determined at the execution time.
This is a snippet of what i'm trying to do here :
begin
@'OracleV5\'||DBMS_DB_VERSION.VERSION||'g\script.sql';
end;
/
PL/SQL doesn't seem to accept this kind of code :-(
any help please?
Upvotes: 0
Views: 4338
Reputation: 10541
The PLSQL block is executed in the database. The problem is how to access the SQL file and execute it's contents. The file needs to be in a location where the database has access to it. You can then create a directory object to access the location and read the file content using utl_file or by opening the file as a Blob using Bfile.
(sorry for the very abstract answer but that's all I've got time for now)
Upvotes: 1