一、变量简介

变量存储的是一个单一的值,既可以是数字,也可以是字符或者日期。不能为数组。

ODI的变量分为两种,全局变量和项目变量。 顾名思义,项目变量定义的变量只可以在本项目中使用,其它项目无法调用此变量。而全局变量定义的变量可被任何项目所引用。

变量可设置为一个单一的缺省值,或者由SQL赋值,在每次调用的时候刷新,生成最新的值。

二、变量的创建

先创建一个项目(ODI),打开后可看见”变量”标签。

在上面右键选择新建后,弹出窗口如下:

定义页中填入变量的名字,数值类型 ,保留历史记录有三种选项:缺省是最新值,还有所有值、无历史记录

  1. 最新值表示ODI将变量的最新值存入ODI元数据管理库中。
  2. 所与值表示ODI将变量的所有值变化存入元数据管理库中,可用于跟踪和调试。
  3. 无历史记录表示变量的最新值只存在与内存中,ODI不进行存储。

安全值:选中时,变量不会被记录。对于包含密码或者敏感数据的变量,选中时保留历史记录自动变为无历史记录

默认值定义了变量的缺省值。

切换到刷新页,可定义变量的刷新语句,从而在每次调用时,可获取不同的数值。

如上所示,在刷新页,首先要选择取变量的查询语句的数据源,例如ODI_TAG

然后编写select语句,

SELECT MAX(LAST_UPDATE_TIME) FROM "ODI_TAG"."DEPT"

完成后应用、保存。

点击验证按钮

点击刷新,会立即执行查询,历史记录标签页,根据保留历史记录2种选项不同,保存了最新值或者所有的历史记录。

这样,一个项目变量就已经创建完成。

三、变量使用

变量可用的地方很多,包括接口(Interface),程序(Procedure),包(Package)甚至模型(module)中的数据源等等。

3.1 变量作用域(scope)

使用变量MY_VAR的例子

· #MY_VAR: 必须在一个项目中

· #MY_PROJECT_CODE.MY_VAR: 明确指定项目名称前缀,避免有同名的全局变量

· #GLOBAL.MY_VAR: 参照全局变量.

· 使用 ":"代替"#"

You can use the variable as a SQL bind variable by prefixing it with a colon rather than a hash. However this syntax is subject to restrictions as it only applies to SQL DML statements, not for OS commands or ODI API calls and using the bind variable may result in performance loss. It is advised to use ODI variables prefixed with the '#'character to ensure optimal performance at runtime.

区别:

1. 冒号(:)只适用于SQL DML,不适用于OS命令 or ODI API,而使用#(井号)适用于OS commands, SQL, and ODI API calls.

2. 使用冒号(:)可能会损失性能。

3. 使用方法的不同:TOWN_NAME = :GLOBAL.VAR_TOWN_NAME,不需要引号括起来 TOWN = '#GLOBAL.VAR_TOWN' 需要引号括起来

When you reference an ODI Variable prefixed with the ':' character, the name of the Variable is NOT substituted when the RDBMS engine determines the execution plan. The variable is substituted when the RDBMS executes the request. This mechanism is called Binding. If using the binding mechanism, it is not necessary to enclose the variables which store strings between delimiters (such as quotes) because the RDBMS is expecting the same type of data as specified by the definition of the column for which the variable is used.

For example, if you use the variable TOWN_NAME=:GLOBAL.VAR_TOWN_NAME the VARCHAR type is expected.

When you reference an ODI variable prefixed with the "#" character, ODI substitutes the name of the variable by the value before the code is executed by the technology. The variable reference needs to be enclosed in single quote characters, for example TOWN = '#GLOBAL.VAR_TOWN'. This reference mode of the variable works for OS commands, SQL, and ODI API calls.

3.2、Using Variables in Packages

3.3、Using Variables in Mappings

3.4、Using Variables in Object Properties

 

3.5、Using Variables in Procedures

 

3.6、Using Variables within Variables

 

3.7、Using Variables in the Resource Name of a Datastore

 

3.8、Passing a Variable to a Scenario

 

3.9、Generating a Scenario for a Variable

 

3.10、Tracking Variables and Sequences

 

原文地址:

Working with Variables

ODI---->Variables的更多相关文章

  1. Tcl internal variables

    Tcl internal variables eryar@163.com 在Tcl中内置了一些变量,并赋予了一定的功能.内置变量列表如下: 变量名称 功能描述 argc 指命令行参数的个数. argv ...

  2. [Project Name] was compiled with optimization - stepping may behave oddly; variables may not be available.

    控制台输出的时候显示一串这样的信息:[Project Name] was compiled with optimization - stepping may behave oddly; variabl ...

  3. Examples of MIB Variables - SNMP Tutorial

    30.5 Examples of MIB Variables Versions 1 and 2 of SNMP each collected variables together in a singl ...

  4. foreach statement cannot operate on variables of type 'System.Web.UI.WebControls.Table' because 'System.Web.UI.WebControls.Table' does not contain a public definition for 'GetEnumerator'

    错误:foreach statement cannot operate on variables of type 'System.Web.UI.WebControls.Table' because ' ...

  5. 已解决:Strict Standards: Only variables should be passed by reference in

    今天安装ecshop的时候最上面出现了一个错误提示:Strict Standards: Only variables should be passed by reference in F:\www.x ...

  6. T-SQL Recipes之 Table Variables and Temporary Tables

    Problem 许多时候, 我们想要Table Variables在动态SQL中执行,但现实是很骨感的.比如这个示例: DECLARE @sql_command NVARCHAR(MAX); DECL ...

  7. PHP 笔记一(systax/variables/echo/print/Data Type)

    PHP stands for "Hypertext Preprocessor" ,it is a server scripting language. What Can PHP D ...

  8. odi 12.2.1.1新特性

    ODI 12.2.1.1现在已经发布,也可以OTN上下载,主要变化: Hyperion Essbase and Hyperion Planning 知识模块 Hyperion Essbase and ...

  9. odi 12.2.1中访问excel文件

    由于在odi 12.2.1中,必须使用jdk1.8,而jdk1.8中jdbc-odbc bridge已经不再支持,因此,可以使用Progress DataDirect SequeLink来充当jdbc ...

随机推荐

  1. unity 打包资源及网络请求资源包

    第一步 导包 在Assets新建一个Editor目录 新建一个Test类 using UnityEngine; using System.Collections; using UnityEditor; ...

  2. 数据更新后让ListView自动滚动到底部

    在做聊天界面的时候想要发送新的数据后,listview自动滚动到底部,显示出最新的数据.网上找了两个方法,觉得不错,记录一下. 方法一: 给listview添加下面两个属性 android:stack ...

  3. 【BZOJ】【3673】可持久化并查集 & 【3674】可持久化并查集加强版

    可持久化并查集 Orz hzwer & zyf 呃学习了一下可持久化并查集的姿势……其实并查集就是一个fa数组(可能还要带一个size或rank数组),那么我们对并查集可持久化其实就是实现一个 ...

  4. 分析 Java heap dump工具之IBM HeapAnalyzer

    IBM HeapAnalyzer是一款免费的JVM内存堆的图形分析工具,它可以有效的列举堆的内存使用状况,帮助分析Java内存泄漏的原因. 功能与MAT类似. 1.下载 https://www.ibm ...

  5. 一个可用来记录Isilon各个节点的CPU,网络,磁盘性能的命令

    通过查看命令isi statistics system的帮助信息,拼出了下面的命令. isi statistics system list --nodes=all --degraded --forma ...

  6. 如何移除EFI system partition?

    莫名其妙, 在我的服务器上出现了这样一种分区, 上面写着EFI system, 删也删不掉, 因为删除分区的菜单是灰掉的. 找到了这篇文章, 成功的删掉了这个烦人的分区. 整个过程记录如下:   参考 ...

  7. Qt5.3.1 静态编译的configure

    今天最终自己静态编译过了QT5.3.1, 成功用在项目上了, 记录下configure指令.  configure -confirm-license -opensource -platform win ...

  8. go-ethereum

    如果要深入了解go-ethereum项目的实现与机制,看源代码是必不可少的.今天这篇博客就简单介绍一下如何在本地搭建项目的开发环境. GO语言环境搭建 以win8为例,访问地址https://gola ...

  9. ecshop中smarty最常用的6大基本语法

    模板制作比较核心的其实就是变量的使用,因为这些就是数据的根本,想从数据库里获取数据并显示在界面就必须使用smarty来展示,下面是关于smarty的介绍和使用.Smarty是一个php模板引擎,它分开 ...

  10. GB2312码表

    GB2312码表 code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F A1A0 . . · ˉ ˇ ¨ " 々 — - | … ‘ ’ ...