有一个表 a_stu
写了如下语句
create or replace procedure s1(nid in a_stu.id%type)
is
begin
select name from a_stu where nid=id
end s1;
/
但是创建不成功,这是为什么啊?
谢谢大家了
写了如下语句
create or replace procedure s1(nid in a_stu.id%type)
is
begin
select name from a_stu where nid=id
end s1;
/
但是创建不成功,这是为什么啊?
谢谢大家了
is
xx a_stu.name%type
begin
select name
into xx
from a_stu where id = nid
end s1;
is
xx a_stu.name%type;
begin
select name
into xx
from a_stu where id = nid;
end s1;
is
begin
select name from a_stu where id=nid;
end s1;
至少需要定义一个变量,然后select...into...,把需要返回的值赋给变量
is
begin
execute immediate 'select name from a_stu where id=:id' using id;
end s1;这样也可以
is
xx a_stu.name%type;
begin
select name
into xx
from a_stu where id = nid;
end s1;
为什么第三行需要加上一个‘;’ 才正确?
is
xx a_stu.name%type;
begin
select name
into xx
from a_stu where id = nid;
end s1;
为什么第三行需要加上一个‘;’ 才正确?
==========================
这个是语法规范 :-)