最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

Oracle中的类型转换函数

来源:动视网 责编:小采 时间:2020-11-09 11:58:44
文档

Oracle中的类型转换函数

Oracle中的类型转换函数:带小数点的字符串(除小数点外其它的都是数字)转换成数值 TO_NUMBER Converts a string to the NUMBER data type TO_NUMBE 带小数点的字符串(除小数点外其它的都是数字)转换成数值 TO_NUMBER Converts a string to
推荐度:
导读Oracle中的类型转换函数:带小数点的字符串(除小数点外其它的都是数字)转换成数值 TO_NUMBER Converts a string to the NUMBER data type TO_NUMBE 带小数点的字符串(除小数点外其它的都是数字)转换成数值 TO_NUMBER Converts a string to


带小数点的字符串(除小数点外其它的都是数字)转换成数值 TO_NUMBER Converts a string to the NUMBER data type TO_NUMBE

带小数点的字符串(除小数点外其它的都是数字)转换成数值

TO_NUMBER

Converts a string to the NUMBER data type TO_NUMBER([, , ]) RETURN NUMBER

CREATE TABLE test (
testcol VARCHAR2(10));

INSERT INTO test VALUES ('12345.67');

SELECT TO_BINARY_DOUBLE(testcol) BIN_DOUBLE, TO_BINARY_FLOAT(testcol) BIN_FLOAT, TO_NUMBER(testcol) NMBR
FROM test;

Converts a HEX number to FLOAT TO_NUMBER(, );

SELECT TO_NUMBER('0A', 'XX')
FROM dual;

Converts a HEX number to DECIMAL TO_NUMBER(,
'') RETURN ;

SELECT TO_NUMBER(100000,'XXXXXXXX')
FROM dual;

1.语法:TO_NUMBER(string[,format[,nlsparams]])
目的:将CHAR或VARCHAR2类型的string转换为一个NUMBER类型的数值,,如果指定了format,那么string应该遵循相应的数字格式。
2.范例
DECLARE
v_Num NUMBER;
BEGIN
v_Num := TO_NUMBER( '$12345.67 ', '$99999.99 ');
END;

Oracle UTL_RAW

General Information

Source {ORACLE_HOME}/rdbms/admin/utlraw.sql

First Available 7.3.4

Constants

Name Data Type Value

Dependencies 179 objects

SELECT name FROM dba_dependencies
WHERE referenced_name = 'UTL_RAW'
UNION
SELECT referenced_name FROM dba_dependencies
WHERE name = 'UTL_RAW';

Exceptions

Error # Name Description

An arithmetic, conversion, truncation, or size-constraint error. Usually raised by trying to cram a 6 character string into a VARCHAR2(5).

Required Object Privileges GRANT execute on UTL_RAW

GRANT execute ON utl_raw TO UWCLASS;

BIT_AND

Perform bitwise logical "and" of the values in raw r1 with raw r2 and return the "anded" result raw utl_raw.bit_and(r1 IN RAW, r2 IN RAW) RETURN RAW;

SELECT utl_raw.bit_and('0102F3', 'F30201')
FROM dual;

BIT_COMPLEMENT

Perform bitwise logical "complement" of the values in raw and return the "complement'ed" result raw utl_raw.bit_complement(r IN RAW) RETURN RAW;

SELECT utl_raw.bit_complement('0102F3')
FROM dual;

BIT_OR

Perform bitwise logical "or" of the values in raw r1 with raw r2 and return the "or'd" result raw utl_raw.bit_or(r1 IN RAW, r2 IN RAW) RETURN RAW;

SELECT utl_raw.bit_or('0102F3', 'F30201')
FROM dual;

BIT_XOR

Perform bitwise logical "exclusive or" of the values in raw r1 with raw r2 and return the "xor'd" result raw utl_raw.bit_xor(r1 IN RAW, r2 IN RAW) RETURN RAW;

SELECT utl_raw.bit_xor('0102F3', 'F30201')
FROM dual;

CAST_FROM_BINARY_DOUBLE

Return the RAW representation of a binary_double value utl_raw.cast_from_binary_double(n IN BINARY_DOUBLE,
endianess IN PLS_INTEGER DEFAULT 1) RETURN RAW;

SELECT utl_raw.cast_from_binary_double(123.45)
FROM dual;

CAST_FROM_BINARY_FLOAT

Return the RAW representation of a binary_float value utl_raw.cast_from_binary_float(n IN BINARY_FLOAT,
endianess IN PLS_INTEGER DEFAULT 1) RETURN RAW;

SELECT utl_raw.cast_from_binary_float(123.45)
FROM dual;

CAST_FROM_BINARY_INTEGER

Return the RAW representation of a binary_integer value utl_raw.cast_from_binary_integer(
n IN BINARY_INTEGER,
endianess IN PLS_INTEGER DEFAULT 1) RETURN RAW;

SELECT utl_raw.cast_from_binary_integer(100)
FROM dual;

CAST_FROM_NUMBER

Returns the binary representation of a NUMBER in RAW utl_raw.cast_from_number(n IN NUMBER) RETURN RAW;

SELECT utl_raw.cast_from_number(100)
FROM dual;

CAST_TO_BINARY_DOUBLE

文档

Oracle中的类型转换函数

Oracle中的类型转换函数:带小数点的字符串(除小数点外其它的都是数字)转换成数值 TO_NUMBER Converts a string to the NUMBER data type TO_NUMBE 带小数点的字符串(除小数点外其它的都是数字)转换成数值 TO_NUMBER Converts a string to
推荐度:
标签: 转换 中的 类型
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top