Syntax understanding pl / sql Oracle 11g

1

I have an Oracle PROC 11g. Inside the proc is something like this:

v_prazo_subs_ans         ts_odo.odo_controle_sistema.val_parametro%type;

Where:

v_prazo_subs_ans is a variable

ts_odo.odo_controle_sistema is the table

val_parametro one field in table

But I do not know what this means: %type after the field name.

What does the above line do or do you mean?

    
asked by anonymous 19.11.2015 / 20:13

1 answer

3

This% Type creates a variable with the same Type (type and size) of the last field, in the case val_parameter of the ts_ode.control_ system_table, the advantage of this call is that if the type or size is changed the variable is changed automatically in the next execution of the routine avoiding errors of type truncamento or types.

A classic example of a field that was VARCHAR2 (30) needed to pass VARCHAR2 (40) with the call to "% type" so objects defined do not need to be reviewed.

    
19.11.2015 / 20:42