declare sendname varcher(10) ,senddate date
sendname='张三',senddate =to_date('2011-01-01','yyyy-mm-dd')select * from table1 where fielda=sendname and fieldb=senddate
select * from tableb where fieldc=sendname .....
我的目地就是想定义两个参数,带入到代码段中,这种方式在SQLSERVER中是可以的,请问在ORACLE中怎么写,请给我能执行的代码,别让我意会,因为我的语法关没过
sendname='张三',senddate =to_date('2011-01-01','yyyy-mm-dd')select * from table1 where fielda=sendname and fieldb=senddate
select * from tableb where fieldc=sendname .....
我的目地就是想定义两个参数,带入到代码段中,这种方式在SQLSERVER中是可以的,请问在ORACLE中怎么写,请给我能执行的代码,别让我意会,因为我的语法关没过
sendname:='张三',senddate :=to_date('2011-01-01','yyyy-mm-dd')
cursor l_cursor(sendname varchar,senddate date) is select * from table1 where deptno = no and job=v_job;
v_t1 table1%rowtype;
begin
open l_cursor(20,'CLERK');
loop
fetch l_cursor into v_t1;
exit when l_cursor%notfound;
dbms_output.put_line(v_t1.col1);
end loop;
close l_cursor;
end;
只做了一个,没有测试
declare
sendname varcher(10);
senddate date;
begin
sendname:='张三';
senddate :=to_date('2011-01-01','yyyy-mm-dd');
for i in (select col1,col2,... from table1 where fielda=sendname and fieldb=senddate)
loop
dbms_outout.put_line(i.col1||' '||i.col2||' '||.....);
end loop;for i in (select col1,col2,... from table1 where fieldc=sendname and fieldb=senddate)
loop
dbms_outout.put_line(i.col1||' '||i.col2||' '||.....);
end loop;end;
改成 varchar(10); or varchar2(10);