Oracle Migration Guide
This guide is designed to assist those who wish to migrate their database systems from Oracle to SQreamDB. Use this guide to learn how to use the most commonly used Oracle functions with their equivalents in SQreamDB. For functions that do not have direct equivalents in SQreamDB, we provide User-Defined Functions (UDFs). If you need further assistance, our SQream support team is available to help with any custom UDFs or additional migration questions.
Using SQream Commands, Statements, and UDFs
Operation Functions
Oracle |
SQream |
Description |
---|---|---|
|
|
+a |
|
|
a+ b |
|
|
-a |
|
|
a - b |
|
|
a * b |
|
|
a / b |
|
|
a % b |
|
|
AND |
|
|
NOT |
|
|
OR |
|
|
Shift left |
|
|
Shift right |
|
|
XOR |
Conditional Functions
Oracle |
SQream |
Description |
---|---|---|
|
|
Value is in [ or not within ] the range |
|
|
Tests a conditional expression, depending on the result |
|
|
Evaluate first non-NULL expression |
|
|
Value is in [ or not within ] a set of values |
|
|
Alias for COALESCE with two expressions |
|
|
Test a TEXT for ASCII-only characters |
|
|
Check for NULL [ or non-NULL ] values |
|
|
Decodes or extracts binary data from a textual input string |
Conversion Functions
Oracle |
SQream |
Description |
---|---|---|
|
|
Converts a string to a date |
|
CREATE OR REPLACE FUNCTION SIGN(n,numeric)
RETURNS numeric
AS $$
CAST(TEXT AS NUMERIC)
$$ LANGUAGE SQL
;
|
Converts a string to a number |
Numeric Functions
Oracle |
SQream |
Description |
---|---|---|
|
|
Calculates the absolute value of an argument |
|
|
Calculates the inverse cosine of an argument |
|
|
Calculates the inverse sine of an argument |
|
|
Calculates the inverse tangent of an argument |
|
|
Calculates the inverse tangent for a point (y, x) |
|
|
Computes an AND operation on the bits of expr1 and expr2 |
|
|
Calculates the next integer for an argument |
|
|
Calculates the cosine of an argument |
|
CREATE or replace FUNCTION COSH(x double)
RETURNS double
AS $$
SELECT (exp(x) + exp(-1*x))/2
$$ LANGUAGE SQL
;
|
Returns the hyperbolic cosine of n |
NA |
|
Calculates the cotangent of an argument |
NA |
|
Calculates a CRC-64 hash of an argument |
NA |
|
Converts a value from radian values to degrees |
|
|
Calculates the natural exponent for an argument |
|
|
Calculates the largest integer smaller than the argument |
|
|
Returns the natural logarithm of n |
|
CREATE or replace FUNCTION log(b double, n double)
RETURNS double
AS $$
SELECT (log(n)/log(b))
$$ LANGUAGE SQL
;
|
Calculates the natural log for an argument |
|
|
Calculates the 10-based log for an argument |
|
|
Calculates the modulus (remainder) of two arguments |
NA |
|
Returns the constant value for π |
|
NA |
Useful only for floating-point numbers of type |
|
|
Calculates x to the power of y (xy) |
NA |
|
Returns the square value of a numeric expression (x2) |
NA |
|
Converts a value from degree values to radians |
|
CREATE or replace FUNCTION remainder(n1 bigint, n2 bigint)
RETURNS bigint
AS $$
SELECT (n1 - floor(n1/n2)*n2)
$$ LANGUAGE SQL
;
|
Returns the arguments any numeric datatype |
|
|
Rounds an argument down to the nearest integer |
|
CREATE or replace FUNCTION my_sign(n bigint)
RETURNS int
AS $$
SELECT case when n < 0 then -1 when n = 0 then 0 when n > 0 then 1 end
$$ LANGUAGE SQL
;
|
Returns the sign of the input value |
|
|
Calculates the sine |
|
CREATE or replace FUNCTION SINH(x double)
RETURNS double
AS $$
SELECT (exp(x) - exp(-1*x))/2
$$ LANGUAGE SQL
;
|
Calculates the hyperbolic sine |
|
|
Calculates the square root |
|
|
Calculates the tangent |
|
CREATE or replace FUNCTION TANH(x double)
RETURNS double
AS $$
SELECT (exp(x) - exp(-1*x))/(exp(x) + exp(-1*x))
$$ LANGUAGE SQL
;
|
Calculates the hyperbolic tangent |
|
|
Rounds a number to its integer representation towards 0 |
|
CREATE or replace FUNCTION myWIDTH_BUCKET(value float, low float, high float, num_buckets int )
RETURNS INT
AS $$
select CASE
WHEN value < low THEN 0
WHEN value >= high THEN num_buckets + 1
ELSE CEIL(((value - low) / ((high - low) / num_buckets))+1)::INT END
$$ LANGUAGE SQL
;
|
Returns the ID of the bucket into which the value of a specific expression falls |
NA |
|
Converts an integer to a hexadecimal representation |
Character Functions Returning Character Values
Oracle |
SQream |
Description |
---|---|---|
|
|
Returns the character having the binary equivalent |
|
|
Concatenates all the specified strings and returns the final string |
|
NA |
Returns char, with the first letter of each word in uppercase |
|
|
Returns char, with all letters lowercase |
|
NA |
Returns expr1, left-padded to length n characters |
|
|
Removes from the left end of char |
|
NA |
Returns char, with the first letter of each word in uppercase |
|
NA |
Returns char, with all letters lowercase |
|
NA |
Returns the string of bytes used to sort char |
|
NA |
Returns char, with all letters uppercase |
|
|
Replaces a substring in a string that matches a specified pattern |
|
|
Returns a substring of an argument that matches a regular expression |
|
|
Replaces characters in a string |
|
NA |
Right pads a string to a specified length |
|
|
Removes the space from the right side of a string |
|
NA |
Converts a normal string into a string of the SOUNDEX type |
|
|
Returns a substring of an argument |
|
NA |
Returns |
|
|
Trims whitespaces from an argument |
|
|
Converts an argument to an upper-case equivalent |
NA |
|
Repeats a string as many times as specified |
NA |
|
Returns a reversed order of a character string |
NA |
|
Returns the left part of a character string with the specified number of characters |
NA |
|
Returns the right part of a character string with the specified number of characters |
NA |
|
Tests if a string matches a given pattern. SQL patterns |
NA |
|
Tests if a string matches a given regular expression pattern. POSIX regular expressions |
NA |
|
Checks if one string is a prefix of the other |
Character Functions Returning Number Values
Oracle |
SQream |
Description |
---|---|---|
|
NA |
Returns the decimal representation in the database character set |
|
|
Search string for substring |
|
|
Calculates the length of a string in characters |
NA |
|
Calculates the number of characters in a string. (This function is provided for SQL Server compatibility) |
NA |
|
Calculates the number of bytes in a string |
NA |
|
Returns the starting position of a string inside another string |
NA |
|
Returns the starting position of a string inside another string |
|
|
Calculates the number of matches of a regular expression |
|
|
Returns the start position of a regular expression match in an argument |
Datetime Functions
Oracle |
SQream |
Description |
---|---|---|
|
NA |
Returns a number of months are added to a specified date |
NA |
|
This function is equivalent to CURRENT_DATE |
|
|
Returns the current date as DATE |
|
|
Equivalent to |
|
NA |
Returns the value of the database time zone |
|
|
ANSI syntax for extracting date or time element from a date expression |
|
NA |
Converts a timestamp value and a time zone |
|
|
Returns the last day of the month in which the specified date value falls |
NA |
|
Returns the current date and time in the session time zone |
|
|
Returns the number of months between specified date values |
|
NA |
returns the date and time in time zone |
|
NA |
Returns the date of the first weekday that is later than a specified data |
|
NA |
Converts n to an INTERVAL DAY TO SECOND literal |
|
NA |
Converts number n to an INTERVAL YEAR TO MONTH literal |
|
NA |
Changing the time zone data file |
|
NA |
Changing the time zone data file for specify error handling |
|
NA |
Changing the time zone data file for takes as an argument a datetime |
|
|
Rounds an argument down to the nearest integer, or an arbitrary precision |
|
NA |
Returns the time zone of the current session |
|
NA |
extracts the UTC from a datetime value with time zone offset |
|
|
Equivalent to |
|
|
Returns the current timestamp |
|
NA |
Converts a date value to a string in a specified format |
|
NA |
Converts datatype to a value of TIMESTAMP datatype |
|
NA |
Converts datatype to a value of TIMESTAMP WITH TIME ZONE datatype |
|
NA |
Converts a character string of CHAR datatype |
|
NA |
Converts a character string of CHAR datatype |
|
|
Truncates a date element down to a specified date or time element |
|
NA |
Returns the time zone offset |
NA |
|
Adds or subtracts an interval to |
NA |
|
Calculates the difference between two DATE or DATETIME expressions, in terms of a specific date part |
NA |
|
Extracts a date or time part from a |
NA |
|
Returns the current date and time of the system |
NA |
|
Converts a |
NA |
|
Converts a |
General Comparison Functions
Oracle |
SQream |
Description |
---|---|---|
|
NA |
Returns the greatest of a list of one or more expressions |
|
NA |
Returns the least of a list of one or more expressions |
Aggregate Functions
Oracle |
SQream |
Description |
---|---|---|
|
|
Calculates the average of all of the values |
|
NA |
Detect changes in a table |
|
NA |
Takes as its argument a column of any type and creates a nested table |
|
|
Calculates the Pearson correlation coefficient |
|
|
Calculates the count of all of the values or only distinct values |
|
|
Calculates population covariance of values |
|
|
Calculates sample covariance of values |
|
|
Calculates the cumulative distribution of a value in a group of values |
|
|
The FIRST_VALUE function returns the value located in the selected column of the first row of a segment |
|
NA |
Distinguishes duplicate groups resulting from a GROUP BY specification |
|
NA |
Distinguishes superaggregate rows from regular grouped rows |
|
NA |
Returns a number corresponding to the GROUPING bit vector associated with a row |
|
|
The LAST_VALUE function returns the value located in the selected column of the last row of a segment |
NA |
|
The NTH_VALUE function returns the value located in the selected column of a specified row of a segment |
|
|
Returns maximum value of all values |
|
NA |
Calculates the median value of a column |
|
|
Returns minimum value of all values |
NA |
|
Divides an ordered data set into a number of buckets |
|
|
Inverse distribution function that assumes a continuous distribution model |
|
|
Inverse distribution function that assumes a discrete distribution model |
|
|
Range of values returned by PERCENT_RANK is 0 to 1, inclusive |
|
|
Calculates the rank of a value in a group of values |
|
|
Computes the rank of a row in an ordered group of rows |
|
NA |
Exact probability test used for dichotomous variables |
|
NA |
Method used to analyze two nominal variables |
|
NA |
Tests whether two variances are significantly different |
|
NA |
Kolmogorov-Smirnov function that compares two samples to test |
|
NA |
Takes as its argument a set of values and returns the value |
|
|
Returns the population standard deviation of all input values |
|
|
Calculates population standard deviation of values |
|
|
Calculates sample standard deviation of values |
|
|
Calculates the sum of all of the values or only distinct values |
|
|
Calculates population variance of values |
|
|
Calculates sample variance of values |
|
|
Returns the variance of expr |
Analytic Functions
Oracle |
SQream |
Description |
---|---|---|
NA |
|
The |
|
NA |
Returns feature details for each row in the selection |
|
NA |
Returns the identifier of the highest value feature for each row |
|
NA |
Returns a set of feature ID and feature value pairs for each row |
|
NA |
Returns a feature value for each row in the selection |
|
|
Returns a value from a subsequent row within the partition of a result set |
|
|
Returns a value from a previous row within the partition of a result set |
|
NA |
Returns a prediction for each row in the selection |
|
NA |
Returns prediction details for each row in the selection |
|
NA |
Returns prediction details for each row in the selection |
|
NA |
Returns a probability for each row in the selection |
|
NA |
Returns a set of predictions with either probabilities or costs for each row |
|
|
Assigns a unique number to each row to which it is applied |