All Forums Database
Nagac 6 posts Joined 10/11
30 Oct 2011
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;

 

Adeel Chaudhry 773 posts Joined 04/08
01 Nov 2011

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

 

Regards, Adeel

 

-- If you are stuck at something .... consider it an opportunity to think anew.

You must sign in to leave a comment.