开发者社区> 问答> 正文

%TYPE and %ROWTYPE data types in PL/SQL?

已解决

What is the importance of %TYPE and %ROWTYPE data types in PL/SQL?

展开
收起
1780169608831412 2021-10-16 18:06:16 618 0
1 条回答
写回答
取消 提交回答
  • 网络规划设计师、敏捷专家、CISP、ITSS服务经理、ACA全科目、ACP4项、ACE、CBP、CDSP、CZTP等。拥有 PRINCE2 Foundation/Practitioner、CCSK、ITIL、ISO27001、PMP等多项国际认证。 专利5+、期刊10+、知识产权师。核心期刊审稿人。
    采纳回答

    %TYPE: This declaration is used for the purpose of anchoring by providing the data type of any variable, column, or constant. It is useful during the declaration of a variable that has the same data type as that of its table column. Consider the example of declaring a variable named ib_employeeid which has the data type and its size same as that of the column employeeid in table ib_employee. The syntax would be :

    ib_employeeid ib_employee.employeeid%TYPE;
    
    

    %ROWTYPE: This is used for declaring a variable that has the same data type and size as that of a row in the table. The row of a table is called a record and its fields would have the same data types and names as the columns defined in the table. For example: In order to declare a record named ib_emprecord for storing an entire row in a table called ib_employee, the syntax is:

    ib_emprecord ib_employee%ROWTYPE;
    
    2021-10-16 18:22:15
    赞同 2 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
SQL Server在电子商务中的应用与实践 立即下载
GeoMesa on Spark SQL 立即下载
原生SQL on Hadoop引擎- Apache HAWQ 2.x最新技术解密malili 立即下载