Announcement

Collapse
No announcement yet.

Sql query is not updated if the new query returns the same columns

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sql query is not updated if the new query returns the same columns

    Take a look to these tables

    TABLE_A
    - name
    - address

    TABLE_B
    - name
    - country

    Now, I will create a query in purpose to select a column that does not exists in a table

    SELECT a.name, a.country
    FROM TABLE_A a, TABLE_B b
    WHERE a.name = b.name

    Take a look how I am selecting the country from table a, but it does not exists in this table, as a result ScriptCase will display a error as expected. Now, fix the select:

    SELECT a.name, b.country
    FROM TABLE_A a, TABLE_B b
    WHERE a.name = b.name

    As you can see the result's structure stills the same, but it is returned from another table, the query now is correct. However, ScriptCase "thinks" that is the same query, so it does not apply the changes, this can be confirmed by setting the debug mode to true and seeing the old query there.

  • #2
    Another example:

    I have entered this sql query:

    Code:
    SELECT ACCION, TPO_ACCION, ENLACE,
    ESTADO_ACCION_FORMATIVA('[cedula]', A.ACCION) AS ESTADO, competencia
      FROM SRH257
     WHERE COMPETENCIA = '[competencia]'
       AND COD_GRADO <= '[esperado_cualitativo]'
       AND EDO_ACCION = 'A'
    The column A.ACCION does not exists because the table has not alias, so ScriptCase advised me of this error after save. So, I proceed to fix it:

    Code:
    SELECT ACCION, TPO_ACCION, ENLACE,
    ESTADO_ACCION_FORMATIVA('[cedula]', ACCION) AS ESTADO, competencia
      FROM SRH257
     WHERE COMPETENCIA = '[competencia]'
       AND COD_GRADO <= '[esperado_cualitativo]'
       AND EDO_ACCION = 'A'
    Now, it compiles good, but SC stills executing the old query. The worse thing is that is not easy to work around this issue.

    Comment

    Working...
    X