Teradata procedure double quotes

Teradata Studio

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

3 REPLIES
Junior Contributor

Re: Teradata procedure double quotes

Your syntax is correct and should work as-is.

Did you run the CALL in the same session as the CREATE?

Re: Teradata procedure double quotes

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)

Junior Contributor

Re: Teradata procedure double quotes

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...