CODE
Oracle Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
PSOUG Home Code Snippets Oracle Reference Oracle Functions PSOUG Forum Oracle Blogs Bookmark and Share
 
 Search the Reference Library pages:  

Free
Oracle Magazine
Subscriptions
and Oracle White Papers

Oracle Java Functions
Version 11.1
 
General
Note: This page is dedicated to Java functions I have found on the web with attribution for their authors. Have you written or found an interesting one? If so please email it to me and I will be glad to post it with attribution.
Dependent Objects
association$    
dba_associations all_associations user_associations
dba_ustats all_ustats user_ustats
Related System Privileges create
 
Demos

Query to retrieve $ORACLE_HOME
From Chris Poole
Sydney, Australia
On OTN 07-Jan-2008
CREATE OR REPLACE FUNCTION get_java_system_property (prop IN VARCHAR2) RETURN VARCHAR2 IS LANGUAGE JAVA
name 'java.lang.System.getProperty(java.lang.String) return java.lang.String';
/

SELECT object_type
FROM user_objects
WHERE object_name = 'GET_JAVA_SYSTEM_PROPERTY';

CREATE OR REPLACE VIEW v$oracle_home AS
SELECT get_java_system_property('user.dir') AS oracle_home
FROM dual;

SELECT * FROM v$oracle_home;
 
Demos

Multivalue view developed by Tom Starr of PSOUG based on Chris Poole's code above. 20-Mar-2008
CREATE OR REPLACE VIEW v$system_properties AS
SELECT cast('User''s current working directory (ORACLE_HOME)' AS 
varchar2(46)) as PROPERTY_NAME,
get_java_system_property('user.dir') AS PROPERTY_VALUE
FROM DUAL
UNION ALL SELECT 'Java Runtime Environment version', 
get_java_system_property('java.version') FROM DUAL
UNION ALL SELECT 'Java Runtime Environment vendor', 
get_java_system_property('java.vendor') FROM DUAL
UNION ALL SELECT 'Java vendor URL', 
get_java_system_property('java.vendor.url') FROM DUAL
UNION ALL SELECT 'Java installation directory', 
get_java_system_property('java.home') FROM DUAL
UNION ALL SELECT 'Java Virtual Machine specification version', 
get_java_system_property('java.vm.specification.version') FROM DUAL
UNION ALL SELECT 'Java Virtual Machine specification vendor', 
get_java_system_property('java.vm.specification.vendor') FROM DUAL
UNION ALL SELECT 'Java Virtual Machine specification name', 
get_java_system_property('java.vm.specification.name') FROM DUAL
UNION ALL SELECT 'Java Virtual Machine implementation version', 
get_java_system_property('java.vm.version') FROM DUAL
UNION ALL SELECT 'Java Virtual Machine implementation vendor', 
get_java_system_property('java.vm.vendor') FROM DUAL
UNION ALL SELECT 'Java Virtual Machine implementation name', 
get_java_system_property('java.vm.name') FROM DUAL
UNION ALL SELECT 'Java Runtime Environment specification version', 
get_java_system_property('java.specification.version') FROM DUAL
UNION ALL SELECT 'Java Runtime Environment specification vendor', 
get_java_system_property('java.specification.vendor') FROM DUAL
UNION ALL SELECT 'Java Runtime Environment specification name', 
get_java_system_property('java.specification.name') FROM DUAL
UNION ALL SELECT 'Java class format version number', 
get_java_system_property('java.class.version') FROM DUAL
UNION ALL SELECT 'Java class path', 
get_java_system_property('java.class.path') FROM DUAL
UNION ALL SELECT 'List of paths to search when loading libraries', 
get_java_system_property('java.library.path') FROM DUAL
UNION ALL SELECT 'Default temp file path', 
get_java_system_property('java.io.tmpdir') FROM DUAL
UNION ALL SELECT 'Name of JIT compiler to use', 
get_java_system_property('java.compiler') FROM DUAL
UNION ALL SELECT 'Path of extension directory or directories', 
get_java_system_property('java.ext.dirs') FROM DUAL
UNION ALL SELECT 'Operating system name', 
get_java_system_property('os.name') FROM DUAL
UNION ALL SELECT 'Operating system architecture', 
get_java_system_property('os.arch') FROM DUAL
UNION ALL SELECT 'Operating system version', 
get_java_system_property('os.version') FROM DUAL
UNION ALL SELECT 'File separator ("/" on UNIX)', 
get_java_system_property('file.separator') FROM DUAL
UNION ALL SELECT 'Path separator (":" on UNIX)', 
get_java_system_property('path.separator') FROM DUAL
UNION ALL SELECT 'Line separator (" " on UNIX)', 
get_java_system_property('line.separator') FROM DUAL
UNION ALL SELECT 'User''s account name', 
get_java_system_property('user.name') FROM DUAL
UNION ALL SELECT 'User''s home directory', 
get_java_system_property('user.home') FROM DUAL
/

col property_value format a60

SELECT * FROM v$system_properties
ORDER BY 1;
 
Related Topics
Functions
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us [100 users online]    © 2010 psoug.org