Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在spark/scala中编写或调用-SQL游标?_Scala_Apache Spark_Apache Spark Sql - Fatal编程技术网

如何在spark/scala中编写或调用-SQL游标?

如何在spark/scala中编写或调用-SQL游标?,scala,apache-spark,apache-spark-sql,Scala,Apache Spark,Apache Spark Sql,是否可以在scala/spark中写入/调用游标??我想从spark/scala代码中编写或调用SQL游标 declare cursor c1 is select DISTINCT earning_id from CN_TP_EARNINGS_ALL where rownum < 10; cursor c2(p_Assigned in number) is select SOURCE_EVENT_PERIOD_ID from CN_TP_EARNI

是否可以在scala/spark中写入/调用游标??我想从spark/scala代码中编写或调用SQL游标

declare
   cursor c1 is
       select DISTINCT earning_id from CN_TP_EARNINGS_ALL where rownum < 10;
   cursor c2(p_Assigned in number) is
       select SOURCE_EVENT_PERIOD_ID from  CN_TP_EARNINGS_ALL where 
       earning_id = p_Assigned;

begin
 for r1 in c1 loop
  dbms_output.put_line('------- start  --------');
  for r2 in c2(r1.earning_id) loop
     dbms_output.put_line(r2.SOURCE_EVENT_PERIOD_ID);
  end loop;
     dbms_output.put_line('------- end  -------');
 end loop;
end;
下面是用SQL编写的游标,我想从scala代码中调用它

declare
   cursor c1 is
       select DISTINCT earning_id from CN_TP_EARNINGS_ALL where rownum < 10;
   cursor c2(p_Assigned in number) is
       select SOURCE_EVENT_PERIOD_ID from  CN_TP_EARNINGS_ALL where 
       earning_id = p_Assigned;

begin
 for r1 in c1 loop
  dbms_output.put_line('------- start  --------');
  for r2 in c2(r1.earning_id) loop
     dbms_output.put_line(r2.SOURCE_EVENT_PERIOD_ID);
  end loop;
     dbms_output.put_line('------- end  -------');
 end loop;
end;

留在甲骨文公司。您可以使用迭代器,但似乎是错误的用例。