Hi,

Could someone please help me with the code for the following task?

I have a table called "real_customer"

Lets say someone from another department sends me a list of company names and he/she would like to find out what companies are our current customers. I import the list into "temp_company" table and compare it with the "real_customer" table.

-------------------------------------
SELECT t.customer
FROM temp_company t, r.real_customer
where t.customer = r.customer
-------------------------------------

The problem is that a lot of times the "temp_company" company name is missing INC., CORP., LLP, which results in unfound match.

Solution:
---------------------------------------------------------------------
I would love to have a stored procedure that would do the following FOR EACH ROW:

1. if the company names are equal in both tables, then insert into "temp_company" values ('yes')
2. if "temp_company" company name is not equal the name in "real_customer"
THEN:
- APPEND 'INC.' to the end of the company name in the "temp_company" table. Check if both values are equal, if yes, then INSERT INTO "temp_company" values ('yes')
if no THEN
- APPEND 'CORP.' - you get the idea.
--------------------------------------------------------------------

I hope I explained it clearly

Thank you

Regards

Roman