create or replace procedure create_table
asbeginexecute immediate 'create table emp
(id number,name varchar2(10)salary number; )';
--动态SQL为DDL语句
insert into empvalues (100,'jacky',5600);
insert into empvalues (101,'rose',3000);
insert into empvalues (102,'john',4500);end create_table;
过程二:
create or replace procedure find_info(p_id number)
asv_name varchar2(10);v_salary number;beginexecute
immediate 'select name,salary from empwhere id=:1'
using p_idreturning into v_name,v_salary;
--动态SQL为查询语句dbms_output.put_line
(v_name '的收入为:'to_char(v_salary));
exceptionwhen others thendbms_output.put_line('找不到相应数据');
end find_info;
过程三:
create or replace procedure find_emp(p_salary number)
asr_emp emp%rowtype;type c_type is ref cursor;c1 c_type;
beginopen c1 for 'select * from empwhere salary >:1'
using p_salary;loopfetch c1 into r_emp;exit when
c1%notfound;dbms_output.put_line
('薪水大于‘to_char(p_salary)’的员工为:‘);
dbms_output.put_line('ID为'to_char(r_emp)'
其姓名为:'r_emp.name);end loop;close c1;end create_table;