Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Semestr2 / 1 - Oracle / Oracle selected docs / SQL reference.pdf
Скачиваний:
24
Добавлен:
12.05.2015
Размер:
11.92 Mб
Скачать

SINH

SIN

Syntax sin::=

SIN ( n )

Purpose

SIN returns the sine of n (an angle expressed in radians).

Examples

The following example returns the sin of 30 degrees:

SELECT SIN(30 * 3.14159265359/180) "Sine of 30 degrees" FROM DUAL;

Sine of 30 degrees

------------------

.5

SINH

Syntax sinh::=

SINH ( n )

Purpose

SINH returns the hyperbolic sine of n.

Examples

The following example returns the hyperbolic sine of 1:

SELECT SINH(1) "Hyperbolic sine of 1" FROM DUAL;

Hyperbolic sine of 1

--------------------

1.17520119

Functions 6-145

SOUNDEX

SOUNDEX

Syntax soundex::=

SOUNDEX ( char )

Purpose

SOUNDEX returns a character string containing the phonetic representation of char. This function lets you compare words that are spelled differently, but sound alike in English.

The phonetic representation is defined in The Art of Computer Programming, Volume 3: Sorting and Searching, by Donald E. Knuth, as follows:

Retain the first letter of the string and remove all other occurrences of the following letters: a, e, h, i, o, u, w, y.

Assign numbers to the remaining letters (after the first) as follows:

b, f, p, v = 1

c, g, j, k, q, s, x, z = 2 d, t = 3

l = 4 m, n = 5 r = 6

If two or more letters with the same number were adjacent in the original name (before step 1), or adjacent except for any intervening h and w, then omit all but the first.

Return the first four bytes padded with 0.

char can be of any of the datatypes CHAR, VARCHAR2, NCHAR, or NVARCHAR2. The return value is the same datatype as char.

Note: This function does not support CLOB data directly. However, CLOBs can be passed in as arguments through implicit data conversion. Please refer to "Datatype Comparison Rules" on page 2-45 for more information.

6-146 Oracle9i SQL Reference

SQRT

Examples

The following example returns the employees whose last names are a phonetic representation of "Smyth":

SELECT last_name, first_name FROM hr.employees

WHERE SOUNDEX(last_name) = SOUNDEX(’SMYTHE’);

LAST_NAME

FIRST_NAME

----------

----------

Smith

Lindsey

Smith

William

SQRT

Syntax sqrt::=

SQRT ( n )

Purpose

SQRT returns the square root of n. The value n cannot be negative. SQRT returns a real number.

Examples

The following example returns the square root of 26:

SELECT SQRT(26) "Square root" FROM DUAL;

Square root

-----------

5.09901951

Functions 6-147

STDDEV

STDDEV

Syntax stddev::=

 

DISTINCT

 

 

 

 

 

 

ALL

 

OVER

(

analytic_clause

)

STDDEV

(

expr

)

 

 

 

See Also: "Analytic Functions" on page 6-10 for information on syntax, semantics, and restrictions

Purpose

STDDEV returns sample standard deviation of expr, a set of numbers. You can use it as both an aggregate and analytic function. It differs from STDDEV_SAMP in that STDDEV returns zero when it has only 1 row of input data, whereas STDDEV_SAMP returns a null.

Oracle calculates the standard deviation as the square root of the variance defined for the VARIANCE aggregate function.

If you specify DISTINCT, then you can specify only the query_partition_ clause of the analytic_clause. The order_by_clause and windowing_ clause are not allowed.

See Also:

"Aggregate Functions" on page 6-8, VARIANCE on page 6-206, and STDDEV_SAMP on page 6-151

"About SQL Expressions" on page 4-2 for information on valid forms of expr

Aggregate Examples

The following example returns the standard deviation of the salaries in the sample hr.employees table:

SELECT STDDEV(salary) "Deviation"

FROM employees;

6-148 Oracle9i SQL Reference

Соседние файлы в папке Oracle selected docs