Fastest way to determine if record exists

前端 未结 11 1187
清歌不尽
清歌不尽 2020-11-29 16:16

As the title suggests... I\'m trying to figure out the fastest way with the least overhead to determine if a record exists in a table or not.

Sample query:

11条回答
  •  不知归路
    2020-11-29 16:51

    create or replace procedure ex(j in number) as
    i number;
    begin
    select id into i from student where id=j;
    if i is not null then
    dbms_output.put_line('exists');
    end if;
    exception
       when no_data_found then
            dbms_output.put_line(i||' does not exists');
    
    end;
    

提交回复
热议问题