What does “%Type” mean in Oracle sql?

前端 未结 3 863
有刺的猬
有刺的猬 2021-01-30 13:22

I\'m getting my first experience with Oracle and TOAD (I know SSMS). I came across this \"%Type\" next to an input parameter in an update procedure and I have no idea what it is

3条回答
  •  无人共我
    2021-01-30 14:14

    Apart from the purpose pointed by OMG Ponies, %TYPE is also used for inheriting the same data type used by a previously declared variable.

    The syntax is :

     DECLARE
                L_num NUMBER(5,2) NOT NULL default 3.21;
                L_num_Test L_num%TYPE := 1.123;
    

    So there is no need to declare the data type for the second variable i.e L_num_Test.

    Comment if anyone needs further clarification regarding this topic.

    Reference: https://docs.oracle.com/cd/B19306_01/appdev.102/b14261/fundamentals.htm#BEIIGBBF

提交回复
热议问题