📜  在 NETEZZA 中创建光标 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:07.496000             🧑  作者: Mango

代码示例1
CREATE OR REPLACE PROCEDURE SP_NEW_PROCEDURE1( )
RETURNS REFTABLE(employees)
LANGUAGE NZPLSQL AS
BEGIN_PROC
  DECLARE

l_conditions  varchar(1000);
p_rec         RECORD;

BEGIN

FOR P_REC IN  select empid, mgrid, empname, salary  from employees where mgrid = 7 
LOOP


        l_conditions  :=  'insert into  '  || 
                          REFTABLENAME     || 
                          '  VALUES ('     || 
                          quote_literal(P_REC.EMPID)  || 
                          ','              || 
                          quote_literal(P_REC.MGRID)    || 
                          ','              || 
                          quote_literal(P_REC.EMPNAME)   || 
                          ','              || 
                          quote_literal(P_REC.SALARY )    || 
                          '  ) ; ' ;

 execute immediate l_conditions; 

  l_conditions  := ' ';

END LOOP;      
RETURN REFTABLE;
END;
END_PROC;