sql server 改成oracle 代码
declare @name varchar(30)
set @name = 'jiangxiao'
select * from table where name = @name
怎么改成ORACLE?
------解决方案--------------------oracle 里面不能直接查询出结果集,可以建一张临时表,例如:table_tmp
declare v_name varchar2(30);
begin
v_name:= 'jiangxiao';
insert into table_tmp(列...)
select * from table
where name = v_name;
commit;
end;
/
------解决方案--------------------怎么改成ORACLE?
PL/SQL
declare
p_name varchar2(30):='jiangxiao'
r_name varchar2 tableA.name%type;
begin
select *
into r_name
from tableA where name=v_name;
end;
/
sql:
这只是一种实现
define p_name='jiangxiao'
select * from table where name='&p_name'