添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
微醺的红茶  ·  php linux ...·  2 天前    · 
会开车的滑板  ·  Apache OpenOffice ...·  1 月前    · 
被表白的绿茶  ·  Apache OpenOffice ...·  8 月前    · 
行走的丝瓜  ·  Apache OpenOffice ...·  9 月前    · 
英俊的松球  ·  Apache OpenOffice ...·  9 月前    · 
斯文的紫菜汤  ·  Job Search·  4 月前    · 


User community support forum for Apache OpenOffice, LibreOffice and all the OpenOffice.org derivatives

Hello,
I'm interested in converting an integer to it's hex equivalent. For example the integer value 90 would be converted to 5A
In MySQL the query SELECT HEX( 90 ) returns 5A. I understand there is no equivalent function in HSQLdb, but perhaps there is a workaround using CAST ( or some other function )
Thanks for your help.
eremmel wrote: Depending how far you like to go (large numbers etc). You might define a lookup table with (int,string) from 1 to 255 or even larger and use that. Larger numbers can be broken into groups of 256.
I guess I could do that. Seems awfully inefficient - I don't want to reinvent something that's in a standard library somewhere.
The latest thinking is to use an alias:

Code: Select all

CREATE ALIAS HEX FOR "java.lang.Integer.toHexString"
But, when I use the function, I get the following error:
SQL Status: S1000
Error code: -33
Access is denied: java.lang.Integer.toHexString in statemen [snip]
If, you upgrade your HSQL database engine to HSQL 2.2.8 ( see link below ) . . . you can easily create your own function within HSQL . . . and . . . use the exact same syntax you have described above HEX(90) and it would return 5a .
To create the function, with HSQL 2.2.8 . . . from the Base Menu: T ools -> S QL...

Code: Select all

CREATE FUNCTION HEX(INPUTVALUE INTEGER) RETURNS VARCHAR(500) LANGUAGE JAVA DETERMINISTIC NO SQL EXTERNAL NAME 'CLASSPATH:java.lang.Integer.toHexString';
See the Tutorial by user DACM to upgrade to HSQL 2.2.8 so the above function can be created.
http://forum.openoffice.org/en/forum/vi ... 83&t=17567
I hope this helps, please be sure to let me / us know.
Sliderule
Thanks to add [Solved] in your 1st post Subject (edit button top right) if this issue has been resolved.
Sliderule wrote: If, you upgrade your HSQL database engine to HSQL 2.2.8 ( see link below ) . . . you can easily create your own function within HSQL . . . and . . . use the exact same syntax you have described above
I couldn't figure out the error I was getting and just Connected MySQL and Base. I'm comfortable with that. In my application it allows for a richer interaction with the data.
If that doesn't work out, I'll use your suggestion.
  • ↳   Getting Started Guide for 4.x
  • ↳   Getting Started Guide for 3.x
  • ↳   Install, Setup and Troubleshooting
  • ↳   Admin Guide
  • ↳   MS Windows
  • ↳   Linux
  • ↳   Mac OSX
  • ↳   LibreOffice
  • ↳   Tablets
  • ↳   Tutorials
  • ↳   Writer
  • ↳   Calc
  • ↳   Base
  • Applications
  • ↳   Writer
  • ↳   Writer Guide for 4.x
  • ↳   Writer Guide for 3.x
  • ↳   Writer Tutorials
  • ↳   Templates
  • ↳   Advanced Uses
  • ↳   Calc
  • ↳   Calc Guide for 4.x
  • ↳   Calc Guide for 3.x
  • ↳   Calc Functions
  • ↳   Calc Tutorials
  • ↳   Impress
  • ↳   Impress Guide for 4.x
  • ↳   Impress Guide for 3.x
  • ↳   Draw
  • ↳   Draw Guide for 4.x
  • ↳   Draw Guide for 3.x
  • ↳   Math
  • ↳   Math Guide for 4.x
  • ↳   Math Guide for 3.x
  • ↳   Math Guide for 3.x
  • ↳   Base
  • ↳   Base Guide for 4.x
  • ↳   Wiki
  • ↳   Base Tutorials
  • ↳   Tables & Queries
  • ↳   Forms
  • ↳   External Data Sources
  • ↳   Reporting
  • ↳   Database Examples
  • Customizing and Extending
  • ↳   Macros and UNO API
  • ↳   Basic Guide
  • ↳   Code Snippets
  • ↳   Extension Repository
  • ↳   Macro Repository
  • ↳   External Programs
  • ↳   Extensions
  • ↳   Extensions page
  • Community
  • ↳   General Discussion
  • ↳   Site Feedback
  • ↳   Forum Governance
  • ↳   User Experience (UX)
  • ↳   Announcements
  • Business
  • ↳   Institutions & Educational
  • ↳   Paid support
  • ↳   Consultants Directory
  •