HexaBridge - Oracle Compatibility for PostgreSQL
HexaBridge brings Oracle's types, functions, and packages to Community PostgreSQL - no commercial fork required. The deepest Oracle compatibility layer available.
Industry-Leading Oracle Compatibility
Most Oracle compatibility solutions for PostgreSQL cover only basic functions like NVL, SUBSTR, and DBMS_OUTPUT - typically around 70-80 routines across a handful of packages. Commercial alternatives extend this to approximately 500 routines across 30 packages, but require you to purchase an expensive proprietary fork of PostgreSQL.
HexaBridge delivers over 1,100 routines across 45 Oracle packages - more than double the coverage of any commercial alternative - and it runs on Community PostgreSQL as-is. No proprietary database fork required. From DBMS_SCHEDULER and DBMS_SQL to DBMS_XMLDOM and DBMS_REDACT, HexaBridge covers the packages that real-world Oracle applications actually depend on.
The compatibility no AI or migration tool can generate
AI and migration tools convert your schema and application code, but they cannot recreate the source database's built-in routines on PostgreSQL. HexaBridge provides exactly that runtime compatibility, so HexaRocket can achieve 100% automatic schema conversion. Without this layer, every built-in function your application relies on becomes a manual rewrite that no tool can fully automate.
Works on Community PostgreSQL - No Proprietary Fork Required
Unlike other Oracle compatibility solutions that require a commercial PostgreSQL fork, HexaBridge is a standard PostgreSQL extension that installs on Community PostgreSQL with a simple CREATE EXTENSION command.
HexaBridge is available to customers who migrate their databases using HexaRocket, and to customers of HexaCluster-approved partners. Contact us to learn how HexaBridge can accelerate your Oracle-to-PostgreSQL migration.
Oracle-Compatible Types
17 types including VARCHAR2, NUMBER, DATE, CLOB, BLOB, XMLTYPE, BFILE, RAW
Oracle-Compatible Functions
115+ standalone functions - NVL, DECODE, TO_CHAR, SUBSTR, REGEXP_*, SYS_CONTEXT, and more
Oracle Packages
45 packages with 1,100+ routines - DBMS_SCHEDULER, DBMS_SQL, UTL_HTTP, DBMS_CRYPTO, and more
How It Works
-- Install HexaBridge on Community PostgreSQL
CREATE EXTENSION hexabridge;
-- Set search path for bare-name access
SET search_path TO oracle, public;
-- Use Oracle functions naturally
SELECT NVL(column1, 'default') FROM my_table;
SELECT DBMS_RANDOM.value(1, 100);
SELECT UTL_HTTP.request('https://api.example.com/data');Oracle-Compatible Data Types
HexaBridge provides 17 Oracle-compatible data types that behave identically to their Oracle counterparts - including strict byte/character length enforcement, Oracle NULL semantics, and Oracle-style arithmetic.
All types are created in the oracle schema. With SET search_path TO oracle, public;, they can be used by bare name - just like in Oracle.
Oracle-Compatible Standalone Functions
HexaBridge provides 115+ standalone Oracle-compatible functions that follow Oracle's exact semantics - including Oracle's NULL/empty-string equivalence, format models, and edge-case behaviors.
String / Character(31)
substr(str, pos [, len])Oracle-compatible substring. Position 0 treated as 1, negative position counts from end, empty string returns NULL.substr(str, pos [, len])Oracle-compatible substring. Position 0 treated as 1, negative position counts from end, empty string returns NULL.substr2(str, pos [, len])Substring using UCS-2 code unit positions.substr2(str, pos [, len])Substring using UCS-2 code unit positions.substr4(str, pos [, len])Substring using Unicode code point positions.substr4(str, pos [, len])Substring using Unicode code point positions.substrb(str, pos [, len])Byte-level substring. Partial multi-byte characters at boundaries replaced with spaces.substrb(str, pos [, len])Byte-level substring. Partial multi-byte characters at boundaries replaced with spaces.substrc(str, pos [, len])Substring using Unicode complete character (grapheme cluster) positions.substrc(str, pos [, len])Substring using Unicode complete character (grapheme cluster) positions.instr(str, pattern [, pos [, nth]])Oracle-compatible string search. Supports nth occurrence and negative position (backward search).instr(str, pattern [, pos [, nth]])Oracle-compatible string search. Supports nth occurrence and negative position (backward search).instrb(str, pattern [, pos [, nth]])Like INSTR but positions are in bytes, not characters.instrb(str, pattern [, pos [, nth]])Like INSTR but positions are in bytes, not characters.length(str)Character length with Oracle empty-string-is-NULL semantics.length(str)Character length with Oracle empty-string-is-NULL semantics.length2(str)String length in UCS-2 code units.length2(str)String length in UCS-2 code units.length4(str)String length in Unicode code points.length4(str)String length in Unicode code points.lengthb(str)Byte length with Oracle empty-string-is-NULL semantics.lengthb(str)Byte length with Oracle empty-string-is-NULL semantics.lengthc(str)String length in Unicode complete characters (grapheme clusters).lengthc(str)String length in Unicode complete characters (grapheme clusters).ltrim(str [, set])Left trim with Oracle empty-string-is-NULL semantics.ltrim(str [, set])Left trim with Oracle empty-string-is-NULL semantics.rtrim(str [, set])Right trim with Oracle empty-string-is-NULL semantics.rtrim(str [, set])Right trim with Oracle empty-string-is-NULL semantics.lpad(str, len [, pad])Left pad with Oracle empty-string-is-NULL semantics.lpad(str, len [, pad])Left pad with Oracle empty-string-is-NULL semantics.rpad(str, len [, pad])Right pad with Oracle empty-string-is-NULL semantics.rpad(str, len [, pad])Right pad with Oracle empty-string-is-NULL semantics.concat(str1, str2)2-arg concatenation. NULL treated as empty, empty result returns NULL.concat(str1, str2)2-arg concatenation. NULL treated as empty, empty result returns NULL.replace(str, search [, repl])Replaces all occurrences. 2-arg form deletes matches. NULL search returns str unchanged.replace(str, search [, repl])Replaces all occurrences. 2-arg form deletes matches. NULL search returns str unchanged.translate(str, from, to)Character-by-character translation.translate(str, from, to)Character-by-character translation.reverse(str)Reverses the character order.reverse(str)Reverses the character order.upper(str)Converts to uppercase.upper(str)Converts to uppercase.lower(str)Converts to lowercase.lower(str)Converts to lowercase.initcap(str)Capitalizes the first letter of each word.initcap(str)Capitalizes the first letter of each word.ascii(str)Returns the ASCII code of the first character.ascii(str)Returns the ASCII code of the first character.chr(n)Returns the character for the given ASCII code.chr(n)Returns the character for the given ASCII code.nls_upper(str [, nls_param])Locale-aware uppercase conversion with optional NLS_SORT collation.nls_upper(str [, nls_param])Locale-aware uppercase conversion with optional NLS_SORT collation.nls_lower(str [, nls_param])Locale-aware lowercase conversion with optional NLS_SORT collation.nls_lower(str [, nls_param])Locale-aware lowercase conversion with optional NLS_SORT collation.nls_initcap(str [, nls_param])Locale-aware initial capitalization.nls_initcap(str [, nls_param])Locale-aware initial capitalization.nlssort(str [, nls_param])Returns binary collation sort key. Supports NLS_SORT = BINARY and locale-based sorting.nlssort(str [, nls_param])Returns binary collation sort key. Supports NLS_SORT = BINARY and locale-based sorting.asciistr(str)Converts non-ASCII characters to \XXXX Unicode escape sequences.asciistr(str)Converts non-ASCII characters to \XXXX Unicode escape sequences.unistr(str)Converts \xxxx Unicode escape sequences to text.unistr(str)Converts \xxxx Unicode escape sequences to text.Numeric / Math(22)
abs(n)Absolute value. Overloaded for numeric, double precision, integer, bigint.abs(n)Absolute value. Overloaded for numeric, double precision, integer, bigint.ceil(n)Smallest integer >= n.ceil(n)Smallest integer >= n.floor(n)Largest integer <= n.floor(n)Largest integer <= n.mod(n2, n1)Modulus with Oracle zero-divisor semantics: mod(x, 0) returns x instead of error.mod(n2, n1)Modulus with Oracle zero-divisor semantics: mod(x, 0) returns x instead of error.remainder(n2, n1)IEEE 754 remainder with banker's rounding (round half to even).remainder(n2, n1)IEEE 754 remainder with banker's rounding (round half to even).power(n, e)n raised to the eth power.power(n, e)n raised to the eth power.sqrt(n)Square root.sqrt(n)Square root.exp(n)e raised to the nth power.exp(n)e raised to the nth power.ln(value)Natural logarithm. Overloaded for numeric and double precision.ln(value)Natural logarithm. Overloaded for numeric and double precision.log(base, value)Logarithm with specified base.log(base, value)Logarithm with specified base.sign(n)Returns -1, 0, or 1.sign(n)Returns -1, 0, or 1.sin(n)Sine (argument in radians).sin(n)Sine (argument in radians).cos(n)Cosine (argument in radians).cos(n)Cosine (argument in radians).tan(n)Tangent (argument in radians).tan(n)Tangent (argument in radians).asin(n)Arc sine (returns radians).asin(n)Arc sine (returns radians).acos(n)Arc cosine (returns radians).acos(n)Arc cosine (returns radians).atan(n)Arc tangent (returns radians).atan(n)Arc tangent (returns radians).atan2(y, x)Arc tangent of y/x (returns radians).atan2(y, x)Arc tangent of y/x (returns radians).sinh(n)Hyperbolic sine. Adds numeric overload.sinh(n)Hyperbolic sine. Adds numeric overload.cosh(n)Hyperbolic cosine. Adds numeric overload.cosh(n)Hyperbolic cosine. Adds numeric overload.tanh(n)Hyperbolic tangent. Adds numeric overload.tanh(n)Hyperbolic tangent. Adds numeric overload.bitand(n1, n2)Bitwise AND of two numeric values, truncating fractional parts first.bitand(n1, n2)Bitwise AND of two numeric values, truncating fractional parts first.Date / Time(18)
sysdate()Returns current statement start time as timestamp.sysdate()Returns current statement start time as timestamp.systimestamp()Returns current statement start time as timestamp with time zone.systimestamp()Returns current statement start time as timestamp with time zone.add_months(date, integer)Adds N months with Oracle end-of-month snapping behavior.add_months(date, integer)Adds N months with Oracle end-of-month snapping behavior.last_day(date)Returns the last day of the month containing the given date.last_day(date)Returns the last day of the month containing the given date.months_between(date, date)Returns fractional number of months between two dates (31-day basis).months_between(date, date)Returns fractional number of months between two dates (31-day basis).next_day(date, text)Returns the next occurrence of the named weekday after the given date.next_day(date, text)Returns the next occurrence of the named weekday after the given date.round(date [, text])Rounds a date to the nearest unit (CC, YYYY, Q, MM, WW, DD, DAY, etc.).round(date [, text])Rounds a date to the nearest unit (CC, YYYY, Q, MM, WW, DD, DAY, etc.).trunc(date [, text])Truncates a date to the start of the specified unit.trunc(date [, text])Truncates a date to the start of the specified unit.new_time(date, tz1, tz2)Converts a timestamp between timezones using Oracle's 18 fixed abbreviations.new_time(date, tz1, tz2)Converts a timestamp between timezones using Oracle's 18 fixed abbreviations.dbtimezone()Returns the database timezone.dbtimezone()Returns the database timezone.sessiontimezone()Returns the session timezone.sessiontimezone()Returns the session timezone.sys_extract_utc(tstz)Extracts the UTC equivalent of a timestamp with time zone.sys_extract_utc(tstz)Extracts the UTC equivalent of a timestamp with time zone.tz_offset(region)Returns the current UTC offset for a timezone region as +/-HH:MI.tz_offset(region)Returns the current UTC offset for a timezone region as +/-HH:MI.from_tz(ts, tz)Attaches a timezone to a plain timestamp.from_tz(ts, tz)Attaches a timezone to a plain timestamp.numtodsinterval(n, unit)Converts a number to a DAY TO SECOND interval.numtodsinterval(n, unit)Converts a number to a DAY TO SECOND interval.numtoyminterval(n, unit)Converts a number to a YEAR TO MONTH interval.numtoyminterval(n, unit)Converts a number to a YEAR TO MONTH interval.to_yminterval(text)Converts a string to a YEAR TO MONTH interval. Accepts SQL and ISO 8601 formats.to_yminterval(text)Converts a string to a YEAR TO MONTH interval. Accepts SQL and ISO 8601 formats.to_dsinterval(text [, nls])Converts a string to a DAY TO SECOND interval. Accepts SQL and ISO 8601 formats.to_dsinterval(text [, nls])Converts a string to a DAY TO SECOND interval. Accepts SQL and ISO 8601 formats.Conversion(12)
to_char(value, format [, nls])Formats datetime or numeric values as text. 11 overloads covering all types. Translates Oracle-specific format tokens (RR, RRRR, SYYYY, TZR, TZD).to_char(value, format [, nls])Formats datetime or numeric values as text. 11 overloads covering all types. Translates Oracle-specific format tokens (RR, RRRR, SYYYY, TZR, TZD).to_date(text, format [, nls])Parses a date string into timestamp. Supports RR/RRRR century windowing.to_date(text, format [, nls])Parses a date string into timestamp. Supports RR/RRRR century windowing.to_timestamp(text, fmt [, nls])Parses a string into timestamp without time zone. Supports FF1-FF9 fractional seconds.to_timestamp(text, fmt [, nls])Parses a string into timestamp without time zone. Supports FF1-FF9 fractional seconds.to_timestamp_tz(text, fmt [, nls])Parses a string into timestamp with time zone. Supports TZR/TZD/TZH:TZM elements.to_timestamp_tz(text, fmt [, nls])Parses a string into timestamp with time zone. Supports TZR/TZD/TZH:TZM elements.to_binary_double(expr [, fmt [, nls]])Converts to double precision (Oracle BINARY_DOUBLE). Handles 'INF', '-INF', 'NaN'.to_binary_double(expr [, fmt [, nls]])Converts to double precision (Oracle BINARY_DOUBLE). Handles 'INF', '-INF', 'NaN'.to_binary_float(expr [, fmt [, nls]])Converts to real (Oracle BINARY_FLOAT). Handles 'INF', '-INF', 'NaN'.to_binary_float(expr [, fmt [, nls]])Converts to real (Oracle BINARY_FLOAT). Handles 'INF', '-INF', 'NaN'.hextoraw(hex)Converts a hexadecimal string to bytea (Oracle RAW). Case-insensitive.hextoraw(hex)Converts a hexadecimal string to bytea (Oracle RAW). Case-insensitive.rawtohex(raw)Converts bytea (Oracle RAW) to an uppercase hexadecimal string.rawtohex(raw)Converts bytea (Oracle RAW) to an uppercase hexadecimal string.to_single_byte(str)Converts fullwidth characters to halfwidth (UTF-8).to_single_byte(str)Converts fullwidth characters to halfwidth (UTF-8).to_multi_byte(str)Converts halfwidth characters to fullwidth (UTF-8).to_multi_byte(str)Converts halfwidth characters to fullwidth (UTF-8).convert(src, dest_charset [, source_charset])Character set conversion using Oracle charset names (AL32UTF8, WE8ISO8859P1, etc.).convert(src, dest_charset [, source_charset])Character set conversion using Oracle charset names (AL32UTF8, WE8ISO8859P1, etc.).validate_conversion(expr, type_name [, fmt [, nlsparam]])Returns 1 if expr can be converted to type_name, 0 otherwise. Accepts Oracle type names.validate_conversion(expr, type_name [, fmt [, nlsparam]])Returns 1 if expr can be converted to type_name, 0 otherwise. Accepts Oracle type names.NULL / Conditional(7)
nvl(expr1, expr2)Returns expr1 if not NULL, otherwise expr2. Polymorphic - works with any data type.nvl(expr1, expr2)Returns expr1 if not NULL, otherwise expr2. Polymorphic - works with any data type.nvl2(expr1, expr2, expr3)If expr1 IS NOT NULL returns expr2, else expr3.nvl2(expr1, expr2, expr3)If expr1 IS NOT NULL returns expr2, else expr3.nanvl(n1, n2)Returns n2 if n1 is NaN, otherwise returns n1.nanvl(n1, n2)Returns n2 if n1 is NaN, otherwise returns n1.lnnvl(condition)Returns TRUE if condition is FALSE or NULL.lnnvl(condition)Returns TRUE if condition is FALSE or NULL.decode(expr, s1, r1 [, s2, r2, ...] [, default])Oracle-compatible conditional expression. Unlike CASE, treats NULL=NULL as true.decode(expr, s1, r1 [, s2, r2, ...] [, default])Oracle-compatible conditional expression. Unlike CASE, treats NULL=NULL as true.greatest(expr, ...)Returns greatest value. Unlike PG built-in, returns NULL if ANY argument is NULL.greatest(expr, ...)Returns greatest value. Unlike PG built-in, returns NULL if ANY argument is NULL.least(expr, ...)Returns least value. Unlike PG built-in, returns NULL if ANY argument is NULL.least(expr, ...)Returns least value. Unlike PG built-in, returns NULL if ANY argument is NULL.Regular Expressions(5)
regexp_like(src, pattern [, modifier])Oracle-compatible regex match test. Translates Oracle match flags to PG equivalents.regexp_like(src, pattern [, modifier])Oracle-compatible regex match test. Translates Oracle match flags to PG equivalents.regexp_instr(src, pattern [, pos [, occ [, retopt [, mod [, subexpr]]]]])Returns position of regex match (1-based). Supports occurrence, return_option, subexpression.regexp_instr(src, pattern [, pos [, occ [, retopt [, mod [, subexpr]]]]])Returns position of regex match (1-based). Supports occurrence, return_option, subexpression.regexp_substr(src, pattern [, pos [, occ [, mod [, subexpr]]]])Extracts substring matching regex. Supports occurrence and subexpression capture groups.regexp_substr(src, pattern [, pos [, occ [, mod [, subexpr]]]])Extracts substring matching regex. Supports occurrence and subexpression capture groups.regexp_replace(src, pattern [, repl [, pos [, occ [, mod]]]])Regex-based string replacement. Default replaces all occurrences (Oracle semantics).regexp_replace(src, pattern [, repl [, pos [, occ [, mod]]]])Regex-based string replacement. Default replaces all occurrences (Oracle semantics).regexp_count(src, pattern [, pos [, modifier]])Counts non-overlapping regex matches.regexp_count(src, pattern [, pos [, modifier]])Counts non-overlapping regex matches.Aggregate / Statistical(7)
listagg(expr [, delimiter])Concatenates values into a string with optional delimiter. Supports DISTINCT and ORDER BY.listagg(expr [, delimiter])Concatenates values into a string with optional delimiter. Supports DISTINCT and ORDER BY.median(expr)Returns the median value. Equivalent to percentile_cont(0.5) but simpler syntax.median(expr)Returns the median value. Equivalent to percentile_cont(0.5) but simpler syntax.stats_mode(expr)Returns the most frequently occurring value. Ties resolved by lowest value.stats_mode(expr)Returns the most frequently occurring value. Ties resolved by lowest value.skewness_pop(expr)Population skewness (third standardized moment).skewness_pop(expr)Population skewness (third standardized moment).skewness_samp(expr)Sample skewness (adjusted Fisher-Pearson coefficient).skewness_samp(expr)Sample skewness (adjusted Fisher-Pearson coefficient).kurtosis_pop(expr)Population excess kurtosis (fourth standardized moment minus 3).kurtosis_pop(expr)Population excess kurtosis (fourth standardized moment minus 3).kurtosis_samp(expr)Sample excess kurtosis (G2 estimator).kurtosis_samp(expr)Sample excess kurtosis (G2 estimator).Environment / Session(4)
sys_context(namespace, attribute [, length])Oracle-compatible session info retrieval. Supports USERENV namespace (SESSION_USER, CURRENT_USER, DB_NAME, IP_ADDRESS, SID, ISDBA, MODULE, ACTION, NLS_*, etc.) and custom namespaces.sys_context(namespace, attribute [, length])Oracle-compatible session info retrieval. Supports USERENV namespace (SESSION_USER, CURRENT_USER, DB_NAME, IP_ADDRESS, SID, ISDBA, MODULE, ACTION, NLS_*, etc.) and custom namespaces.sys_guid()Generates a globally unique 32-character uppercase hex identifier (RAW(16)). Cryptographic random.sys_guid()Generates a globally unique 32-character uppercase hex identifier (RAW(16)). Cryptographic random.uid()Returns the numeric user ID of the session user (PG role OID).uid()Returns the numeric user ID of the session user (PG role OID).userenv(parameter)Legacy session environment info function. Supports LANGUAGE, ISDBA, LANG, SESSIONID, SID, INSTANCE, TERMINAL, CLIENT_INFO.userenv(parameter)Legacy session environment info function. Supports LANGUAGE, ISDBA, LANG, SESSIONID, SID, INSTANCE, TERMINAL, CLIENT_INFO.Hash / Cryptographic(3)
ora_hash(expr [, max_bucket [, seed]])Hash function returning bigint in [0, max_bucket]. Default max_bucket=4294967295.ora_hash(expr [, max_bucket [, seed]])Hash function returning bigint in [0, max_bucket]. Default max_bucket=4294967295.standard_hash(expr [, method])Cryptographic hash (SHA1, SHA256, SHA384, SHA512, MD5). Default SHA1. Output matches Oracle.standard_hash(expr [, method])Cryptographic hash (SHA1, SHA256, SHA384, SHA512, MD5). Default SHA1. Output matches Oracle.dump(expr [, fmt [, start_position [, length]]])Returns internal representation of a value. Supports octal, decimal, hex, char formats.dump(expr [, fmt [, start_position [, length]]])Returns internal representation of a value. Supports octal, decimal, hex, char formats.JSON(2)
json_mergepatch(target, patch)RFC 7396 JSON Merge Patch. Recursively merges two JSON documents.json_mergepatch(target, patch)RFC 7396 JSON Merge Patch. Recursively merges two JSON documents.json_equal(json1, json2)Semantic JSON equality comparison (key order and whitespace ignored).json_equal(json1, json2)Semantic JSON equality comparison (key order and whitespace ignored).LOB(2)
empty_blob()Returns an empty bytea (equivalent to Oracle's empty BLOB locator).empty_blob()Returns an empty bytea (equivalent to Oracle's empty BLOB locator).empty_clob()Returns an empty text (equivalent to Oracle's empty CLOB locator).empty_clob()Returns an empty text (equivalent to Oracle's empty CLOB locator).Oracle-Compatible Packages
HexaBridge implements 45 Oracle packages with over 1,100 routines - covering database administration, security, networking, file I/O, XML processing, job scheduling, data redaction, and more. Each package mirrors the Oracle API so that existing Oracle PL/SQL code works with minimal changes on PostgreSQL.
Database Administration
Security & Access Control
Networking & I/O
Data Types & LOBs
Utilities
Web / HTML
Job Scheduling & Queuing
Get HexaBridge for Your Migration
HexaBridge is available to customers who migrate their databases using HexaRocket, and to customers of HexaCluster-approved partners. We may open-source HexaBridge in the future - but you don't have to wait. Contact us today and we'll help you get started.
No proprietary PostgreSQL fork required. HexaBridge works as-is on Community PostgreSQL.

