如何从进度数据库获取 ROWID

发布于 2024-07-06 04:09:35 字数 147 浏览 11 评论 0原文

我有一个 Progress 数据库,我正在其中执行 ETL。 我正在读取的表之一没有唯一键,因此我需要访问 ROWID 才能唯一标识该行。 访问正在进行的 ROWID 的语法是什么?

我知道使用 ROWID 进行行标识存在问题,但这就是我现在所拥有的。

I have a Progress database that I'm performing an ETL from. One of the tables that I'm reading from does not have a unique key on it, so I need to access the ROWID to be able to uniquely identify the row. What is the syntax for accessing the ROWID in Progress?

I understand there are problems with using ROWID for row identification, but it's all I have right now.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

合久必婚 2024-07-13 04:09:35

对我的回答有一个简短的警告 - 自从我与 Progress 合作以来已经近 10 年了,所以我的知识可能不仅仅是一个有点过时了。

检查Progress 语言参考 [PDF ] 似乎显示我记得的两个函数仍然存在:ROWIDRECIDROWID 函数较新,是首选函数。

在 Progress 4GL 中,您可以像这样使用它:

FIND customer WHERE cust-num = 123.
crowid = ROWID(customer).

或者:

FIND customer WHERE ROWID(customer) = crowid EXCLUSIVE-LOCK.

检查 Progress SQL 参考 [PDF] 显示 ROWID 在 SQL 中也可作为 Progress 扩展使用。 您可以像这样使用它:

SELECT ROWID, FirstName, LastName FROM customer WHERE cust-num = 123

编辑:根据 Stefan 的反馈进行编辑。

A quick caveat for my answer - it's nearly 10 years since I worked with Progress so my knowledge is probably more than a little out of date.

Checking the Progress Language Reference [PDF] seems to show the two functions I remember are still there: ROWID and RECID. The ROWID function is newer and is preferred.

In Progress 4GL you'd use it something like this:

FIND customer WHERE cust-num = 123.
crowid = ROWID(customer).

or:

FIND customer WHERE ROWID(customer) = crowid EXCLUSIVE-LOCK.

Checking the Progress SQL Reference [PDF] shows ROWID is also available in SQL as a Progress extension. You'd use it like so:

SELECT ROWID, FirstName, LastName FROM customer WHERE cust-num = 123

Edit: Edited following Stefan's feedback.

☆獨立☆ 2024-07-13 04:09:35

根据您的情况和应用程序的行为,这可能重要也可能无关紧要,但您应该知道 ROWID 和 ROWID 是唯一的。 RECID 可以重复使用,并且可能会发生变化。

1)如果一条记录被删除,它的ROWID最终将被重用。

2)如果通过转储和重组表; 加载或表移动到新的存储区域,那么 ROWID 将发生变化。

Depending on your situation and the behavior of the application this may or may not matter but you should be aware that ROWIDs & RECIDs are reused and that they may change.

1) If a record is deleted it's ROWID will eventually be reused.

2) If the table is reorganized via a dump & load or a tablemove to a new storage area then the ROWIDs will change.

墟烟 2024-07-13 04:09:35

只是为戴夫·韦伯的答案添加一点内容。 我在 select 语句中尝试了 ROWID,但出现语法错误。 ROWID 仅在指定要选择的其余列时才起作用,不能使用 *。

这不起作用:

SELECT ROWID, * FROM customer WHERE cust-num = 123

这确实起作用:

SELECT ROWID, FirstName, LastName FROM customer WHERE cust-num = 123

Just to add a little to Dave Webb's answers. I had tried ROWID in the select statement but was given a syntax error. ROWID only works if you specify the rest of the columns to select, you cannot use *.

This does NOT work:

SELECT ROWID, * FROM customer WHERE cust-num = 123

This does work:

SELECT ROWID, FirstName, LastName FROM customer WHERE cust-num = 123
暗地喜欢 2024-07-13 04:09:35

谷歌快速搜索发现了这个:
http://bytes.com/forum/thread174440.html

阅读底部的消息[email protected](您需要 oid 或 ctid,具体取决于您的保证想要重新持久性和独特性)

A quick google search turns up this:
http://bytes.com/forum/thread174440.html

Read the message towards the bottom by [email protected] (you either want oid or ctid depending on what guarantees you want re persistence and uniqueness)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文