问题
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