Alternative to oracle procedure

Database
Enthusiast

Alternative to oracle procedure

Hi

Could you some one help me on below

I need Teradata procedure which should serve as below Oracle Procedure.

CREATE OR REPLACE PROCEDURE create_keys (p_domain_name VARCHAR, p_row_count NUMBER,
p_available_count OUT NUMBER)
AS
available_count NUMBER := 0;
success_flag NUMBER := 0;
BEGIN
FOR i IN 1 .. 5
LOOP
BEGIN
SELECT seed_id
INTO available_count
FROM table1
WHERE domain_name = p_domain_name;

UPDATE table1
SET seed_id = seed_id + p_row_count
WHERE domain_name = p_domain_name AND seed_id = available_count;

COMMIT;
success_flag := 1;
p_available_count := available_count;
EXIT;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
success_flag := 0;
DBMS_LOCK.sleep (10);
END;
END LOOP;

IF success_flag = 0
THEN
raise_application_err (-20000, 'Can''t update the record');
END IF;
END;
1 REPLY
Teradata Employee

Re: Alternative to oracle procedure

Are you facing any specific problem? or are you just seeking someone to do work on your behalf? :)

Regards, Adeel