How to Call Teradata Stored Procedure

Connectivity

How to Call Teradata Stored Procedure

Hi,
When i try to call the stored procedure "ACEREWARDS_CUSTOMERPREF(?)", it throws error "something missing between "(" and "?" ", i dont know what it exactly looking for. If i removed the "(?)", it throws "stored procedure does not exists.
I am using Terdata.Client.Provider 13.0 in C#.NET3.5.
Any suggestions.

5 REPLIES

Re: How to Call Teradata Stored Procedure

If i removed the "(?)", it throws "ACEREWARDS_CUSTOMERPREF is not a stored procedure".
Teradata Employee

Re: How to Call Teradata Stored Procedure

Set the TdCommand.CommandText to the Stored Procedure Name and Set the TdCommand.CommandType to CommandType.StoredProcedure. Data Provider will generate the appropriate CALL statement.

Note that Stored-Procedure and Macros are not interchangeable. Is "ACEREWARDS_CUSTOMERPREF" a macro? If it is a macro then set the TdCommand.CommandText to "Exec ACEREWARDS_CUSTOMERPREF(?)" and set the TdCommand.CommandType to CommandType.Text.

Re: How to Call Teradata Stored Procedure

Its working fine, thanks a lot.

Re: How to Call Teradata Stored Procedure

 

REPLACE PROCEDURE a.LOAD_TB_BI_TABLE

(

IN P_JOB VARCHAR(10000),

OUT P_RETURN_MSG1 VARCHAR(256),

OUT P_STATUS1 INTEGER

)

P1:BEGIN

DECLARE v_SQL_STMT VARCHAR(10000) ;

DECLARE FLAG VARCHAR(10000) ;

DECLARE p_return_msg VARCHAR(256) ;

DECLARE p_status INTEGER ;

SET v_SQL_STMT='CALL a.LOAD_TB_BI_TABLES('||1||','||'DIM_REFRESH'||','||'DIM_REFRESH'||','||1||','||1||',P_RETURN_MSG,P_STATUS)';

Call DBC.SYSEXECSQL( :v_SQL_STMT);

SET P_RETURN_MSG1 =P_RETURN_MSG;

SET P_STATUS1=P_STATUS;

END P1;

 This is the procedure which I am creating to call another procedure, But while calling, it is throwing an error saying SQL statement not supported.

 

call a.LOAD_TB_BI_TABLE

('a.LOAD_TB_BI_TABLES(1,''DIM_REFRESH'',''DIM_REFRESH'',1,1,P_RETURN_MSG,P_STATUS)',P_return_msg1,p_status1)

Please help, how to implement this scenaio, I need to parameteriize the store procedure name and call that within a procedure.

This is

Teradata Employee

Re: How to Call Teradata Stored Procedure

Add new questions as new post. You will have better chance to get your answer.