Hi,
There is an urgent requirement in our project related to SQL queries. I don't have much knowledge on SQL/script. Need to write a script with the following requirements (we should only use SQL queries and no PLSQL/functions).
Inputs to this script (Perl) - Primary Key1, Associated Value1
What it does: The script queries a table, table_t. This table has two columns: Primary Key and Associated Value. The script gets the Associated Value value for the Primary Key passed in the query. If the output is a CSV (comma separated value), then it appends Associated Value1 to the output and updates the value in the DB. If the output is NULL, then a new row is added with the value Primary Key1, Associated Value1.
Example:
BEFORE
Primary Key Associated Value
abc J1,J9
pqr
mno J8
xyz J3,J5
script(mno, J3);
script(pqr, J5);
script(xyz, J2);
script(efg, J6);
AFTER
Primary Key Associated Value
abc J1,J9
pqr J5
mno J8,J3
xyz J3,J5,J2
efg J6
Thanks in advace.
Regards
Deepu