user5279503
user5279503

Reputation:

what's meaning %type on the Oracle?

I have a stored procedure(Oracle 11g) and inside the Procedure I have this line.

v_prazo_subs_ans         ts_odo.odo_controle_sistema.val_parametro%type; 

Where I have:

My variable: v_prazo_subs_ans

My table: ts_odo.odo_controle_sistema

The field of my table: val_parametro

What does %type after the name of the field mean?

Upvotes: 1

Views: 200

Answers (1)

are
are

Reputation: 2615

%TYPE

Represents the datatype of a previously declared collection, cursor variable, field, object, record, database column, or variable.

in other words instead of using VARCHAR2, NUMBER, etc... you can just say the parameter of my procedure has same type as a column. this is really useful when you need change type of column in your table, you don't need make any changes in your pl/sql code

see docs here:

Constant and Variable Declaration

Procedure Declaration

Upvotes: 4

Related Questions