Can I use UTILS in Oracle?

耗尽温柔 提交于 2019-12-12 21:26:50

问题


I want to ask if I can use the following in Oracle:

UTILS.CONVERT_TO_VARCHAR2

for instance:

SELECT insertData,
       UTILS.CONVERT_TO_VARCHAR2(insertData,10,p_style=>104) insert_short  
  FROM students

If it is not possible to use UTILS package, so which alternative I can use?


回答1:


Basically, yes. My guess is that you've taken some SQL Server T-SQL and run it through the Oracle SQL Developer Translator (Tools - Migration - Scratch Editor) and this is what came out the other side. UTILS is a package which SQL Developer will generate for you if you click on the second icon from the left in the scratch editor - it's a brown package tied up with red string by the looks of it.

This generates a bunch of PL/SQL - Search in it for CONVERT_TO_VARCHAR2 (there are several overloads) and there is the code you can use however you want. You will of course also need to familiarise yourself with GET_FORMAT_FROM_STYLE.

As an aside I can't see how the scratch editor creates the package specification, so you'll need to do this by hand it would seem.



来源:https://stackoverflow.com/questions/19358153/can-i-use-utils-in-oracle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!