oracle中
不管是函数、存储过程、还是游标操作都标准的格式三步曲,应该是四个东西
declare ... begin .... exception ....最后end
declare empno number(4) := 7369; str varchar2(100); emprow emp%rowtype; dexc exception; begin str := 'select * from emp where empno=:no'; --execute immediate 'create table dy_tab(id number(5) constraints pk_dy_tab primary key,name varchar2(20))'; RAISE_APPLICATION_ERROR(-20888,'test test test'); --raise dexc; execute immediate str into emprow using empno; dbms_output.put_line(emprow.empno||':'||emprow.ename||':'||emprow.sal); exception when dexc then begin dbms_output.put_line('hello'); end; when others then dbms_output.put_line('没有值被赋!'); end;