convert为什么报错?

tian790317 2009-10-07 11:41:35
select convert('abc',NCHAR(40),char) from dal

或是oracle中convert怎么用,给出个具体例子`
...全文
465 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
zswangg 2010-04-11
  • 打赏
  • 举报
回复
oracle中转换字符串的函数是:to_char.
数据娃掘 2009-10-10
  • 打赏
  • 举报
回复
convert 是字符转码函数
Dave 2009-10-10
  • 打赏
  • 举报
回复
Oracle确实没有convert函数,只有to_char() 和 to_date()...

sql: CONVERT(VARCHAR(10),GETDATE(),111)
oracle: to_char(sysdate,'yyyy/mm/dd')
dawugui 2009-10-07
  • 打赏
  • 举报
回复
[Quote=引用楼主 tian790317 的回复:]
select convert('abc',NCHAR(40),char) from dal

或是oracle中convert怎么用,给出个具体例子`

[/Quote]
如果是abc,不需要转.直接使用.

另convert是ms sql的函数,oracle中转换字符串的函数是:to_char.

因为'abc'本身已经是字符串,不需要转换.
cosio 2009-10-07
  • 打赏
  • 举报
回复
CONVERT 

SYNTAX:

CONVERT(char, dest_char_set [,source_char_set] )

PURPOSE:

Converts a character string from one character set to another.

The char argument is the value to be converted.

The dest_char_set argument is the name of the character set to which
char is converted.

The source_char_set argument is the name of the character set in
which char is stored in the database. The default value is the

database character set.

Both the destination and source character set arguments can be
either literals or columns containing the name of the character set.

For complete correspondence in character conversion, it is essential
that the destination character set contains a representation of all
the characters defined in the source character set. Where a
character does not exist in the destination character set, a

replacement character appears. Replacement characters can be
defined as part of a character set definition.

Common character sets include:

US7ASCII
US 7-bit ASCII character set
WE8DEC
DEC West European 8-bit character set
WE8HP
HP West European Laserjet 8-bit character set
F7DEC
DEC French 7-bit character set
WE8EBCDIC500
IBM West European EBCDIC Code Page 500

WE8PC850
IBM PC Code Page 850
WE8ISO8859P1
ISO 8859-1 West European 8-bit character set

EXAMPLE:

SELECT CONVERT('Grob','WE8HP','WE8DEC') "Conversion"
FROM DUAL

Conversion
----------
Grob
cosio 2009-10-07
  • 打赏
  • 举报
回复
没有这个函数,这个函数是MS SQL


select to_char('abc') from dual;
xiaozhangnima 2009-10-07
  • 打赏
  • 举报
回复
这个来学习
小灰狼W 2009-10-07
  • 打赏
  • 举报
回复
select cast('abc' as char(10)) from dual

用cast 来转换类型
robin_ares 2009-10-07
  • 打赏
  • 举报
回复
oracle里convert 是字符转码函数 ,
比如SELECT CONVERT('数据库','UTF8') from dual
和你想要的类型转换搭不上边

3,494

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 高级技术相关讨论专区
社区管理员
  • 高级技术社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧