PL/SQL to a valid Procedure

Database
Enthusiast

PL/SQL to a valid Procedure

Hi experts.

Could anyone convert this PL/SQL to a valid Teradata Procedure:

whenever sqlerror exit sql.sqlcode;

SET serveroutput ON;

Declare

vRowid varchar2(100);

vN.GES%TYPE;

CURSOR VJE IS

SELECT  G_T1.ROWID, G_T2.GES

FROM PRC G_T1

LEFT JOIN PRD G_T2

ON G_T2.GES = G_T1.GES  AND G_T1.DJ >= G_T2.D_BASSS WHERE G_T1.CC='FCCCC' AND DJ>=to_date('01/01/2014','dd/mm/yyyy');

BEGIN 

 UPDATE PRC SET CC='FCCCC' where CC IS NULL AND DJ>=to_date('01/01/2014','dd/mm/yyyy');

 IF NOT VJE%ISOPEN THEN

  OPEN VJE;

  end if;

 LOOP

    FETCH VJE INTO vRowid,vGES;

  EXIT WHEN VJE%NOTFOUND;

  IF vGES IS NULL THEN

   UPDATE PRC SET VAR1='FCCC' where rowid=''||vRowid||'';

  ELSE

   UPDATE PRC SET VAR1='VA' where rowid=''||vRowid||'';

  END IF;

 END LOOP;

 Close  VJE; 

EXCEPTION

   WHEN no_data_found THEN

      dbms_output.put_line('NO LINES !');

   WHEN others THEN

      dbms_output.put_line('ERROR!!');

COMMIT;

END;

/

exit ;

1 REPLY
Enthusiast

Re: PL/SQL to a valid Procedure

Found it. Thank you for watching.