Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 10 Feb 2003 @ 18:30:47 GMT


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  


Subj:   Dynamic Stored Procedure and where statement
 
From:   Francois GORYN

Hi All,

I'm trying to write a stored procedure with Teradata SQL Assistant 6.1:

1) This procedure runs correctly

CREATE PROCEDURE proc1( tablename char(30), database1 char(30) )
BEGIN
DECLARE  REQ1 VARCHAR(21)  DEFAULT  ' WHERE TABLE_NAME = ';

CALL DBC.SysExecSql
('insert into dev_tampon.test ( activity )
select IO_TERADATA from ' ||:database1||'.'||:tablename||:REQ1
|| '''DUMMY''' );
END;

2) When I'm trying to use a variable with the where statement (see below), it doesn't run correctly.

The call proc('rc_exec','dev_tampon', 'TKMII') returns the following error message:

3810: proc: column/parameter 'dev_tampon.rc_exec.TKMII'  does not exist

Is there any restrictions with the Where statement and variable?

REPLACE PROCEDURE proc
( tablename char(30), database1 char(30), par char(20) )
BEGIN
DECLARE  REQ1 VARCHAR(21)  DEFAULT  ' WHERE TABLE_NAME = ';

CALL DBC.SysExecSql  (' insert into dev_tampon.test ( activity )
   select  IO_TERADATA  from ' || :database1||'.'||:tablename ||:REQ1
|| :par );
END;

Thank you in advance for all your input,


Regards

Francois GORYN



     
  <Prev Next>  
<<First
<Prev
Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023