PL / SQL的基础转换,而无需功能 [英] PL/SQL base conversion without functions

查看:165
本文介绍了PL / SQL的基础转换,而无需功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法十进制转换为二进制,或者二进制到十进制,在Oracle 10g中,而无需首先定义一个函数?我有限的数据库访问(仅适用于SELECT),为此,我在网上找到的所有解决方案似乎包括 CREATE FUNCTION ,它不为我工作。

Is there any way to convert decimal to binary, or binary to decimal, in Oracle 10g without having to first define a function? I have limited database access (SELECT only) and all the solutions for this I've found online seem to involve CREATE FUNCTION, which does not work for me.

推荐答案

如果十六进制的足够好,那么TO_CHAR和TO_NUMBER可以工作:

If hexadecimal is good enough, then TO_CHAR and TO_NUMBER can work:

SQL> select to_char(31, '0x') from dual;

TO_
---
 1f

SQL> select to_number('1f', '0x') from dual;

TO_NUMBER('1F','0X')
--------------------
                  31

您可能能够使用 RAWTOHEX() HEXTORAW()功能,使六角二进制过渡为好。

You may be able to use the RAWTOHEX() and HEXTORAW() functions to make the hex to binary transition as well.

这篇关于PL / SQL的基础转换,而无需功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆