How to stop query in QA from continuing

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • diego

    How to stop query in QA from continuing

    Greetings everyone!

    Is there a way to stop query analyzer from processing remaining query
    statements? Let's say i have the following query in query analyzer:

    query statements
    if condition
    begin
    query statements
    stop the query
    end

    query statements
    if condition
    begin
    query statements
    stop the query
    end

    is there a way to stop the query from executing the statements in the
    second query when the first condition is met?

    i have searched BOL and google but i couldn't find anything. I hope
    anybody out there can help me.

    BTW, i'm executing this statements directly in QA, not from within my
    program. The query statement and if condition pair is plenty. i guess i
    can use an else statement but it would be nested too deep. if there is
    a simpler way to do it please point me to the right direction or to any
    link that'll get me going.

    Thanks in advance.

    diego

  • Plamen Ratchev

    #2
    Re: How to stop query in QA from continuing

    You can use GOTO. It will look like this:

    query statements
    if condition
    begin
    query statements
    GOTO ExitQuery
    end

    query statements
    if condition
    begin
    query statements
    GOTO ExitQuery
    end

    ExitQuery:
    GO

    Be aware that GOTO cannot go to a label outside of the batch.

    Regards,

    Plamen Ratchev


    "diego" <diegobph@yahoo .comwrote in message
    news:1168144191 .844124.221930@ 11g2000cwr.goog legroups.com...
    Greetings everyone!
    >
    Is there a way to stop query analyzer from processing remaining query
    statements? Let's say i have the following query in query analyzer:
    >
    query statements
    if condition
    begin
    query statements
    stop the query
    end
    >
    query statements
    if condition
    begin
    query statements
    stop the query
    end
    >
    is there a way to stop the query from executing the statements in the
    second query when the first condition is met?
    >
    i have searched BOL and google but i couldn't find anything. I hope
    anybody out there can help me.
    >
    BTW, i'm executing this statements directly in QA, not from within my
    program. The query statement and if condition pair is plenty. i guess i
    can use an else statement but it would be nested too deep. if there is
    a simpler way to do it please point me to the right direction or to any
    link that'll get me going.
    >
    Thanks in advance.
    >
    diego
    >

    Comment

    • diego

      #3
      Re: How to stop query in QA from continuing

      Thank you.

      Ayon kay Plamen Ratchev:
      You can use GOTO. It will look like this:
      >
      query statements
      if condition
      begin
      query statements
      GOTO ExitQuery
      end
      >
      query statements
      if condition
      begin
      query statements
      GOTO ExitQuery
      end
      >
      ExitQuery:
      GO
      >
      Be aware that GOTO cannot go to a label outside of the batch.
      >
      Regards,
      >
      Plamen Ratchev

      >
      "diego" <diegobph@yahoo .comwrote in message
      news:1168144191 .844124.221930@ 11g2000cwr.goog legroups.com...
      Greetings everyone!

      Is there a way to stop query analyzer from processing remaining query
      statements? Let's say i have the following query in query analyzer:

      query statements
      if condition
      begin
      query statements
      stop the query
      end

      query statements
      if condition
      begin
      query statements
      stop the query
      end

      is there a way to stop the query from executing the statements in the
      second query when the first condition is met?

      i have searched BOL and google but i couldn't find anything. I hope
      anybody out there can help me.

      BTW, i'm executing this statements directly in QA, not from within my
      program. The query statement and if condition pair is plenty. i guess i
      can use an else statement but it would be nested too deep. if there is
      a simpler way to do it please point me to the right direction or to any
      link that'll get me going.

      Thanks in advance.

      diego

      Comment

      • dmarkle

        #4
        Re: How to stop query in QA from continuing

        You could also use "RETURN".

        -Dave


        diego wrote:
        Thank you.
        >
        Ayon kay Plamen Ratchev:
        You can use GOTO. It will look like this:

        query statements
        if condition
        begin
        query statements
        GOTO ExitQuery
        end

        query statements
        if condition
        begin
        query statements
        GOTO ExitQuery
        end

        ExitQuery:
        GO

        Be aware that GOTO cannot go to a label outside of the batch.

        Regards,

        Plamen Ratchev


        "diego" <diegobph@yahoo .comwrote in message
        news:1168144191 .844124.221930@ 11g2000cwr.goog legroups.com...
        Greetings everyone!
        >
        Is there a way to stop query analyzer from processing remaining query
        statements? Let's say i have the following query in query analyzer:
        >
        query statements
        if condition
        begin
        query statements
        stop the query
        end
        >
        query statements
        if condition
        begin
        query statements
        stop the query
        end
        >
        is there a way to stop the query from executing the statements in the
        second query when the first condition is met?
        >
        i have searched BOL and google but i couldn't find anything. I hope
        anybody out there can help me.
        >
        BTW, i'm executing this statements directly in QA, not from within my
        program. The query statement and if condition pair is plenty. i guess i
        can use an else statement but it would be nested too deep. if there is
        a simpler way to do it please point me to the right direction or to any
        link that'll get me going.
        >
        Thanks in advance.
        >
        diego
        >

        Comment

        Working...