再请教

[复制链接]
查看11 | 回复3 | 2004-5-12 13:02:00 | 显示全部楼层 |阅读模式
...............
sname varchar2(20) default 'zhouyong';
.............
select id from person where name=sname;
.................
结果:
ORA-00904: "ZHOUYONG": invalid identifier
请教该怎样写才会拼成诸如
selectid from person where name=’zhouyong‘;
回复

使用道具 举报

千问 | 2004-5-12 13:02:00 | 显示全部楼层
sname varchar2(20) default ( 'zhouyong');
是不是这个缘故阿
回复

使用道具 举报

千问 | 2004-5-12 13:02:00 | 显示全部楼层
不是,我拼的结果是:
select id from person where name=zhouyong;
回复

使用道具 举报

千问 | 2004-5-12 13:02:00 | 显示全部楼层
部分实现:
TYPE refcursorIS REF CURSOR;
c1 refcursor;
..........
str := 'select id from person where name ='''||sname||'''';
open c1 for str;
fetch c1 into var_id;
.......................................
上帝这点问题居然花费了我两天时间,哦,笨小孩!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行