Oracle动态sql

带参数和返回值的:sql

 declare
 count_id integer;
 temp_id integer;
 begin
 temp_id := 1;
 execute immediate 'select count(*) from table where id =:1'
    into count_id
    using temp_id;
 dbms_output.put_line(count_id);
 end;

不带参数:code

 declare
 count_id integer;
 begin
 execute immediate 'select count(*) from table'
    into count_id;
 dbms_output.put_line(count_id);
 end;
相关文章
相关标签/搜索