Search code examples
sqloracleplsqltable-variable

How to store result of cross-table-query to a table variable


I actually found something here but I need a syntax for multiple tables. Example:

DECLARE
    CURSOR select_results IS
        SELECT T1.ID, T2.DP FROM T1, T2 WHERE T1.ROW_ID=T2.DP;
    select_result T1.ID%ROWTYPE, T2.DP%ROWTYPE;
BEGIN
    -- DO SOMETHING
END;

Could someone explain how can I create such custom table variable and is it possible at all? Thanks in advance!


Solution

  • Try

    select_result  select_results%ROWTYPE;
    

    Share and enjoy.