Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2012

    Unanswered: exception handling for column not found

    i am trying to delete a row based on a condition
    when the column is not found in the table i want to perform delete based on another column name

    i did this using exception when others i need a good solution for it

    delete from tmp_tbl where id=1332;


    when others then
    delete from tmp_tbl where name='raj';

    but here exception can be any thing can i catch the exception for column not found

  2. #2
    Join Date
    Aug 2003
    Where the Surf Meets the Turf @Del Mar, CA
    Provided Answers: 1
    >but here exception can be any thing can i catch the exception for column not found
    column not found or row not found?
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Nov 2003
    Provided Answers: 8
    You won't get a "column not found" exception at runtime, because you won't be able to compile (and thus run) the stored procedure if the column isn't there

  4. #4
    Join Date
    Jan 2004
    Croatia, Europe
    Provided Answers: 4
    Right, except if the statement is used in dynamic SQL.
    SQL> create or replace procedure prc_test as
      2  begin
      3    execute immediate ('select dummy from dept where col = 1');
      4  end;
      5  /
    Procedure created.
    SQL> exec prc_test
    BEGIN prc_test; END;
    ERROR at line 1:
    ORA-00904: "COL": invalid identifier
    ORA-06512: at "SCOTT.PRC_TEST", line 3
    ORA-06512: at line 1
    Anyway: what problem are you trying to solve, @siva293?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts