%SelectAll
来源:互联网 发布:域名dns劫持怎么解决 编辑:程序博客网 时间:2024/06/14 04:11
%SelectAll函数相当于select * from tablename。可以返回表中所有的字段。
select * from PSXLATITEM 的两种写法:
1,%SelectAll(PSXLATITEM A)
2,名为getAll的SQL中写%SelectAll(:1) A,可以用函数调用方式
SQL getAll = CreateSQL(SQL.getAll,Record.PSXLATITEM)。
http://peoplesoft.wikidot.com/selectall
If you ever need to create a view that selects all fields from a particular record, then you should be using the %SelectAll meta-sql construct.
Why? Because %SelectAll uses the underlying record definition to select the fields - so it will always return all fields from the underlying record, even if that record definition changes.
The basic syntax is:
- %SelectAll(RECORD_NAME ALIAS)
There is all a %SelectDistinct construct which adds a distinct to the select clause and uses the same syntax.
%SelectDistinct 函数相当于在%SelectAll 上加一个distinct语句,筛除重复数据。
%SelectAll returns all the fields for the record specified and includes a from clause.
For example, say I want the latest effective dated, active fields from PSXLATITEM. My SQL might start something like this:
select FIELDNAME, FIELDVALUE, EFFDT, EFF_STATUS, XLATLONGNAME, XLATSHORTNAME, LASTUPDDTTM, LASTUPDOPRID, SYNCID from PSXLATITEM A where EFFDT = ( select max(EFFDT) from PSXLATITEM where FIELDNAME = A.FIELDNAME and FIELDVALUE = A.FIELDVALUE and A.EFFDT <= sysdate ) and A.EFF_STATUS = 'A';
Instead of typing out all those fields, lets use %SelectAll - that's what I did to generate this example btw ;)
So our meta-sql would look like this - (I've also replaced sysdate with %CurrentDateIn)
%SelectAll(PSXLATITEM A)where EFFDT = ( select max(EFFDT) from PSXLATITEM where FIELDNAME = A.FIELDNAME and FIELDVALUE = A.FIELDVALUE and A.EFFDT <= %CurrentDateIn ) and A.EFF_STATUS = 'A'
Note that %SelectAll wraps date, time and date/time fields with %DateOut, %TimeOut, %DateTimeOut as well. This resolvesinto the following meta-sql:
可以使用%DateOut, %TimeOut, %DateTimeOut 函数表示与时间有关的数据。例如上下文中红字表示的。
SELECT A.FIELDNAME , A.FIELDVALUE , TO_CHAR(A.EFFDT ,'YYYY-MM-DD') , A.EFF_STATUS , A.XLATLONGNAME , A.XLATSHORTNAME , TO_CHAR(A.LASTUPDDTTM ,'YYYY-MM-DD-HH24.MI.SS."000000"') , A.LASTUPDOPRID , A.SYNCID FROM PSXLATITEM A WHERE EFFDT = ( SELECT MAX(EFFDT) FROM PSXLATITEM WHERE FIELDNAME = A.FIELDNAME AND FIELDVALUE = A.FIELDVALUE AND A.EFFDT <= TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM-DD'),'YYYY-MM-DD') ) AND A.EFF_STATUS = 'A'
Note that the example includes an alias of A in the parameters to %SelectAll. If you are using %SelectAll you might have to play with your SQL a bit to get it work, especially if you are using joins to other tables. It may not work in all cases, but if nothing else, its a time saver!
注意from中表别名的使用,并非所有情况下都会生效,尤其是在使用连接语句时,如join等,但它的使用会有效节省时间。- %SelectAll
- js SelectAll全选按钮
- selectAll—part II
- 2012-11-16(selectAll.aspx.cs)
- .net cf textbox 文本框 GotFocus时,设置selectall 有效
- 根据表名生成有关SelectAll的存储过程
- zbox的测试例——selectAll+selectInverse
- d3选择集合的操作方法(一):select与selectAll
- VB.NET中TextBox的select和selectall的比较
- Delphi 进入TEdit控件时选中该控件中的内容,不使用SelectAll
- Ibatis This SQL map does not contain a MappedStatement SelectAll 错误注意
- 【万万没想到】关于文本组件调用selectAll(),没有全选文本的问题
- iOS textField长按出现select,selectall 选择显示成中文全选黏贴 剪切、复制、选中的提示为英文改为中文
- [译文]Java EE 6中的依赖注入——第1部分(二)
- ICE Manual(Documentation for Ice 3.5)---The Ice Run Time in Detail(Automatic Retries)
- 触发器实现两个库之间数据同步
- ubuntu 13.04 没有语言支持(language support)的解决方法
- magento设置产品列表页显示的产品数目
- %SelectAll
- (KVM连载) 5.1.3 使用virtio_balloon(KVM中的Ballooning)(下)
- Grunt 入门教程一:开始使用Grunt(翻译自官方教程)
- 随便写写
- 幂的精度问题
- iOS音频队列服务
- 怎样减去肚子和侧腰的肉
- spring单元测试标签
- JSON序列化和反序列化日期时间的处理