Home > database >  Oracle SQL multi-column joining together for help!!!!!!!!!!
Oracle SQL multi-column joining together for help!!!!!!!!!!

Time:10-14

CodePudding user response:

Does anyone know, bump of busy.

CodePudding user response:

Write a line function

CodePudding user response:

 create or replace function f_get_allcol (i_table_name varchar2, i_rd rowid) 
Return varchar2 as
V_sql varchar2 (4000);
V_col_list varchar2 (4000);
V_result varchar2 (4000);
The begin
The select listagg (tc OLUMN_NAME, '| |') within group (order by tc OLUMN_ID)
Into v_col_list
The from dba_tab_cols t
Where t.T ABLE_NAME=upper (i_table_name);
The execute immediate 'select substr (' | | v_col_list | |', 1400) from the '| | i_table_name | |
'where the rowid="' | | i_rd | | ""
Into v_result;
Return v_result;
end;


The select f_get_allcol (' test1, t.r owid) from test1 t;

CodePudding user response:

Similar to the above, use dynamic SQL + data dictionary to fix
  • Related