I have populated data in a temp table ( the table will always have 10 records max). The next step I am trying is to pick up records one by one and query the database to test some condition and assign a comment based on the outcome of the query. For example:
-- table: #XY (data)
select data from #XY
data
----
AB1
AB2
AB3
I'm trying to write a sybase query which will pick up the data one by one ( recursively ?), run some designated query and return a pass or fail comment which I will then finally populate in another temp table
eg: Row 1 is AB1 - Select name from table where name = 'AB1' if it doesn't return data , I stop there and populate a comment
if data is returned , I go to step 2 select name from table 2 where name = 'AB1' and so on
I need to do for all records and capture the results and put in a final temp table .
The o/p I perceive will be something like this
Name Cause Descricption
----- ------------------
AB1 XXXX
AB2 YYYY
I have done such stuff in shell script ( reading lines from a file one by one and actioning them ) but not sure if that's something that can be done in sybase as well
Any alternate approach welcome as well
Thanks in advance .