我现在通过oci写的接口对数据库做操作,操作的sql语句结构是一样的只是数据不同,但是在共享sql区中,每操作一次就有一条记录,请问通过什么方法可以使这些操作在共享sql区中的记录只有一条或几条,请高手帮忙.

解决方案 »

  1.   

    这个好像不是你sql的写法问题了,重复执行同样结构的sql语句oracle就不会重新分析语句,这样效率高。
    但你的用意是什么呢?
      

  2.   

    可不可以考虑使用变量代替——我不知道你的环境下的sql是什么样的select * from table1 where id=1;

    select * from table1 where id=2;
    是不同的n_id := 1;
    select * from table1 where id=n_id;和
    n_id := 2;
    select * from table1 where id=n_id;是可以使用共享的
      
      

  3.   

    我通过oci程序调用的就是象
    select * from table1 where id=1;

    select * from table1 where id=2;
    这样的sql语句那oci程序怎么实现变量替代,使用可共享的sql?
      

  4.   

    n_id := 1;
    select * from table1 where id=n_id;和
    n_id := 2;
    select * from table1 where id=n_id;是可以使用共享的
      

  5.   

    n_id := 1;
    select * from table1 where id=n_id;和
    n_id := 2;
    select * from table1 where id=n_id;是可以使用共享的,这个我是知道的我是想问一下oci中的实现方法