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;
相關文章
相關標籤/搜索