问一个sql语句的问题,字段和表能通过变量来传递吗,请看下面例子~~

jekyli 2007-12-29 10:16:19
string table_text,tables
table_text = "name"
tables = "admin"
declare cursor1 cursor for select distinct :table_text from :tables;

这个语句有什么错误,谁能说说

要怎么才能实现字段和表都是通过变量来传递的
...全文
98 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
UltraBejing 2008-04-30
  • 打赏
  • 举报
回复
接分是王道!
jekyli 2008-01-03
  • 打赏
  • 举报
回复
怎么结贴啊,找不到结贴的按钮啊
jlwei888 2007-12-30
  • 打赏
  • 举报
回复
这么写肯定是错误的!
string st
declare my_cursor dynamic cursor for sqlsa;
string str_sql = "select distinct name from admin"
prepare sqlsqa from :str_sql;
open my_cursor ;
fetch my_cursor into :st;//多行的话要循环读取!
close my_cursor;



jlwei888 2007-12-30
  • 打赏
  • 举报
回复
那就结贴
jekyli 2007-12-30
  • 打赏
  • 举报
回复
谢谢ls,我已经解决了,我是跟你这样弄的,呵呵,谢谢了~~~

1,108

社区成员

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

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