简体   繁体   中英

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? Running into some implicit data type issues where HANA doesn't seem to be evaluating all data being used.

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.

--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. 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()).

When dealing with actual SAP HANA information models (eg a scripted calculation view) you explicitly define the output structure (semantics tab).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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