过程里怎么定义变量

qad 2009-07-16 10:44:46
testproc是表名,id是字段名
我想用id字段的类型,定义oid变量
可我这么写“oid testproc%id”,提示错误:
Compilation errors for PROCEDURE SCOTT.PROC_TEST

Error: PLS-00208: 标识符 'ID' 不是合法的游标属性
Line: 3
Text: oid testproc%id

Error: PL/SQL: Compilation unit analysis terminated
Line: 1
Text: CREATE OR REPLACE PROCEDURE proc_test

Error: Hint: Parameter 'oid' is declared but never used in 'proc_test'
Line: 3
Text: oid testproc%id


...全文
146 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhliang04 2009-07-21
  • 打赏
  • 举报
回复
来晚了,
edicun 2009-07-20
  • 打赏
  • 举报
回复
看看 inthirties 的例子
lan125709702 2009-07-19
  • 打赏
  • 举报
回复
csuxp2008 正解
seasir123 2009-07-19
  • 打赏
  • 举报
回复
csuxp2008 正解
inthirties 2009-07-17
  • 打赏
  • 举报
回复
SQL> select name from t1;
NAME
------------------------------
中国111111
中国2111111
已选择2行。

SQL> set serverout on;

SQL> declare
2 v_name t1.name%type;
3 begin
4 select name into v_name from t1 where rownum =1;
5 dbms_output.put_line(v_name);
6 end;
7 /
中国111111

PL/SQL 过程已成功完成。
csuxp2008 2009-07-17
  • 打赏
  • 举报
回复
[Quote=引用楼主 qad 的帖子:]
testproc是表名,id是字段名
我想用id字段的类型,定义oid变量
可我这么写“oid testproc%id”,提示错误:
Compilation errors for PROCEDURE SCOTT.PROC_TEST

Error: PLS-00208: 标识符 'ID' 不是合法的游标属性
Line: 3
Text: oid testproc%id

Error: PL/SQL: Compilation unit analysis terminated
Line: 1
Text: CREATE OR REPLACE PROCEDURE proc_test

Error: Hint: Parameter 'oid' is declare…
[/Quote]

oid testproc.id%type
Richard345265669 2009-07-17
  • 打赏
  • 举报
回复
来晚了
lgfaichl 2009-07-17
  • 打赏
  • 举报
回复
csuxp2008 正解

17,086

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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