Hi,
I am trying to implement a task in Hive like Stored Procedure in SQL.
In SQL, when we write cursor, first we execute select query and then
fetching the records we perform some actions.

Likely I have fired a select query as actions in Hive.
sql="select a,c,b from tbl_name";
res=stmt.executeQuery();    -----------> CONTAINS 30 RECORDS
while(res.next())
{
     sql="insert into tabl2..... ";
     rs1=stmt.executeQuery();
     like wise many queries are there.....

.
.
.
..
}

As my select query contans 30 records but when I execute it   my
while(res.next()) execute only once.
I didn't get any kind of errors/exceptions

But instead of queries I just try to display field to check whether it is
fetching or not
then it is working fine..  (while loop contains only System.out.println
statements)

sql="select * from tbl_name";
res=stmt.executeQuery(sql);

while(res.next())
{
   S.O.P.("fields : "+res.getString(0));
}

Why it is happening I am not getting. Is anything I am doing wrong?






-- 
Regards,
Bhavesh Shah

Reply via email to