Is it possible to use the same name of a column as a parameter name in a cursor?

0

I have the following cursor:

-- CÓDIGO OMITIDO
    DECLARE
      CURSOR CUR_AULAS(IDTURMA NUMBER) IS
      SELECT ID, IDCLIENTE
        FROM AULAS
      WHERE
        ATIVO = 1 
        AND IDTURMA = IDTURMA;

It will always return true as it thinks I'm filtering the column itself (IDTURMA) and not by the parameter, if I change the parameter name works correctly but can I use the same name type a this of Java? p>     

asked by anonymous 24.03.2017 / 15:38

1 answer

1

Because of Oracle documentation for PL / SQL, when column and (parameters or variables) have the same name, the column takes precedence.

  

If a SQL statement references a name that belongs to both a column and   either a local variable or a formal parameter, then the column name   takes precedence.

     

If an SQL code references a name belonging to a column and a   variable location or parameter, then the column will take precedence.

    
24.03.2017 / 16:22