Tuesday, 22 July 2008

Wrap Oracle PLSQL Routine

This Windows command script uses Oracle's wrap utility to wrap the contents of an entire directory. The wrapped files are placed in a sub directory is created called "Wrapped", which is created if it doesn't exist.

Copy the following code into a file called "WrapDirectory.cmd".

@ECHO OFF

TITLE Wrap Directory

SET /p src="Enter Source Directory...: "
SET ora=E:\Oracle\DB10

IF NOT EXIST %src%\Wrapped MKDIR %src%\Wrapped

TITLE Wrapping Directory

FOR %%F IN (%src%\*.sql) DO CALL %ora%\Bin\WRAP INAME=%%F ONAME=%%~dpF\Wrapped\%%~nF.plb >> %%~dpF\Wrapped\wrap.log

TITLE Wrapped Directory

PAUSE

The Oracle home directory needs to be configured to your own home, before it can be run. It can also be easily modified to wrap files other than ".sql" which it currently does.

This has been been written and tested against Oracle 10g.

PLSQL Files... Wrapped.

No comments: