Oracle Libraries
Version 26ai

General Information
Library Note Morgan's Library Page Header
The best Oracle News for FY2026

Oracle Database 26ai will be available on generic Linux platforms in January and soon on AIX and Windows
Purpose A library is a schema object associated with an operating-system shared library: For example a DLL.

You can use the name of the library schema object in the call specification (call_spec) of a CREATE FUNCTION or CREATE PROCEDURE statements, or when declaring a function or procedure in a package or type, allowing the function, package, procedure, or type to invoke a 3GL code in the library.
Dependencies
ALL_LIBRARIES DBA_LIBRARIES LIBRARIES$
CDB_LIBRARIES INT$DBA_LIBRARIES USER_LIBRARIES
System Privileges
ALTER ANY LIBRARY CREATE LIBRARY EXECUTE ANY LIBRARY
CREATE ANY LIBRARY DROP ANY LIBRARY  
Document Sections
 
CREATE LIBRARY
Create Library CREATE OR REPLACE [<EDITIONABLE | NONEDITIONABLE>] LIBRARY <[schema_name.]library_name> [TRUSTED] <AS | IS> STATIC;
conn uwclass/uwclass@pdbdev

CREATE OR REPLACE LIBRARY morgan AS STATIC;
/

CREATE OR REPLACE LIBRARY morgan TRUSTED AS STATIC;
/
Create a library with a hard-coded pointer (not recommended)  
CREATE OR REPLACE LIBRARY ext_lib AS '/OR/lib/ext_lib.so';
/
Create a library with a directory object pointer CREATE OR REPLACE LIBRARY <[schema_name.]library_name> AS <executable_nam,e> IN <directory_object_name>;
CREATE OR REPLACE DIRECTORY ext_code_dir AS 'c:\tmp';

CREATE OR REPLACE LIBRARY ext_lib AS 'morgan.so' IN ext_code_dir;

/
Create a library with a directory object pointer and a credential  
CREATE OR REPLACE LIBRARY ext_lib AS 'morgan.so' IN ext_code_dir CREDENTIAL uwcred;
/
Create Library with credenital and calling function CREATE OR REPLACE [<EDITIONABLE | NONEDITIONABLE>] LIBRARY <[schema_name.]library_name> <AS | IS>
'<full_path_name>' [AGENT '<agent_dblink_name>'] CREDENTIAL <[schema_name.]credential_name>;
conn uwclass/uwclass@pdbdev

DECLARE
 cname   user_credentials.credential_name%TYPE := 'UWCRED';
 uname   user_credentials.username%TYPE := 'UWCLASS';
 pwd     sys.scheduler$_credential.password%TYPE := 'ZzYzX6*';
 dbrole  VARCHAR2(30) := NULL;
 windom  sys.scheduler$_credential.domain%TYPE := NULL;
 comment user_credentials.comments%TYPE := 'Test Cred';
 enable  BOOLEAN := FALSE;
BEGIN
  dbms_credential.create_credential(cname, uname, pwd, dbrole, windom, comment, enable);
END;
/

SELECT credential_name
FROM user_credentials;

CREATE OR REPLACE LIBRARY morgan AS
'/app/oracle/ext_procs/morgan.so' CREDENTIAL uwcred;
/

CREATE OR REPLACE FUNCTION ftest1 (x VARCHAR2, y BINARY_INTEGER) RETURN BINARY_INTEGER AUTHID DEFINER
AS LANGUAGE C
LIBRARY morgan
NAME "iterate_x"
PARAMETERS(x STRING, y INT)
;
/
Create Library with Agent CREATE OR REPLACE [<EDITIONABLE | NONEDITIONABLE>] LIBRARY <[schema_name.]library_name> <AS | IS>
'<full_path_name>' AGENT '<agent_dblink_name>';
CREATE OR REPLACE LIBRARY morgan AS
'${ORACLE_HOME}/lib/morgan.so'
AGENT 'uwagent.mlib.org';

/
 
ALTER LIBRARY
Editionable / Noneditionable ALTER LIBRARY <[schema_name.]library_name>  <EDITIONABLE | NONEDITIONABLE>;
ALTER LIBRARY morgan EDITIONABLE;
Recompile ALTER LIBRARY <[schema_name.]library_name>  COMPILE [DEBUG] <parameter_name> = <parameter_value> [REUSE SETTINGS];
ALTER LIBRARY morgan COMPILE REUSE SETTINGS;
 
DROP LIBRARY
Drop a library object DROP LIBRARY <[schema_name.]library_name>;
DROP LIBRARY morgan;

Related Topics
Built-in Functions
Built-in Packages
Directories
DBMS_CREDENTIAL
Functions
Packages
Procedures
Types
What's New In 21c
What's New In 26ai

Morgan's Library Page Footer
This site is maintained by Daniel Morgan. Last Updated: This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2026 Daniel A. Morgan All Rights Reserved