将FOR EACH中的行添加到TEMP-TABLE

san*_*der 1 progress-4gl openedge

我正在尝试创建一个临时表,它与数据库中已存在的表完全相同.如何将每行添加到临时表?

DEFINE TEMP-TABLE o_ttProducts.

FOR EACH Product:
    /*Add current row to the o_ttProducts temp table*/
END.
Run Code Online (Sandbox Code Playgroud)

ids*_*opd 5

DEFINE TEMP-TABLE o_ttProducts no-undo like Product.

FOR EACH Product
    no-lock:
    /*Add current row to the o_ttProducts temp table*/
    create o_ttProducts.
    buffer-copy Product to o_ttProducts.
END.
Run Code Online (Sandbox Code Playgroud)

  • 我不想为一个简单的问题详细介绍,但当然你在使用它之前阅读BUFFER-COPY的文档是很重要的.IMO关于BUFFER-COPY的最重要的一点也在那里提到:"在运行时,BUFFER-COPY:*如果没有,则创建目标记录......".如果你不记住这一点,可能会导致一些错误. (2认同)