Search code examples
plsqloracle-apexprefix

PLSQL Prefix tablename


I have the following problem: I want to get all selected tables from an APEX page. The selected tables have attributes, but the attributes can be the same for different tables. So I want to add a prefix to every attribute, per tabel. Like: PRODUCT.ARTIKEL.

Is there a way to do this? I have the following code:

SELECT COLUMN_NAME display_value, COLUMN_NAME return_value
FROM all_tab_columns
WHERE OWNER =  'THO6_2014_2B_TEAM2_TARGET'
AND TABLE_NAME = :P2_TRIGGER_TABLE
order by 1;

Solution

  • Like this?

    SELECT TABLE_NAME||'.'||COLUMN_NAME display_value,
           TABLE_NAME||'.'||COLUMN_NAME return_value
    FROM all_tab_columns
    WHERE OWNER =  'THO6_2014_2B_TEAM2_TARGET'
    AND TABLE_NAME = :P2_TRIGGER_TABLE
    order by 1;