Oracle SQL translation guide

This document details the similarities and differences in SQL syntax betweenOracle and BigQuery to help you plan your migration. Usebatch SQL translation tomigrate your SQL scripts in bulk, orinteractive SQL translationto translate ad-hoc queries.

Note: In some cases, there is no direct mapping between a SQL element in Oracleand BigQuery. However, in most cases, you can achieve the same functionality inBigQuery that you can in Oracle using an alternative means, as shown in theexamples in this document.

Data types

This section shows equivalents between data types in Oracle and inBigQuery.

OracleBigQueryNotes
VARCHAR2STRING
NVARCHAR2STRING
CHARSTRING
NCHARSTRING
CLOBSTRING
NCLOBSTRING
INTEGERINT64
SHORTINTEGERINT64
LONGINTEGERINT64
NUMBERNUMERICBigQuery does not allow user specification of custom values for precision or scale. As a result, a column in Oracle may be defined so that it has a bigger scale than BigQuery supports.

Additionally, before storing a decimal number Oracle rounds up if that number has more digits after the decimal point than is specified for the corresponding column. In BigQuery this feature could be implemented usingROUND() function.

NUMBER(*, x)NUMERICBigQuery does not allow user specification of custom values for precision or scale. As a result, a column in Oracle may be defined so that it has a bigger scale than BigQuery supports.

Additionally, before storing a decimal number Oracle rounds up if that number has more digits after the decimal point than is specified for the corresponding column. In BigQuery this feature could be implemented usingROUND() function.

NUMBER(x, -y)INT64If a user tries to store a decimal number, Oracle rounds it up to a whole number. For BigQuery an attempt to store a decimal number in a column defined asINT64 results in an error. In this case,ROUND() function should be applied.

BigQueryINT64 data types allow up to 18 digits of precision. If a number field has more than 18 digits,FLOAT64 data type should be used in BigQuery.

NUMBER(x)INT64If a user tries to store a decimal number, Oracle rounds it up to a whole number. For BigQuery an attempt to store a decimal number in a column defined asINT64 results in an error. In this case,ROUND() function should be applied.

BigQueryINT64 data types allow up to 18 digits of precision. If a number field has more than 18 digits,FLOAT64 data type should be used in BigQuery.

FLOATFLOAT64/NUMERICFLOAT is an exact data type, and it's aNUMBER subtype in Oracle. In BigQuery,FLOAT64 is an approximate data type.NUMERIC may be a better match forFLOAT type in BigQuery.
BINARY_DOUBLEFLOAT64/NUMERICFLOAT is an exact data type, and it's aNUMBER subtype in Oracle. In BigQuery,FLOAT64 is an approximate data type.NUMERIC may be a better match forFLOAT type in BigQuery.
BINARY_FLOATFLOAT64/NUMERICFLOAT is an exact data type, and it's aNUMBER subtype in Oracle. In BigQuery,FLOAT64 is an approximate data type.NUMERIC may be a better match forFLOAT type in BigQuery.
LONGBYTESLONG data type is used in earlier versions and is not suggested in new versions of Oracle Database.

BYTES data type in BigQuery can be used if it is necessary to holdLONG data in BigQuery. A better approach would be putting binary objects in Cloud Storage and holding references in BigQuery.

BLOBBYTESBYTES data type can be used to store variable-length binary data. If this field is not queried and not used in analytics, a better option is to store binary data in Cloud Storage.
BFILESTRINGBinary files can be stored in Cloud Storage andSTRING data type can be used for referencing files in a BigQuery table.
DATEDATETIME
TIMESTAMPTIMESTAMPBigQuery supports microsecond precision (10-6) in comparison to Oracle which supports precision ranging from 0 to 9.

BigQuery supports a time zone region name from a TZ database and time zone offset from UTC.

In BigQuery a time zone conversion should be manually performed to match Oracle'sTIMESTAMP WITH LOCAL TIME ZONE feature.

TIMESTAMP(x)TIMESTAMPBigQuery supports microsecond precision (10-6) in comparison to Oracle which supports precision ranging from 0 to 9.

BigQuery supports a time zone region name from a TZ database and time zone offset from UTC.

In BigQuery a time zone conversion should be manually performed to match Oracle'sTIMESTAMP WITH LOCAL TIME ZONE feature.

TIMESTAMP WITH TIME ZONETIMESTAMPBigQuery supports microsecond precision (10-6) in comparison to Oracle which supports precision ranging from 0 to 9.

BigQuery supports a time zone region name from a TZ database and time zone offset from UTC.

In BigQuery a time zone conversion should be manually performed to match Oracle'sTIMESTAMP WITH LOCAL TIME ZONE feature.

TIMESTAMP WITH LOCAL TIME ZONETIMESTAMPBigQuery supports microsecond precision (10-6) in comparison to Oracle which supports precision ranging from 0 to 9.

BigQuery supports a time zone region name from a TZ database and time zone offset from UTC.

In BigQuery a time zone conversion should be manually performed to match Oracle'sTIMESTAMP WITH LOCAL TIME ZONE feature.

INTERVAL YEAR TO MONTHSTRINGInterval values can be stored asSTRING data type in BigQuery.
INTERVAL DAY TO SECONDSTRINGInterval values can be stored asSTRING data type in BigQuery.
RAWBYTESBYTES data type can be used to store variable-length binary data. If this field is not queried and used in analytics, a better option is to store binary data on Cloud Storage.
LONG RAWBYTESBYTES data type can be used to store variable-length binary data. If this field is not queried and used in analytics, a better option is to store binary data on Cloud Storage.
ROWIDSTRINGThese data types are used Oracle internally to specify unique addresses to rows in a table. Generally,ROWID orUROWID field should not be used in applications. But if this is the case,STRING data type can be used to hold this data.

Type formatting

Oracle SQL uses a set of default formats set as parameters for displayingexpressions and column data, and for conversions between data types. Forexample,NLS_DATE_FORMAT set asYYYY/MM/DD formats dates asYYYY/MM/DDby default. You can find more information aboutthe NLS settings in the Oracleonline documentation.In BigQuery, there are no initialization parameters.

By default, BigQuery expects all source data to beUTF-8 encoded when loading. Optionally, if you have CSV files with data encodedin ISO-8859-1 format, you can explicitly specify the encoding when you importyour data so that BigQuery can properly convert your data toUTF-8 during the import process.

It is only possible to import data that is ISO-8859-1 or UTF-8encoded. BigQuery stores and returns the data as UTF-8 encoded.Intended date format or time zone can be set inDATE andTIMESTAMPfunctions.

Timestamp and date type formatting

When you convert timestamp and date formatting elements from Oracle toBigQuery, you must pay attention to time zone differences betweenTIMESTAMP andDATETIME as summarized in the following table.

Notice there are no parentheses in the Oracle formats because the formats(CURRENT_*) are keywords, not functions.

OracleBigQueryNotes
CURRENT_TIMESTAMPTIMESTAMP information in Oracle can have different time zone information, which is defined usingWITH TIME ZONE in column definition or settingTIME_ZONE variable.If possible, use theCURRENT_TIMESTAMP() function, which is formatted in ISO format. However, the output format does always show the UTC time zone. (Internally, BigQuery does not have a time zone.)

Note the following details on differences in the ISO format:

DATETIME is formatted based on output channel conventions. In the BigQuery command-line tool and BigQuery consoleDATETIME is formatted using aT separator according to RFC 3339. However, in Python and Java JDBC, a space is used as a separator.

If you want to use an explicit format, use theFORMAT_DATETIME() function, which makes an explicit cast a string. For example, the following expression always returns a space separator:CAST(CURRENT_DATETIME() AS STRING)

CURRENT_DATE
SYSDATE
Oracle uses 2 types for date:
  • type 12
  • type 13
Oracle uses type 12 when storing dates. Internally, these are numbers with fixed-length. Oracle uses type 13 when a is returned bySYSDATE or CURRENT_DATE
BigQuery has a separateDATE format that always returns a date inISO 8601 format.

DATE_FROM_UNIX_DATE can't be used because it is 1970-based.

CURRENT_DATE-3Date values are represented as integers. Oracle supports arithmetic operators for date types.For date types, useDATE_ADD() orDATE_SUB().BigQuery uses arithmetic operators for data types:INT64,NUMERIC, andFLOAT64.
NLS_DATE_FORMATSet the session or system date format.BigQuery always usesISO 8601, so make sure you convert Oracle dates and times.

Query syntax

This section addresses differences in query syntax between Oracle andBigQuery.

SELECT statements

Most OracleSELECT statements are compatible with BigQuery.

Functions, operators, and expressions

The following sections list mappings between Oracle functions andBigQuery equivalents.

Comparison operators

Oracle and BigQuery comparison operators are ANSI SQL:2011compliant. The comparison operators in the table below are the same in bothBigQuery and Oracle. You can useREGEXP_CONTAINSinstead ofREGEXP_LIKE in BigQuery.

Operator Description
"="Equal
<>Not equal
!= Not equal
>Greater than
>=Greater than or equal
<Less than
<= Less than or equal
IN ( )Matches a value in a list
NOT Negates a condition
BETWEEN Within a range (inclusive)
IS NULLNULL value
IS NOT NULL NotNULL value
LIKE Pattern matching with %
EXISTS Condition is met if subquery returns at least one row

The operators on the table are the same both in BigQuery and Oracle.

Logical expressions and functions

OracleBigQuery
CASECASE
COALESCECOALESCE(expr1, ..., exprN)
DECODECASE.. WHEN.. END
NANVLIFNULL
FETCH NEXT>LIMIT
NULLIFNULLIF(expression, expression_to_match)
NVLIFNULL(expr, 0), COALESCE(exp, 0)
NVL2IF(expr, true_result, else_result)

Aggregate functions

The following table shows mappings between common Oracle aggregate, statistical aggregate, and approximate aggregate functions with their BigQuery equivalents:

OracleBigQuery
ANY_VALUE
(from Oracle 19c)
ANY_VALUE
APPROX_COUNTHLL_COUNT set of functions with specified precision
APPROX_COUNT_DISTINCTAPPROX_COUNT_DISTINCT
APPROX_COUNT_DISTINCT_AGGAPPROX_COUNT_DISTINCT
APPROX_COUNT_DISTINCT_DETAILAPPROX_COUNT_DISTINCT
APPROX_PERCENTILE(percentile) WITHIN GROUP (ORDER BY expression)APPROX_QUANTILES(expression, 100)[
OFFSET(CAST(TRUNC(percentile * 100) as INT64))]

BigQuery doesn't support the rest of arguments that Oracle defines.
APPROX_PERCENTILE_AGGAPPROX_QUANTILES(expression, 100)[
OFFSET(CAST(TRUNC(percentile * 100) as INT64))]
APPROX_PERCENTILE_DETAILAPPROX_QUANTILES(expression, 100)[OFFSET(CAST(TRUNC(percentile * 100) as INT64))]
APPROX_SUMAPPROX_TOP_SUM(expression, weight, number)
AVGAVG
BIT_COMPLEMENTbitwise not operator: ~
BIT_ORBIT_OR,X | Y
BIT_XORBIT_XOR,X ^ Y
BITANDBIT_AND,X & Y
CARDINALITYCOUNT
COLLECTBigQuery doesn't supportTYPE AS TABLE OF. Consider usingSTRING_AGG() orARRAY_AGG() in BigQuery
CORR/CORR_K/CORR_SCORR
COUNTCOUNT
COVAR_POPCOVAR_POP
COVAR_SAMPCOVAR_SAMP
FIRSTDoes not exist implicitly in BigQuery. Consider usinguser-defined functions (UDFs).
GROUP_IDNot used in BigQuery
GROUPINGGROUPING
GROUPING_IDNot used in BigQuery.
LASTDoes not exist implicitly in BigQuery. Consider usingUDFs.
LISTAGGSTRING_AGG,ARRAY_CONCAT_AGG(expression [ORDER BY key [{ASC|DESC}] [, ... ]] [LIMIT n])
MAXMAX
MINMIN
OLAP_CONDITIONOracle specific, does not exist in BigQuery.
OLAP_EXPRESSIONOracle specific, does not exist in BigQuery.
OLAP_EXPRESSION_BOOLOracle specific, does not exist in BigQuery.
OLAP_EXPRESSION_DATEOracle specific, does not exist in BigQuery.
OLAP_EXPRESSION_TEXTOracle specific, does not exist in BigQuery.
OLAP_TABLEOracle specific, does not exist in BigQuery.
POWERMULTISETOracle specific, does not exist in BigQuery.
POWERMULTISET_BY_CARDINALITYOracle specific, does not exist in BigQuery.
QUALIFYOracle specific, does not exist in BigQuery.
REGR_AVGXAVG(
IF(dep_var_expr is NULL
OR ind_var_expr is NULL,
NULL, ind_var_expr)
)
REGR_AVGYAVG(
IF(dep_var_expr is NULL
OR ind_var_expr is NULL,
NULL, dep_var_expr)
)
REGR_COUNTSUM(
IF(dep_var_expr is NULL
OR ind_var_expr is NULL,
NULL, 1)
)
REGR_INTERCEPTAVG(dep_var_expr)
- AVG(ind_var_expr)
* (COVAR_SAMP(ind_var_expr,dep_var_expr)
/VARIANCE(ind_var_expr)
)
REGR_R2(COUNT(dep_var_expr) *
SUM(ind_var_expr * dep_var_expr) -
SUM(dep_var_expr) * SUM(ind_var_expr))
/ SQRT(
(COUNT(ind_var_expr) *
SUM(POWER(ind_var_expr, 2)) *
POWER(SUM(ind_var_expr),2)) *
(COUNT(dep_var_expr) *
SUM(POWER(dep_var_expr, 2)) *
POWER(SUM(dep_var_expr), 2)))
REGR_SLOPECOVAR_SAMP(ind_var_expr,

dep_var_expr)

/VARIANCE(ind_var_expr)

REGR_SXXSUM(POWER(ind_var_expr, 2)) - COUNT(ind_var_expr) * POWER(AVG(ind_var_expr),2)
REGR_SXYSUM(ind_var_expr*dep_var_expr) - COUNT(ind_var_expr) *AVG(ind) * AVG(dep_var_expr)
REGR_SYYSUM(POWER(dep_var_expr, 2)) - COUNT(dep_var_expr) * POWER(AVG(dep_var_expr),2)
ROLLUPROLLUP
STDDEV_POPSTDDEV_POP
STDDEV_SAMPSTDDEV_SAMP,STDDEV
SUMSUM
VAR_POPVAR_POP
VAR_SAMPVAR_SAMP,VARIANCE
WM_CONCATSTRING_AGG

BigQuery offers the following additional aggregate functions:

Analytical functions

The following table shows mappings between common Oracle analytic and aggregate analytic functions with their BigQuery equivalents.

OracleBigQuery
AVGAVG
BIT_COMPLEMENTbitwise not operator: ~
BIT_ORBIT_OR,X | Y
BIT_XORBIT_XOR,X ^ Y
BITANDBIT_AND,X & Y
BOOL_TO_INTCAST(X AS INT64)
COUNTCOUNT
COVAR_POPCOVAR_POP
COVAR_SAMPCOVAR_SAMP
CUBE_TABLEIsn't supported in BigQuery. Consider using a BI tool or a custom UDF
CUME_DISTCUME_DIST
DENSE_RANK(ANSI)DENSE_RANK
FEATURE_COMPAREDoes not exist implicitly in BigQuery. Consider using UDFs and BigQuery ML
FEATURE_DETAILSDoes not exist implicitly in BigQuery. Consider using UDFs and BigQuery ML
FEATURE_IDDoes not exist implicitly in BigQuery. Consider using UDFs and BigQuery ML
FEATURE_SETDoes not exist implicitly in BigQuery. Consider using UDFs and BigQuery ML
FEATURE_VALUEDoes not exist implicitly in BigQuery. Consider using UDFs and BigQuery ML
FIRST_VALUEFIRST_VALUE
HIER_CAPTIONHierarchical queries are not supported in BigQuery.
HIER_CHILD_COUNTHierarchical queries are not supported in BigQuery.
HIER_COLUMNHierarchical queries are not supported in BigQuery.
HIER_DEPTHHierarchical queries are not supported in BigQuery.
HIER_DESCRIPTIONHierarchical queries are not supported in BigQuery.
HIER_HAS_CHILDRENHierarchical queries are not supported in BigQuery.
HIER_LEVELHierarchical queries are not supported in BigQuery.
HIER_MEMBER_NAMEHierarchical queries are not supported in BigQuery.
HIER_ORDERHierarchical queries are not supported in BigQuery.
HIER_UNIQUE_MEMBER_NAMEHierarchical queries are not supported in BigQuery.
LAST_VALUELAST_VALUE
LAGLAG
LEADLEAD
LISTAGGARRAY_AGG
STRING_AGG
ARRAY_CONCAT_AGG
MATCH_NUMBERPattern recognition and calculation can be done with regular expressions and UDFs in BigQuery
MATCH_RECOGNIZEPattern recognition and calculation can be done with regular expressions and UDFs in BigQuery
MAXMAX
MEDIANPERCENTILE_CONT(x, 0.5 RESPECT NULLS) OVER()
MINMIN
NTH_VALUENTH_VALUE (value_expression, constant_integer_expression [{RESPECT | IGNORE} NULLS])
NTILENTILE(constant_integer_expression)
PERCENT_RANK
PERCENT_RANKM
PERCENT_RANK
PERCENTILE_CONT
PERCENTILE_DISC
PERCENTILE_CONT
PERCENTILE_CONT
PERCENTILE_DISC
PERCENTILE_DISC
PRESENTNNVOracle specific, does not exist in BigQuery.
PRESENTVOracle specific, does not exist in BigQuery.
PREVIOUSOracle specific, does not exist in BigQuery.
RANK(ANSI)RANK
RATIO_TO_REPORT(expr) OVER (partition clause)expr / SUM(expr) OVER (partition clause)
ROW_NUMBERROW_NUMBER
STDDEV_POPSTDDEV_POP
STDDEV_SAMPSTDDEV_SAMP,STDDEV
SUMSUM
VAR_POPVAR_POP
VAR_SAMPVAR_SAMP,VARIANCE
VARIANCEVARIANCE()
WIDTH_BUCKETUDF can be used.

Date/time functions

The following table shows mappings between common Oracle date/time functions and their BigQuery equivalents.

OracleBigQuery
ADD_MONTHS(date, integer)DATE_ADD(date, INTERVAL integer MONTH),
If date is aTIMESTAMP you can use

EXTRACT(DATE FROM TIMESTAMP_ADD(date, INTERVAL integer MONTH))

CURRENT_DATECURRENT_DATE
CURRENT_TIMECURRENT_TIME
CURRENT_TIMESTAMPCURRENT_TIMESTAMP
DATE - kDATE_SUB(date_expression, INTERVAL k DAY)
DATE + kDATE_ADD(date_expression, INTERVAL k DAY)
DBTIMEZONE BigQuery does not support the database time zone.
EXTRACTEXTRACT(DATE),EXTRACT(TIMESTAMP)
LAST_DAYDATE_SUB(
  DATE_TRUNC(
    DATE_ADD(
      date_expression,
      INTERVAL 1 MONTH
    ),
  MONTH
  ),
INTERVAL 1 DAY
)
LOCALTIMESTAMP BigQuery doesn't support time zone settings.
MONTHS_BETWEENDATE_DIFF(date_expression, date_expression, MONTH)
NEW_TIME DATE(timestamp_expression, time zone)
TIME(timestamp, time zone)
DATETIME(timestamp_expression, time zone)
NEXT_DAYDATE_ADD(
  DATE_TRUNC(
    date_expression,
    WEEK(day_value)
  ),
  INTERVAL 1 WEEK
)
SYS_AT_TIME_ZONECURRENT_DATE([time_zone])
SYSDATECURRENT_DATE()
SYSTIMESTAMPCURRENT_TIMESTAMP()
TO_DATEPARSE_DATE
TO_TIMESTAMPPARSE_TIMESTAMP
TO_TIMESTAMP_TZPARSE_TIMESTAMP
TZ_OFFSET Isn't supported in BigQuery. Consider using a custom UDF.
WM_CONTAINS
WM_EQUALS
WM_GREATERTHAN
WM_INTERSECTION
WM_LDIFF
WM_LESSTHAN
WM_MEETS
WM_OVERLAPS
WM_RDIFF
Periods are not used in BigQuery. UDFs can be used to compare two periods.

BigQuery offers the following additional date/time functions:

String functions

The following table shows mappings between Oracle string functions and theirBigQuery equivalents:

OracleBigQuery
ASCIITO_CODE_POINTS(string_expr)[OFFSET(0)]
ASCIISTRBigQuery doesn't support UTF-16
RAWTOHEXTO_HEX
LENGTHCHAR_LENGTH
LENGTHCHARACTER_LENGTH
CHRCODE_POINTS_TO_STRING(
[mod(numeric_expr, 256)]
)
COLLATIONDoesn't exist in BigQuery. BigQuery doesn't support COLLATE in DML
COMPOSECustom user-defined function.
CONCAT, (|| operator)CONCAT
DECOMPOSECustom user-defined function.
ESCAPE_REFERENCE (UTL_I18N)Is not supported in BigQuery. Consider using a user-defined function.
INITCAPINITCAP
INSTR/INSTR2/INSTR4/INSTRB/INSTRCCustom user-defined function.
LENGTH/LENGTH2/LENGTH4/LENGTHB/LENGTHCLENGTH
LOWERLOWER
LPADLPAD
LTRIMLTRIM
NLS_INITCAPCustom user-defined function.
NLS_LOWERLOWER
NLS_UPPERUPPER
NLSSORTOracle specific, does not exist in BigQuery.
POSITIONSTRPOS(string, substring)
PRINTBLOBTOCLOBOracle specific, does not exist in BigQuery.
REGEXP_COUNTARRAY_LENGTH(REGEXP_EXTRACT_ALL(value, regex))
REGEXP_INSTRSTRPOS(source_string,REGEXP_EXTRACT(source_string, regexp_string))

Note: Returns first occurrence.

REGEXP_REPLACEREGEXP_REPLACE
REGEXP_LIKEIF(REGEXP_CONTAINS,1,0)
REGEXP_SUBSTRREGEXP_EXTRACT, REGEXP_EXTRACT_ALL
REPLACEREPLACE
REVERSEREVERSE
RIGHTSUBSTR(source_string, -1, length)
RPADRPAD
RTRIMRTRIM
SOUNDEXIsn't supported in BigQuery. Consider using a custom UDF
STRTOKSPLIT(instring, delimiter)[ORDINAL(tokennum)]

Note: The entire delimiter string argument is used as a single delimiter. The default delimiter is a comma.

SUBSTR/SUBSTRB/SUBSTRC/SUBSTR2/SUBSTR4SUBSTR
TRANSLATEREPLACE
TRANSLATE USINGREPLACE
TRIMTRIM
UNISTRCODE_POINTS_TO_STRING
UPPERUPPER
|| (VERTICAL BARS)CONCAT

BigQuery offers the following additional string functions:

Math functions

The following table shows mappings between Oracle math functions and their BigQuery equivalents.

OracleBigQuery
ABSABS
ACOSACOS
ACOSHACOSH
ASINASIN
ASINHASINH
ATANATAN
ATAN2ATAN2
ATANHATANH
CEILCEIL
CEILINGCEILING
COSCOS
COSHCOSH
EXPEXP
FLOORFLOOR
GREATESTGREATEST
LEASTLEAST
LNLN
LNNVLuse withISNULL
LOGLOG
MOD (% operator)MOD
POWER (** operator)POWER,POW
DBMS_RANDOM.VALUERAND
RANDOMBYTESIsn't supported in BigQuery. Consider using a custom UDF and RAND function
RANDOMINTEGERCAST(FLOOR(10*RAND()) AS INT64)
RANDOMNUMBERIsn't supported in BigQuery. Consider using a custom UDF and RAND function
REMAINDERMOD
ROUNDROUND
ROUND_TIES_TO_EVENROUND()
SIGNSIGN
SINSIN
SINHSINH
SQRTSQRT
STANDARD_HASHFARM_FINGERPRINT, MD5, SHA1, SHA256, SHA512
STDDEVSTDDEV
TANTAN
TANHTANH
TRUNCTRUNC
NVLIFNULL(expr, 0), COALESCE(exp, 0)

BigQuery offers the following additional math functions:

Type conversion functions

The following table shows mappings between Oracle type conversion functions and their BigQuery equivalents.

OracleBigQuery
BIN_TO_NUMSAFE_CONVERT_BYTES_TO_STRING(value)

CAST(x AS INT64)

BINARY2VARCHARSAFE_CONVERT_BYTES_TO_STRING(value)
CAST
CAST_FROM_BINARY_DOUBLE
CAST_FROM_BINARY_FLOAT
CAST_FROM_BINARY_INTEGER
CAST_FROM_NUMBER
CAST_TO_BINARY_DOUBLE
CAST_TO_BINARY_FLOAT
CAST_TO_BINARY_INTEGER
CAST_TO_NUMBER
CAST_TO_NVARCHAR2
CAST_TO_RAW
>CAST_TO_VARCHAR
CAST(expr AS typename)
CHARTOROWIDOracle specific not needed.
CONVERTBigQuery doesn't support character sets. Consider using custom user-defined function.
EMPTY_BLOBBLOB is not used in BigQuery.
EMPTY_CLOBCLOB is not used in BigQuery.
FROM_TZTypes with time zones are not supported in BigQuery. Consider using a user-defined function and FORMAT_TIMESTAMP
INT_TO_BOOLCAST
IS_BIT_SETDoes not exist implicitly in BigQuery. Consider using UDFs
NCHRUDF can be used to get char equivalent of binary
NUMTODSINTERVALINTERVAL data type is not supported in BigQuery
NUMTOHEXIsn't supported in BigQuery. Consider using a custom UDF andTO_HEX function
NUMTOHEX2
NUMTOYMINTERVALINTERVAL data type is not supported in BigQuery.
RAW_TO_CHAROracle specific, does not exist in BigQuery.
RAW_TO_NCHAROracle specific, does not exist in BigQuery.
RAW_TO_VARCHAR2Oracle specific, does not exist in BigQuery.
RAWTOHEXOracle specific, does not exist in BigQuery.
RAWTONHEXOracle specific, does not exist in BigQuery.
RAWTONUMOracle specific, does not exist in BigQuery.
RAWTONUM2Oracle specific, does not exist in BigQuery.
RAWTOREFOracle specific, does not exist in BigQuery.
REFTOHEXOracle specific, does not exist in BigQuery.
REFTORAWOracle specific, does not exist in BigQuery.
ROWIDTOCHARROWID is Oracle specific type and does not exist in BigQuery. This value should be represented as string.
ROWIDTONCHARROWID is Oracle specific type and does not exist in BigQuery. This value should be represented as string.
SCN_TO_TIMESTAMPSCN is Oracle specific type and does not exist in BigQuery. This value should be represented as timestamp.
TO_ACLID
TO_ANYLOB
TO_APPROX_COUNT_DISTINCT
TO_APPROX_PERCENTILE
TO_BINARY_DOUBLE
TO_BINARY_FLOAT
TO_BLOB
TO_CHAR
TO_CLOB
TO_DATE
TO_DSINTERVAL
TO_LOB
TO_MULTI_BYTE
TO_NCHAR
TO_NCLOB
TO_NUMBER
TO_RAW
TO_SINGLE_BYTE
TO_TIME

TO_TIMESTAMP
TO_TIMESTAMP_TZ
TO_TIME_TZ
TO_UTC_TIMEZONE_TZ
TO_YMINTERVAL
CAST(expr AS typename)
PARSE_DATE
PARSE_TIMESTAMP
Cast syntax is used in a query to indicate that the result type of an expression should be converted to some other type.
TREATOracle specific, does not exist in BigQuery.
VALIDATE_CONVERSIONIsn't supported in BigQuery. Consider using a custom UDF
VSIZEIsn't supported in BigQuery. Consider using a custom UDF

JSON functions

The following table shows mappings between Oracle JSON functions and theirBigQuery equivalents.

OracleBigQuery
AS_JSONTO_JSON_STRING(value[, pretty_print])
JSON_ARRAYConsider using UDFs andTO_JSON_STRING function
JSON_ARRAYAGGConsider using UDFs andTO_JSON_STRING function
JSON_DATAGUIDECustom user-defined function.
JSON_EQUALCustom user-defined function.
JSON_EXISTConsider using UDFs andJSON_EXTRACT orJSON_EXTRACT_SCALAR
JSON_MERGEPATCHCustom user-defined function.
JSON_OBJECTIs not supported by BigQuery.
JSON_OBJECTAGGIs not supported by BigQuery.
JSON_QUERYConsider using UDFs andJSON_EXTRACT orJSON_EXTRACT_SCALAR.
JSON_TABLECustom user-defined function.
JSON_TEXTCONTAINSConsider using UDFs andJSON_EXTRACT orJSON_EXTRACT_SCALAR.
JSON_VALUEJSON_EXTRACT_SCALAR

XML functions

BigQuery does not provide implicit XML functions. XML can beloaded to BigQuery as string and UDFs can be used to parse XML.Alternatively, XML processing be done by an ETL/ELT tool such asDataflow. The following list shows Oracle XMLfunctions:

OracleBigQuery
DELETEXMLBigQueryUDFs or ETL tool like Dataflow can be used to process XML.
ENCODE_SQL_XML
EXISTSNODE
EXTRACTCLOBXML
EXTRACTVALUE
INSERTCHILDXML
INSERTCHILDXMLAFTER
INSERTCHILDXMLBEFORE
INSERTXMLAFTER
INSERTXMLBEFORE
SYS_XMLAGG
SYS_XMLANALYZE
SYS_XMLCONTAINS
SYS_XMLCONV
SYS_XMLEXNSURI
SYS_XMLGEN
SYS_XMLI_LOC_ISNODE
SYS_XMLI_LOC_ISTEXT
SYS_XMLINSTR
SYS_XMLLOCATOR_GETSVAL
SYS_XMLNODEID
SYS_XMLNODEID_GETLOCATOR
SYS_XMLNODEID_GETOKEY
SYS_XMLNODEID_GETPATHID
SYS_XMLNODEID_GETPTRID
SYS_XMLNODEID_GETRID
SYS_XMLNODEID_GETSVAL
SYS_XMLT_2_SC
SYS_XMLTRANSLATE
SYS_XMLTYPE2SQL
UPDATEXML
XML2OBJECT
XMLCAST
XMLCDATA
XMLCOLLATVAL
XMLCOMMENT
XMLCONCAT
XMLDIFF
XMLELEMENT
XMLEXISTS
XMLEXISTS2
XMLFOREST
XMLISNODE
XMLISVALID
XMLPARSE
XMLPATCH
XMLPI
XMLQUERY
XMLQUERYVAL
XMLSERIALIZE
XMLTABLE
XMLTOJSON
XMLTRANSFORM
XMLTRANSFORMBLOB
XMLTYPE

Machine learning functions

Machine learning (ML) functions in Oracle and BigQuery aredifferent.Oracle requires advanced analytics pack and licenses to do ML on the database.Oracle uses theDBMS_DATA_MINING package for ML. Converting Oracle data minerjobs requires rewriting the code, you can choose from comprehensiveGoogle AIproduct offerings such asBigQuery ML,AI APIs (includingSpeech-to-Text,Text-to-Speech,Dialogflow,Cloud Translation,NLP,Cloud Vision, andTimeseries Insights API,AutoML,AutoML Tables orAI Platform. Googleuser-managed notebooks can be used as a developmentenvironment for data scientists and GoogleAI Platform Trainingcan be used to run training and scoring workloads at scale. The following tableshows Oracle ML functions:

OracleBigQuery
CLASSIFIERSeeBigQuery ML for machine learning classifier and regression options
CLUSTER_DETAILS
CLUSTER_DISTANCE
CLUSTER_ID
CLUSTER_PROBABILITY
CLUSTER_SET
PREDICTION
PREDICTION_BOUNDS
PREDICTION_COST
PREDICTION_DETAILS
PREDICTION_PROBABILITY
PREDICTION_SET

Security functions

The following table shows the functions for identifying the user in Oracle andBigQuery:

OracleBigQuery
UIDSESSION_USER
USER/SESSION_USER/CURRENT_USERSESSION_USER()

Set or array functions

The following table shows set or array functions in Oracle and their equivalentsin BigQuery:

OracleBigQuery
MULTISETARRAY_AGG
MULTISET EXCEPTARRAY_AGG([DISTINCT] expression)
MULTISET INTERSECTARRAY_AGG([DISTINCT])
MULTISET UNIONARRAY_AGG

Window functions

The following table shows window functions in Oracle and their equivalents in BigQuery.

OracleBigQuery
LAGLAG (value_expression[, offset [, default_expression]])
LEADLEAD (value_expression[, offset [, default_expression]])

Hierarchical or recursive queries

Hierarchicalor recursive queries are not used in BigQuery. If the depth ofthe hierarchy is known similar functionality can be achieved with joins, asillustrated in the following example. Another solution would be to utilize theBigQueryStorage API andSpark.

selectarray(selecte.update.elementunionallselectc1frome.update.element.childasc1unionallselectc2frome.update.element.childasc1,c1.childasc2unionallselectc3frome.update.element.childasc1,c1.childasc2,c2.childasc3unionallselectc4frome.update.element.childasc1,c1.childasc2,c2.childasc3,c3.childasc4unionallselectc5frome.update.element.childasc1,c1.childasc2,c2.childasc3,c3.childasc4,c4.childasc5)asflattened,easeventfromt,t.eventsase

The following table shows hierarchical functions in Oracle.

OracleBigQuery
DEPTHHierarchical queries are not used in BigQuery.
PATH
SYS_CONNECT_BY_PATH (hierarchical)

UTL functions

UTL_Filepackage is mainly used for reading and writing the operating system files fromPL/SQL. Cloud Storage can be used for any kind of raw file staging.External tables and BigQueryload andexportshould be used to read and write files from and to Cloud Storage. Formore information, seeIntroduction to external data sources.

Spatial functions

You can use BigQuery geospatial analytics to replace spatialfunctionality. ThereareSDO_* functions and types in Oracle such asSDO_GEOM_KEY,SDO_GEOM_MBR,SDO_GEOM_MMB. These functions are used for spatialanalysis. You can usegeospatial analyticsto do spatial analysis.

DML syntax

This section addresses differences in data management language syntax betweenOracle and BigQuery.

INSERT statement

Most OracleINSERT statements are compatible with BigQuery. Thefollowing table shows exceptions.

DML scripts in BigQuery have slightly different consistencysemantics than the equivalent statements in Oracle. For an overview of snapshotisolation and session and transaction handling, see theCREATE [UNIQUE] INDEXsection elsewhere in this document.

OracleBigQuery
INSERT INTOtable VALUES (...);INSERT INTOtable (...) VALUES (...);

Oracle offers aDEFAULT keyword for non-nullable columns.

Note: In BigQuery, omitting column names in theINSERT statement only works if values for all columns in the target table are included in ascending order based on their ordinal positions.

INSERT INTOtable VALUES (1,2,3);
INSERT INTOtable VALUES (4,5,6);
INSERT INTOtable VALUES (7,8,9);
INSERT ALL
INTOtable (col1, col2) VALUES ('val1_1', 'val1_2')
INTOtable (col1, col2) VALUES ('val2_1', 'val2_2')
INTOtable (col1, col2) VALUES ('val3_1', 'val3_2')
.
.
.
SELECT 1 FROM DUAL;
INSERT INTOtable VALUES (1,2,3),(4,5,6),
(7,8,9);

BigQuery imposesDML quotas, which restrict the number of DML statements you can execute daily. To make the best use of your quota, consider the following approaches:

  • Combine multiple rows in a singleINSERT statement, instead of one row perINSERT operation.
  • Combine multiple DML statements (includingINSERT) using aMERGE statement.
  • UseCREATE TABLE ... AS SELECT to create and populate new tables.

UPDATE statement

OracleUPDATE statements are mostly compatible with BigQuery,however, in BigQuery theUPDATE statement must have aWHEREclause.

As a best practice, you should prefer batch DML statements over multiple singleUPDATE andINSERT statements. DML scripts in BigQuery haveslightly different consistency semantics than equivalent statements in Oracle.For an overview on snapshot isolation and session and transaction handling seetheCREATE INDEX section in this document.

The following table shows OracleUPDATE statements and BigQuerystatements that accomplish the same tasks.

In BigQuery theUPDATE statement must have aWHERE clause.For more information aboutUPDATE in BigQuery, see theBigQuery UPDATE examplesin the DML documentation.

DELETE andTRUNCATE statements

TheDELETE andTRUNCATE statements are both ways to remove rows from a tablewithout affecting the table schema.TRUNCATE is not used in BigQuery.However, you can useDELETE statements to achieve the same effect.

In BigQuery, theDELETE statement must have aWHERE clause.For more information aboutDELETE in BigQuery, see theBigQueryDELETE examplesin the DML documentation.

OracleBigQuery
DELETEdatabase.table;DELETE FROMtable WHERE TRUE;

MERGE statement

TheMERGE statement can combineINSERT,UPDATE, andDELETE operationsinto a singleUPSERT statement and perform the operations atomically. TheMERGE operation must match, at most, one source row for each target row.BigQuery and Oracle both follow ANSI Syntax.

However, DML scripts in BigQuery have slightly differentconsistency semantics than the equivalent statements in Oracle.

DDL syntax

This section addresses differences in data definition language syntax betweenOracle and BigQuery.

CREATE TABLE statement

Most OracleCREATE TABLEstatements are compatible with BigQuery, except for the followingconstraints and syntax elements, which are not used in BigQuery:

  • STORAGE
  • TABLESPACE
  • DEFAULT
  • GENERATED ALWAYS AS
  • ENCRYPT
  • PRIMARY KEY (col, ...). For more information, seeCREATE INDEX.
  • UNIQUE INDEX. For more information, seeCREATE INDEX.
  • CONSTRAINT..REFERENCES
  • DEFAULT
  • PARALLEL
  • COMPRESS

For more information aboutCREATE TABLE in BigQuery,see theBigQueryCREATE TABLEexamples.

Column options and attributes

Identity columns are introduced with Oracle 12c version which enablesauto-increment on a column. This is not used in BigQuery, thiscan be achieved with the following batch way. For more information about surrogatekeys and slowly changing dimensions (SCD), refer to the following guides:

OracleBigQuery
CREATE TABLE table (
  id NUMBER GENERATED ALWAYS AS IDENTITY,
  description VARCHAR2(30)
);
INSERT INTO dataset.table SELECT
  *,
  ROW_NUMBER() OVER () AS id
FROM dataset.table

Column comments

Oracle usesComment syntax to add comments on columns. This feature can besimilarly implemented in BigQuery using the column description asshown in the following table:

OracleBigQuery
Comment on columntable is 'column desc';CREATE TABLEdataset.table (
   col1 STRING
OPTIONS(description="column desc")
);

Temporary tables

Oracle supportstemporary tables, which are often used to store intermediate results in scripts.Temporary tables are supported in BigQuery.

OracleBigQuery
CREATE GLOBAL TEMPORARY TABLE
temp_tab
    (x INTEGER,
    y VARCHAR2(50))
  ON COMMIT DELETE ROWS;
COMMIT;
CREATE TEMP TABLE temp_tab
(
  x INT64,
  y STRING
);
DELETE FROM temp_tab WHERE TRUE;

The following Oracle elements are not used in BigQuery:

  • ON COMMIT DELETE ROWS;
  • ON COMMIT PRESERVE ROWS;

There are also some other ways to emulate temporary tables in BigQuery:

  • Dataset TTL: Create a dataset that has a short time to live (for example,one hour) so that any tables created in the dataset are effectively temporary(since they won't persist longer than the dataset's time to live). You canprefix all the table names in this dataset withtemp to clearly denote thatthe tables are temporary.
  • Table TTL: Create a table that has a table-specific short time to liveusing DDL statements similar to the following:

    CREATE TABLE temp.name (col1, col2, ...)
    OPTIONS(expiration_timestamp=TIMESTAMP_ADD(CURRENT_TIMESTAMP(), INTERVAL 1 HOUR));
  • WITH clause: If a temporary table is needed only within the sameblock, use a temporary result using aWITHstatement or subquery.

CREATE SEQUENCE statement

Sequences are not used in BigQuery, this can be achieved with thefollowing batch way. For more information about surrogate keys and slowlychanging dimensions (SCD), refer to the following guides:

INSERT INTO dataset.table    SELECT *,      ROW_NUMBER() OVER () AS id      FROM dataset.table

CREATE VIEW statement

The following table shows equivalents between Oracle and BigQueryfor theCREATE VIEW statement.

OracleBigQueryNotes
CREATE VIEWview_name AS SELECT ...CREATE VIEW view_name AS SELECT ...
CREATE OR REPLACE VIEWview_name AS SELECT ...CREATE OR REPLACE VIEWview_name ASSELECT ...
Not supportedCREATE VIEW IF NOT EXISTSview_nameOPTIONS(view_option_list)AS SELECT ...Creates a new view only if the view does not currently exist in the specified dataset.

CREATE MATERIALIZED VIEW statement

In BigQuery materialized view refresh operations are doneautomatically. There is no need to specify refresh options (for example, oncommit or on schedule) in BigQuery. For more information, seeIntroduction to materialized views.

In case the base table keeps changing by appends only, the query that usesmaterialized view (whether view is explicitly referenced or selected by thequery optimizer) scans all materialized view plus a delta in the base tablesince the last view refresh. This means queries are faster and cheaper.

On the contrary, if there were any updates (DML UPDATE / MERGE) or deletions(DML DELETE, truncation, partition expiration) in the base table since the lastview refresh, the materialized view are not be scanned and hence query don'tget any savings until the next view refresh. Basically, any update or deletionin the base table invalidates the materialized view state.

Also, the data from the streaming buffer of the base table is not saved intomaterialized view. Streaming buffer is still being scanned fully regardless ofwhether materialized view is used.

The following table shows equivalents between Oracle and BigQueryfor theCREATE MATERIALIZED VIEW statement.

OracleBigQueryNotes
CREATE MATERIALIZED VIEWview_name
REFRESH FAST NEXT sysdate + 7
AS SELECT … FROM TABLE_1
CREATE MATERIALIZED VIEW
view_name AS SELECT ...

CREATE [UNIQUE] INDEX statement

This section describes approaches in BigQuery for how to createfunctionality similar to indexes in Oracle.

Indexing for performance

BigQuery doesn't need explicit indexes, because it's acolumn-oriented database with query and storage optimization.BigQuery provides functionality such aspartitioning andclustering aswell asnested fields, which can increasequery efficiency and performance by optimizing how data is stored.

Indexing for consistency (UNIQUE, PRIMARY INDEX)

In Oracle, a unique index can be used to prevent rows with non-unique keys in atable. If a process tries to insert or update data that has a value that'salready in the index the operation fails with an index violation.

Because BigQuery doesn't provide explicit indexes, aMERGEstatement can be used instead to insert only unique records into a target tablefrom a staging table while discarding duplicate records. However, there is noway to prevent a user with edit permissions from inserting a duplicate record.

To generate an error for duplicate records in BigQuery you canuse aMERGE statement from the staging table, as shown in the followingexample:

OracleBigQuery
CREATE [UNIQUE] INDEXname;MERGE `prototype.FIN_MERGE` t \
USING `prototype.FIN_TEMP_IMPORT` m \
ON t.col1 = m.col1 \
  AND t.col2 = m.col2 \
WHEN MATCHED THEN \
  UPDATE SET t.col1 = ERROR(CONCAT('Encountered Error for ', m.col1, ' ', m.col2)) \
WHEN NOT MATCHED THEN \
  INSERT (col1,col2,col3,col4,col5,col6,col7,col8)
VALUES(col1,col2,col3,col4,col5,col6, CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());

More often, users prefer toremove duplicates independently in order to find errors in downstream systems.

BigQuery does not supportDEFAULT andIDENTITY (sequences) columns.

Locking

BigQuery doesn't have a lock mechanism like Oracle and can runconcurrent queries (up to yourquota). Only DML statementshave certainconcurrency limitsand might require atable lock during executionin some scenarios.

Procedural SQL statements

This section describes how to convert procedural SQL statements used in storedprocedures, functions and triggers from Oracle to BigQuery.

CREATE PROCEDURE statement

Stored Procedure is supported as part of BigQuery Scripting Beta.

OracleBigQueryNotes
CREATE PROCEDURECREATE PROCEDURESimilar to Oracle, BigQuery supportsIN, OUT, INOUT argument modes. Other syntax specifications are not supported in BigQuery.
CREATE OR REPLACE PROCEDURECREATE OR REPLACE PROCEDURE
CALLCALL

The sections that follow describe ways to convert existing Oracle proceduralstatements to BigQuery scripting statements that have similarfunctionality.

CREATE TRIGGER statement

Triggers are not used in BigQuery. Row based application logicshould be handled on the application layer. Trigger functionality can beachieved utilising the ingestion tool, Pub/Sub and/or Cloud Run functionsduring the ingestion time or utilising regular scans.

Variable declaration and assignment

The following table shows OracleDECLAREstatements and theirBigQuery equivalents.

OracleBigQuery
DECLARE
  L_VAR NUMBER;
BEGIN
  L_VAR := 10 + 20;
END;
DECLARE L_VAR int64;
BEGIN
  SET L_VAR = 10 + 20;
  SELECT L_VAR;
END
SETvar =value;SETvar =value;

Cursor declarations and operations

BigQuery does not support cursors, so the following statements are not used in BigQuery:

Dynamic SQL statements

The following Oracle Dynamic SQL statement and its BigQueryequivalent:

OracleBigQuery
EXECUTE IMMEDIATE sql_str

[USING IN OUT [, ...]];

EXECUTE IMMEDIATE

sql_expression [INTO variable[, ...]]

[USING identifier[, ...]];

;

Flow-of-control statements

The following table shows Oracle flow-of-control statements and their BigQuery equivalents.

OracleBigQuery
IF condition THEN
  [if_statement_list]
[ELSE
  else_statement_list
]
END IF;
IF condition THEN
  [if_statement_list]
[ELSE
  else_statement_list
]
END IF;
SET SERVEROUTPUT ON;
DECLARE
x INTEGER DEFAULT 0;
y INTEGER DEFAULT 0;
BEGIN
LOOP
  IF x>= 10 THEN
    EXIT;
  ELSIF x>= 5 THEN
     y := 5;
  END IF;
  x := x + 1;
END LOOP;
dbms_output.put_line(x||','||y);
END;
/
DECLARE x INT64 DEFAULT 0;
DECLARE y INT64 DEFAULT 0;
LOOP
  IF x>= 10 THEN
     LEAVE;
  ELSE IF x>= 5 THEN
    SET y = 5;
    END IF;
  END IF;
  SET x = x + 1;
END LOOP;
SELECT x,y;
LOOP
  sql_statement_list
END LOOP;
LOOP
  sql_statement_list
END LOOP;
WHILE boolean_expression DO
  sql_statement_list
END WHILE;
WHILE boolean_expression DO
  sql_statement_list
END WHILE;
FOR LOOPFOR LOOP is not used in BigQuery. Use otherLOOP statements.
BREAKBREAK
CONTINUECONTINUE
CONTINUE/EXIT WHENUseCONTINUE withIF condition.
GOTOGOTO statement does not exist in BigQuery. UseIF condition.

Metadata and transaction SQL statements

OracleBigQuery
GATHER_STATS_JOBNot used in BigQuery yet.
LOCK TABLEtable_name IN [SHARE/EXCLUSIVE] MODE NOWAIT;Not used in BigQuery yet.
Alter session set isolation_level=serializable; /

SET TRANSACTION ...

BigQuery always uses Snapshot Isolation. For details, seeConsistency guarantees and transaction isolation in this document.
EXPLAIN PLAN ...Not used in BigQuery.

Similar features are thequery plan explanation in the BigQuery web UI and the slot allocation, and inaudit logging in Stackdriver.

SELECT * FROM DBA_[*];

(Oracle DBA_/ALL_/V$ views)

SELECT * FROM mydataset.INFORMATION_SCHEMA.TABLES;

For more information, seeIntroduction to BigQuery INFORMATION_SCHEMA.

SELECT * FROMGV$SESSION;

SELECT * FROMV$ACTIVE_SESSION_HISTORY;

BigQuery does not have the traditional session concept. You can view query jobs in the UI or export stackdriver audit logs to BigQuery and analyze BigQuery logs for analyzing jobs. For more information, seeView job details.
START TRANSACTION;

LOCK TABLEtable_A IN EXCLUSIVE MODE NOWAIT;

DELETE FROMtable_A;

INSERT INTOtable_A SELECT * FROMtable_B;

COMMIT;

Replacing the contents of a table with query output is the equivalent of a transaction. You can do this with either aquery or acopy operation.

Using a query:

bq query --replace --destination_tabletable_A 'SELECT * FROMtable_B';

Using a copy:

bq cp -ftable_Atable_B

Multi-statement and multi-line SQL statements

Both Oracle and BigQuery support transactions (sessions)and therefore support statements separated by semicolons that are consistentlyexecuted together. For more information, seeMulti-statement transactions.

Error codes and messages

Oracle error codesandBigQuery error codes aredifferent. If your application logic is currently catching the errors, try toeliminate the source of the error, because BigQuery doesn'treturn the same error codes.

Consistency guarantees and transaction isolation

Both Oracle and BigQuery are atomic—that is, ACID-compliant on aper-mutation level across many rows. For example, aMERGE operation isatomic, even with multiple inserted and updated values.

Transactions

Oracle provides read committed or serializabletransaction isolationlevels.Deadlocks are possible. Oracle insert append jobs run independently.

BigQuery alsosupports transactions.BigQuery helps ensureoptimistic concurrency control (first to commit wins) withsnapshot isolation,in which a query reads the last committed data before the query starts. Thisapproach guarantees the same level of consistency on a per-row, per-mutationbasis and across rows within the same DML statement, yet avoids deadlocks. Inthe case of multipleUPDATE statements against the same table, BigQueryswitches topessimistic concurrency control andqueues multipleUPDATE statements, automatically retrying in case of conflicts.INSERT DML statements andload jobs can run concurrently and independently to append to tables.

Rollback

Oracle supportsrollbacks. As there is no explicit transaction boundary in BigQuery, thereis no concept of an explicit rollback in BigQuery. Theworkarounds aretable decorators orusingFOR SYSTEM_TIME AS OF.

Database limits

CheckBigQuery latest quotas and limits. Manyquotas for large-volume users can be raised by contacting the Cloud Customer Care.The following table shows a comparison of the Oracle and BigQuerydatabase limits.

LimitOracleBigQuery
Tables per databaseUnrestrictedUnrestricted
Columns per table100010,000
Maximum row sizeUnlimited (Depends on the column type)100 MB
Column and table name lengthIf v12.2>= 128 Bytes

Else 30 Bytes

16,384 Unicode characters
Rows per tableUnlimitedUnlimited
Maximum SQL request lengthUnlimited1 MB (maximum unresolved GoogleSQL query length)

12 MB (maximum resolved legacy and GoogleSQL query length)

Streaming:

  • 10 MB (HTTP request size limit)
  • 10,000 (maximum rows per request)
Maximum request & response sizeUnlimited10 MB (request) and 10 GB (response), or virtually unlimited if you use pagination or the Cloud Storage API.
Maximum number of concurrent sessionsLimited by the sessions or processes parameters100 concurrent queries (can be raised withslot reservation), 300 concurrent API requests per user.
Maximum number of concurrent (fast) loadsLimited by the sessions or processes parametersNo concurrency limit; jobs are queued. 100,000 load jobs per project per day.

Other Oracle Database limits includesdata type limits,physical database limits,logical database limits andprocess and runtime limits.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-15 UTC.