Update a package from SQLPLUS
I'm trying to update a package in Oracle, coming from SQL Server this has been confusing.
I have written a batch file that runs the .spec file first and the .body file second, but even running it manually does not work.
I use this syntax:
sqlplus username/password@databasename @c开发者_开发百科:\temp\myfile.spec
sqlplus username/password@databasename @c:\temp\myfile.body
When I go back to Sql Developer I can look at the stored procedures in the package and see that they have not been updated.
Why aren't my packages getting updated?
The spec and body files need to have /
make SQL*Plus create/replace the object.
Without the /
:
CREATE OR REPLACE PACKAGE TEST12_13 AS
PROCEDURE TEST12_13;
END;
STAGE@DB>@C:\TEST.PKS
6
With the /
:
CREATE OR REPLACE PACKAGE TEST12_13 AS
PROCEDURE TEST12_13;
END;
/
STAGE@DB>@C:\TEST.PKS
Package created.
In reply to your comment about passing filename as parameter, instead of passing the filename as parameter, have SQL*Plus ask you for the filename
wrapper.sql
ACCEPT filename_var Prompt 'Enter filename'
@c:\temp\&filename_var
/
@c:\temp\&filename_var
/
Connect to SQL*Plus with
sqlplus username/password@databasename
Then run the script from the SQL*Plus prompt:
set echo on
@c:\temp\myfile.spec
You should be able to see whats going on like this, including any error messages.
精彩评论