日期:2014-05-16 浏览次数:20994 次
String tmpSql = " where id = '1' ";
String sql = "select * from table "+tmpSql ; //执行这个SQL
SQL> declare
2 v_where_sql varchar2(500);
3 v_sql varchar2(4000);
4 v_ename varchar2(100);
5 begin
6 v_sql := 'select ename from emp';
7 v_where_sql := ' where empno=7499';
8 v_sql := v_sql
------其他解决方案--------------------
v_where_sql;
9 execute immediate v_sql
10 into v_ename;
11 dbms_output.put_line(v_ename);
12 end;
13 /
ALLEN
PL/SQL procedure successfully completed