Procedures in Teradata

Procedures

 

Creating

Create procedure<procedure name>(<PARAMS>)As. BEGIN<SQL Queries>END;

 

Replacing

Replace procedure<procedure name>(<PARAMS>)As. BEGIN<SQL Queries>END;

 

DROPING

DROP procedure<procedure name>

 

View

SHOW Procedure<procedure name>

At TekSlate, we offer resources that help you in learning various IT courses. We avail both written

material and demo video tutorials. To gain in-depth knowledge and be on par with practical

experience, then explore Teradata Training Videos.

 

Calling

Call procedure<procedure name>(<PARAMS>)

 

Example

Create procedure (Dcone1 INTEGER,DName1 varchar(30))

BEGIN

DECLARE DEPTNAME VARCHAR(30);

SET DEPTNAME=DNAME1;

INSERT INTO DEPT(DCODE, DNAME)Values(:Dcode1,:DEPT NAME);

END;

Call p – sample(70,‘IT’);

Select* From Dept;

Check out the top Teradata Interview Questions now!

Example

Create procedure SP(PID INTEGER, out op INTEGER)

BEGIN

DECLARE VAR1 INTEGER;

SELECT Party income into:var1 from party where party =pid;

Select op=var1*10;

END;

Call SP(1,OP)

For Indepth knowledge on Teradata click on: