本文介绍了AS400多成员文件SQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 5250 会话中的交互式 SQL 中的 AS400 上,

On AS400 in interactive SQL in a 5250 session,

select * from myfile

仅当 myfile 有多个成员时才从一个成员返回行.

returns rows from one member only when myfile has more than one member.

如何从特定成员获取行?

How can I get rows from a specific member?

重要提示:最后我想通过 jt400 通过 JDBC 执行此操作,所以我真的想要一个可以在那里工作的解决方案.

Important: in the end I'd like to do this over JDBC with jt400 so really I want a solution that'll work there.

谢谢.

推荐答案

您可以使用 create alias 命令创建别名:

You can create an alias using the create alias command:

CREATE ALIAS myLibrary/myAlias FOR memberLibrary/memberFile(memberName)

这将允许您像使用任何其他文件一样使用别名对该成员运行 sql:

This will allow you to run sql against that member using the alias like you would any other file:

SELECT * FROM myLibrary/myAlias

请记住,别名会在您的会话结束后继续存在,它们不是临时的.因此,如果您在完成后不需要别名,请在 QTEMP 中创建别名或在完成后显式删除别名:

Just remember that the alias will stick around after your session, they are not temporary. So if you wont need the alias when you are done, either create the alias in QTEMP or explicitly drop the alias once you are done with it:

DROP ALIAS myLibrary/myAlias

HTH

这篇关于AS400多成员文件SQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 13:45