请高手指点,当点保存按钮的时候首先想判断在textbox1中输入的YPBH这个字段是否重复,然后顺序录入下面的一些字段,怎么做?

解决方案 »

  1.   

    查找是否有相同的记录 
    select count(YPBH) from table where YPBH='df'
    'df'表示textbox1的值
    如果记录数大于1就有重复的
      

  2.   

    你的问题不清楚“然后顺序录入下面的一些字段”什么意思?
    要是没其他数据的话 建个构成应该可以了。
    通过flag_out来判断是否操作成功
    create or replace procedure test(YPBH_in in integer, flag_out  out integer)
    is
    begin
      select count(YPBH) into YPBH_in from tb;
      if YPBH_in > 0 then
        flag_out:=0;
      elsif YPBH_in = 0 then
        insert into tb(YPBH) values(YPBH_in);
        commit;
        flag_out:=1;
      end if
    end test;