sqlplus执行存储过程和sql语句

1、执行带有输出类型参数的存储过程

set serveroutput on;
DECLARE
    dwbh varchar2(20);
    out_param  varchar2(1000);
BEGIN
    dwbh:='3609000001';
    pkg_znpj.znpj_zf(dwbh,out_param);
    dbms_output.put_line(out_param);
END;
/

2、直接输出一句话

set serveroutput on;
begin  
dbms_output.put_line( 'hello! ');
end;
/


3、执行带外部参数的sql语句,并输出结果

set serveroutput on;
DECLARE
 mc number; 
BEGIN
select distinct TO_CHAR(SYSDATE,'DDD') into mc FROM fhjczg_fhxc;
 dbms_output.put_line(mc);
END;
/


select  TO_CHAR(SYSDATE,'DDD')  FROM dual

set serveroutput on;
DECLARE
    xfjgbh varchar2(20);
BEGIN
    xfjgbh:='100003';
    pkg_zdpj.znpj_zdpj(xfjgbh);
END;
/

你可能感兴趣的:(sqlplus)