All Forums Teradata Studio
Marty22 2 posts Joined 06/15
12 Jun 2015
Teradata procedure double quotes

Hi all,
I'm learning procedures and here is one of my first,.. but I cannot get it working
can you tell how to fix this? 

CREATE PROCEDURE databaze.nazev  (
IN tName VARCHAR(200)
, IN cName VARCHAR(200)
)
BEGIN
-- procedure takes up input table name and input column name which will be updated
------------------------------------------------------ -----------------------------
CALL DBC.SysExecSQL('UPDATE ' || tName || ' SET ' || cName || ' =
CASE
  WHEN ' || cName || ' =  ''free'' THEN ''sth sth else''
  ELSE ' || cName || ' end;');
------------------------------------------------------ -----------------------------
END  

 
When I call the procedure..
call databaze.nazev('tableName', 'columnName') 
I am getting error:
 
CALL Failed. 3707: ... Syntax error, expected something like a 'THEN' keyword between a string or a Unicode character literal and the word 'free'.
Thx for any help

 

dnoeth 4628 posts Joined 11/04
12 Jun 2015

Your syntax is correct and should work as-is.
Did you run the CALL in the same session as the CREATE?

Dieter

Marty22 2 posts Joined 06/15
12 Jun 2015

Hi Dieter,
thx for reply.
Yes, I create the procedure and then in same session run it.
(thats wrong?)

And I am using it in teradata SQL Assistant..
(maybe important... apology if it changes things)

dnoeth 4628 posts Joined 11/04
12 Jun 2015

No, that's fine, as I said, this should run as-is.
I was just assuming it might have been caused by sessions with different client character sets...

Dieter

You must sign in to leave a comment.