Hi,
Oracle 11g R2 11.2.0.3
IBM AIX
A developer has come to me with a requirement to query a table based on an ID and have the entire row read into a clob.
He needs it to be dynamic since this ID is an FK and can appear in many child tables. I have seen similar questions asked in the forum but none quite addressed my scenario.
A simple example is:
create table t1 (col1 number, col2 varchar2(50));
insert into t1 values (1,'Test record');
commit;
Here's where I need help.
i) I select from user_tab_columns where table_name = T1.
...but in reality I will pass the table name as a parameter.
select column_name
from user_tab_columns
where table_name = 'T1';
select *
from t1 where id=1;
ii) I need the output to be:
<col_name1>=<col1_value>;<col_name2>=<col2_value> etc...
e.g.
COL1=1;COL2='Test Record'
And I need that stored in the contents of a CLOB for insertion into a CLOB field in an audit table.
Any help or pointers much appreciated. The key is it needs to be dynamic in that I don't know the composition of the table where the ID will be found, so I have to consult the DD.
Phil