oracle存储过程select语句必须带into吗
oracle存储过程select语句必须带into。因为要将查询结果放到变量中,如以下存储过程:
create or replace procedure p_testasv_begintime varchar2(20);v_endtime varchar2(20);v_str varchar2(10);begin v_begintime:=to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'); select 'badkano' into v_str from dual; v_endtime:=to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'); dbms_output.put_line('开始时间为:'||v_begintime); dbms_output.put_line('结束时间为:'||v_endtime);end;其中select 'badkano' into v_str from dual;此句就是将“badkano”放入变量“v_str”中。
oracle中的存储过程里不能直接用select语句吗
可以直接执行SQL语句。只是直接执行的话,无法看到查询后的结果。