Hi,,
I have requirement that i need to get DISTINCT values from a table and if there are two records i need to update it to one record and then need to submit INSERT statements by using the updated value as a parameter. Here is the example follows..
SELECT DISTINCT ID FROM OFFER_GROUP WHERE OFFERS IN('A','B');
Result as follows
ID
1
11
Above statement always displays 1 or 2 records.If the above query returns 2 rows then i need to update it to 1 row like below
UPDATE OFFER_GROUP SET ID =1 WHERE OFFERS IN('A','B') AND ID =11;
And then i need to execute INSERT statements by using ID as a parameter.
whenever i use ${ID} it should be place with the updated value 1.
insert into <TABLE>values ();
For the above requirement, i need to implement it in shell scripting and i am using nzsql.
Thanks in advance.
Cheers,
Samah