select语句执行后返回记录数的问题

hellokittyhappy 2005-11-28 10:53:33
我想执行完一条select语句看看选择出了几条记录,应该怎样处理呢?
...全文
225 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
lovelihp 2005-11-30
  • 打赏
  • 举报
回复
execute immediate :ls_sql using sqlca; //ls_sql 前加冒号
hellokittyhappy 2005-11-30
  • 打赏
  • 举报
回复
综上
ls_sql = "select * from fzpcno where card = '"+ ls_card+ "'"
execute immediate ls_sql using sqlca;
select @@rowcount
对吗?
lsqkeke 2005-11-29
  • 打赏
  • 举报
回复
select * from 表名 --你的select语句
select @@rowcount --得出查询所得的行数
一手软一手硬 2005-11-29
  • 打赏
  • 举报
回复
你要返回什么,SQLCA里有啊!
hedry 2005-11-29
  • 打赏
  • 举报
回复
如果我在程序中写好了一句sql
ls_sql = "select * from fzpcno where card = '"+ ls_card+ "'"
然后需要运行阿,可使用什么来行呢?又怎么知道运行结果呢?


execute immediate ls_sql using sqlca;
这样就可以运行了!
hygougou 2005-11-28
  • 打赏
  • 举报
回复
用count(字段)比count(*)

运行可快
lxzm1001 2005-11-28
  • 打赏
  • 举报
回复
select count(*) from (select * from where ....) t
lsqkeke 2005-11-28
  • 打赏
  • 举报
回复
用 @@rowcount
xiaoplx 2005-11-28
  • 打赏
  • 举报
回复
在select语名中加入一个字段 count(*)
hellokittyhappy 2005-11-28
  • 打赏
  • 举报
回复
没有更简单的方法吗?好象在java中都可以很简单的获得sql语句的返回值啊?
fancylxb 2005-11-28
  • 打赏
  • 举报
回复
select rownum,字段 from table
xiaoplx 2005-11-28
  • 打赏
  • 举报
回复
DECLARE my_cursor DYNAMIC CURSOR FOR SQLSA ;
ls_sql = "select * from fzpcno where card =?"
PREPARE SQLSA FROM :ls_sql ;
OPEN DYNAMIC my_cursor using : ls_card;
DO WHILE SQLCA.SQLCODE=0
FETCH my_cursor INTO :变量1,:变量2........ ;
LOOP
CLOSE my_cursor ;




xiaoplx 2005-11-28
  • 打赏
  • 举报
回复
要使用动态游标
hellokittyhappy 2005-11-28
  • 打赏
  • 举报
回复
如果我在程序中写好了一句sql
ls_sql = "select * from fzpcno where card = '"+ ls_card+ "'"
然后需要运行阿,可使用什么来行呢?又怎么知道运行结果呢?
lw1a2 2005-11-28
  • 打赏
  • 举报
回复
我上面的说错了

lw1a2 2005-11-28
  • 打赏
  • 举报
回复
select @@rowcount
pmz 2005-11-28
  • 打赏
  • 举报
回复
在PB中可以用
SQLCA.SQLNROWS

1,076

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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