发博文
个人资料
陆沉
陆沉
  • 博客等级:
  • 博客积分:10
  • 博客访问:662
  • 关注人气:0
分类
访客
加载中…
音乐播放器
博文
(2009-04-19 12:07)
标签:

oracle

分类: Oracle

declare
  pos  number;
  pos1 number;
  pos2 number;
  num  number;
  matchid varchar2(1000);
begin
  pos1 := 1;
  num := 1;
  matchid:='123,123123.sd234as,asaaa';
  loop  
    if (pos is not null) then
      pos1 := pos + 1;
    end if;
    pos := instr(matchid, ',',1,num);
    pos2 := pos - pos1;
    if (pos = 0 and num!=1) then
      pos2 := length(matchid);
    end if;
    if (trim(substr(matchid, pos1, pos2)) is not null) then
      DBMS_OUTPUT.PUT_LINE(trim(substr(matchid, pos1, pos2)));
    end if;
    num := num + 1;
    exit when pos is null or pos = 0 o

阅读  ┆ 评论  ┆ 转载 ┆ 收藏 
(2009-04-19 11:33)
标签:

oracle

分类: Oracle

字符函数——返回字符值

这些函数全都接收的是字符族类型的参数(CHR除外)并且返回字符值.

除了特别说明的之外,这些函数大部分返回VARCHAR2类型的数值.

字符函数的返回类型所受的限制和基本数据库类型所受的限制是相同的。

字符型变量存储的最大值:

VARCHAR2数值被限制为2000字符(ORACLE 8中为4000字符)

CHAR数值被限制为255字符(在ORACLE8中是2000)

long类型为2GB

Clob类型为4GB

1、CHR

语法: chr(x)

功能:返回在数据库字符集中与X拥有等价数值的字符。CHR和ASCII是一对反函数。经过CHR转换后的字符再经过ASCII转换又得到了原来的字

符。

使用位置:过程性语句和SQL语句。


2、CONCAT

语法: CONCAT(string1,string2)

功能:返回string1,并且在后面连接string2。

使用位置:过程性语句和SQL语句。


3、INITCAP

语法:INITCAP(string)

功能

阅读  ┆ 评论  ┆ 转载 ┆ 收藏 
  

新浪BLOG意见反馈留言板 不良信息反馈 电话:4006900000 提示音后按1键(按当地市话标准计费) 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 会员注册 | 产品答疑

新浪公司 版权所有