Quantcast
Channel: SCN : Discussion List - SAP HANA and In-Memory Computing
Viewing all articles
Browse latest Browse all 5653

Simple Cursor Query

$
0
0

Hello Experts,

 

I am trying to run a simple cursor query on data with schema data type Long/BigInt,Long/BigInt,DOUBLE,DOUBLE and I keep getting this error on this Query any advice would be appreciated.

 

CREATE procedure "TAXIDATA".kNNQuery (in t1 BIGINT, in t2 BIGINT, in x1 DOUBLE, in y1 DOUBLE, in k integer) language sqlscript as

 

BEGIN

 

  DECLARE temp_dist DOUBLE;

  DECLARE xd DOUBLE;

  DECLARE yd DOUBLE;

 

  DECLARE CURSOR cur_dist FOR

  select TID, X, Y from "TAXIDATA"."TAXIDATA"

  where ("TAXIDATA"."TIME" > t1 and "TAXIDATA"."TIME" < t2);

 

  OPEN cur_dist;

  FOR cur_row AS cur_dist do

  xd := cur_row."X";

  yd := cur_row."Y";

 

  temp_dist := SQRT((x1 - xd)*(x1 - xd)+(y1 - yd)*(y1 - yd));

  insert into my_table values(cur_row.TID, temp_dist);

  END FOR;

 

  select * from my_table order by distance desc LIMIT :k;

  CLOSE cur_dist;

END;

 

Thanks in advance


Viewing all articles
Browse latest Browse all 5653

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>