求一个有关于字段内容长度的SQL语句或存储过程
现有一个存储过程.要求把TITLE字段里面的内容长度小于指定长度的记录选择出来放出游标.
但是我这样写的不正确.应该怎么写呢?
TopicRecord is ref CURSOR;
Procedure GetBestTopicList(
nPageSize in number,
MaxLength in number,
topicCursor out TopicRecord,
sResult out number
)IS
nLength integer;
Begin
Open topicCursor For
select topicid,title,boardid,locktopic,postusername,postuserid,dateandtime,
hits,votetotal,istop,lastposttime,isbest,isvote,lastpostusername,
lastpostuserid,bbscount,isdelete,bbsboard,topicimg,t_color
From
(
Select topicid,title,boardid,locktopic,postusername,postuserid,dateandtime,
hits,votetotal,istop,lastposttime,isbest,isvote,lastpostusername,
lastpostuserid,bbscount,isdelete,bbsboard,topicimg,t_color
From bbs_tb_bbsTopic t
--下面的lengthb(title) > MaxLength不正确
Where t.isbest = 1 and lengthb(title) > MaxLength
order by t.dateandtime desc
)
where rownum <= nPageSize;
sResult := 0;
exception
when others then
Sresult := -1000104;
return;
END GetBestTopicList;