Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2012
    Posts
    6

    Unanswered: Need Oracle equivalent Exception syntax in SQL Server

    Hi,
    I have an Oracle procedure and I use exceptions as below.

    Create procedure xyx( name in varchar2) as
    Invalid_Name Exception;

    BEGIN

    if /*some condition*/ then
    Raise Invalid_Name;
    end if;

    --- Other procedure code
    --- Other procedure code

    EXCEPTION
    WHEN Invalid_Name THEN
    /* Print something */

    END;



    How can I write this in SQL server? What is the syntax?


    Thanks,
    Raghvendra

  2. #2
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    http://msdn.microsoft.com/en-US/library/ms175976%28v=sql.90%29.aspx
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

    Tips for good questions:

    http://tkyte.blogspot.de/2005/06/how...questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

Posting Permissions

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