S.O.P.("fields : "+res.getString(0));
according type of your fields you can acc more res.getint(1)
res.getString(2) like this up to 30 so this will give all the columns you
needed.



On Fri, Mar 16, 2012 at 11:17 AM, Bhavesh Shah <bhavesh25s...@gmail.com>wrote:

>
> 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
>
>


-- 
Shashwat Shriparv

+91-9663531241
+91-990059620

Reply via email to