简体   繁体   English

在HANA中使用定义的数据类型创建数据库视图

[英]Create a database view in HANA with data types defined

When using HANA SQLscript is it possible to create a view with the data types defined or do you need to cast the type in every select statement being used? 使用HANA SQLscript时,是否可以使用定义的数据类型创建视图,还是需要在使用的每个select语句中强制转换类型? Running into some implicit data type issues where HANA doesn't seem to be evaluating all data being used. 遇到一些隐含的数据类型问题,在这些问题中,HANA似乎无法评估所有正在使用的数据。

When I create a view with a data type defined I get syntax errors so wondering if it is possible. 当我使用定义的数据类型创建视图时,出现语法错误,因此想知道是否可能。 Currently on HANA revision 84. 当前在HANA版本84上。

--trying to create a view with datatype defined
create view testview ( measure1 decimal(25,10) ) as
    select 4493.3489212 from dummy 

--creating view by casting type in select statement
create view testview (measure1) as
    select cast(4493.3489212 as decimal(25,10)) from dummy

When creating SQL views via CREATE VIEW, you're not using SQLScript but standard SQL. 通过CREATE VIEW创建SQL视图时,不是使用SQLScript,而是使用标准SQL。 And standard SQL doesn't have an explicit output structure definition, so you're depending on the data types that you create in the SELECT statement (eg via CAST()). 而且标准SQL没有明确的输出结构定义,因此您要依赖在SELECT语句中创建的数据类型(例如,通过CAST())。

When dealing with actual SAP HANA information models (eg a scripted calculation view) you explicitly define the output structure (semantics tab). 在处理实际的SAP HANA信息模型(例如,脚本化的计算视图)时,可以显式定义输出结构(“语义”选项卡)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM