h2 { margin-top: 0.46cm; margin-bottom: 0.46cm; direction: ltr; line-height: 173%; text-align: justify; page-break-inside: avoid }
h2.western { font-family: "Cambria", serif; font-size: 16pt }
h2.cjk { font-family: "宋体"; font-size: 16pt }
h2.ctl { font-size: 16pt }
h1 { margin-top: 0.6cm; margin-bottom: 0.58cm; direction: ltr; line-height: 241%; text-align: justify; page-break-inside: avoid }
h1.western { font-family: "Calibri", serif; font-size: 22pt }
p { margin-bottom: 0.25cm; direction: ltr; line-height: 120%; text-align: justify }
源代码
CREATE --============================================= --1.0 FUNCTION --1.1 FUNCTION --1.2 FUNCTION --2.0 FUNCTION --2.1 FUNCTION --2.2 FUNCTION --3.0 FUNCTION --3.1 FUNCTION --3.2 FUNCTION --4.0 FUNCTION --4.1 FUNCTION --4.2 FUNCTION END / CREATE --============================================= --1.0 FUNCTION p_Len p_Char p_Sub_Out p_Sub_Str p_Out p_Integrity p_Errstr BEGIN IF THEN RETURN END IF THEN p_Errstr RAISE END --得到基本数据 p_Len FOR LOOP p_Char SELECT 'A', 10, 'B', 11, 'C', 12, 'D', 13, 'E', 14, 'F', 15, To_Number(p_Char)) INTO FROM p_Sub_Str p_Out END -- RETURN EXCEPTION WHEN Raise_Application_Error(-20001, END --1.1 FUNCTION p_Out p_Integrity p_Errstr BEGIN --得到基本数据 p_Out -- RETURN EXCEPTION WHEN Raise_Application_Error(-20001, END --1.2 FUNCTION p_Len p_Char p_Sub_Out p_Sub_Str p_Out p_Integrity p_Errstr BEGIN IF THEN RETURN END IF THEN p_Errstr RAISE END --得到基本数据 p_Len FOR LOOP p_Char SELECT '0', '0000', '1', '0001', '2', '0010', '3', '0011', '4', '0100', '5', '0101', '6', '0110', '7', '0111', '8', '1000', '9', '1001', 'A', '1010', 'B', '1011', 'C', '1100', 'D', '1101', 'E', '1110', 'F', '1111', '2222') INTO FROM p_Sub_Str p_Out END -- RETURN EXCEPTION WHEN Raise_Application_Error(-20001, END --2.0 FUNCTION p_Out p_Integrity p_Errstr BEGIN --得到基本数据 p_Out -- RETURN EXCEPTION WHEN Raise_Application_Error(-20001, END --2.1 FUNCTION p_Out p_Integrity p_Errstr BEGIN --得到基本数据 p_Out -- RETURN EXCEPTION WHEN Raise_Application_Error(-20001, END --2.2 FUNCTION p_Sub_Out p_Sub_Dec p_Out p_Integrity p_Errstr BEGIN IF THEN RETURN END IF THEN p_Errstr RAISE END LOOP p_Sub_Out p_Sub_Dec p_Out EXIT END -- RETURN EXCEPTION WHEN Raise_Application_Error(-20001, END --3.0 FUNCTION p_Out p_Integrity p_Errstr BEGIN --得到基本数据 p_Out -- RETURN EXCEPTION WHEN Raise_Application_Error(-20001, END --3.1 FUNCTION p_Len p_Char p_Sub_Out p_Sub_Str p_Out p_Integrity p_Errstr BEGIN IF THEN RETURN END IF THEN p_Errstr RAISE END --得到基本数据 p_Len FOR LOOP p_Char p_Sub_Out p_Sub_Str p_Out END -- RETURN EXCEPTION WHEN Raise_Application_Error(-20001, END --3.2 FUNCTION p_Len p_Char p_Sub_Out p_Sub_Str p_Out p_Integrity p_Errstr BEGIN IF THEN RETURN END IF THEN p_Errstr RAISE END --得到基本数据 p_Len FOR LOOP p_Char SELECT '0', '000', '1', '001', '2', '010', '3', '011', '4', '100', '5', '101', '6', '110', '7', '111', '222') INTO FROM p_Sub_Str p_Out END -- RETURN EXCEPTION WHEN Raise_Application_Error(-20001, END --4.0 FUNCTION p_Len p_Char p_Sub_Out p_Sub_Str p_Out p_Integrity p_Errstr BEGIN IF THEN RETURN END IF THEN p_Errstr RAISE END --得到基本数据 p_Len FOR LOOP p_Char SELECT '0000', '0', '0001', '1', '0010', '2', '0011', '3', '0100', '4', '0101', '5', '0110', '6', '0111', '7', '1000', '8', '1001', '9', '1010', 'A', '1011', 'B', '1100', 'C', '1101', 'D', '1110', 'E', '1111', 'F', 'G') INTO FROM p_Sub_Str p_Out END -- RETURN EXCEPTION WHEN Raise_Application_Error(-20001, END --4.1 FUNCTION p_Len p_Char p_Sub_Out p_Sub_Str p_Out p_Integrity p_Errstr BEGIN IF THEN RETURN END IF THEN p_Errstr RAISE END --得到基本数据 p_Len FOR LOOP p_Char p_Sub_Out p_Sub_Str p_Out END -- RETURN EXCEPTION WHEN Raise_Application_Error(-20001, END --4.2 FUNCTION p_Len p_Char p_Sub_Out p_Sub_Str p_Out p_Integrity p_Errstr BEGIN IF THEN RETURN END IF THEN p_Errstr RAISE END --得到基本数据 p_Len FOR LOOP p_Char SELECT '000', '0', '001', '1', '010', '2', '011', '3', '100', '4', '101', '5', '110', '6', '111', '7', '9') INTO FROM p_Sub_Str p_Out END -- RETURN EXCEPTION WHEN Raise_Application_Error(-20001, END END / |
16进制转10进制
SQL> BASE_NUM_CHANGE.HEX_TO_DEC('ABC') --------------------------------- 2748 |
10进制转2进制
SQL> BASE_NUM_CHANGE.DEC_TO_BIN(2748) ------------------------------------------------------------------------------------------------- 101010111100 |
2进制转10进制
SQL> BASE_NUM_CHANGE.BIN_TO_DEC(101010111100) ---------------------------------------- 2748 |
2进制转16进制
SQL> BASE_NUM_CHANGE.BIN_TO_HEX(101010111100) ------------------------------------------------------------------------------------------------- ABC 其实,Oracle自带函数 SQL> TO_NUMBER('ABC','XXX') 2748 |
10进制转16进制
SQL> BASE_NUM_CHANGE.DEC_TO_HEX(2748) ------------------------------------------------------------------------------------------------- ABC 其实,Oracle自带to_char()函数 SQL> TO_C ---- ABC |
16进制转2进制
SQL> BASE_NUM_CHANGE.HEX_TO_BIN('ABC') -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 101010111100 |