Help - Unable to assign char value to a var within cursor for statement
Teradata Teradata Discussion Forums Teradata.com Discussion Forum
Visit Teradata.com
Home       Guidelines    Member List
Welcome Guest ( Login | Register )
        


This online forum is for user-to-user discussions of Teradata products, and is not an official customer support channel for Teradata. If you require direct assistance, please contact Teradata support.


Help - Unable to assign char value to a var... Expand / Collapse
Author
Message
Posted 10/10/2007 2:39:04 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 10/10/2007 1:54:00 AM
Posts: 7, Visits: 1
Hi

Iam unable to extract the CHAR value for the variable D_SYMP when used in the cursor but with a integer variable it works fine.

REPLACE PROCEDURE SP_SYMP(OUT V_SYMP VARCHAR(2000))
BEGIN
DECLARE D_SYMP VARCHAR(2000) ;
FOR SYMCUR AS C_SYM CURSOR FOR
SELECT SEQ_ID, SYMP_CAT||'-'||SYMP_NM AS SYMP
FROM SIDE_EFFS
DO
SET D_SYMP = D_SYMP || SYMCUR.SYMP;
END FOR;
SET V_SYMPTOM = D_SYMPTOM;
END;

Please help me, if iam missing something.

Thnx
Sony
Post #9174
Posted 10/10/2007 1:29:41 PM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 8/24/2008 2:47:14 PM
Posts: 425, Visits: 398
D_SYMP is initially NULL

and when you have NULL || "anything" it gives you NULL not "anything"

so you never get anything out !!

That's probably what happened in your case ...

you can declare the variable to have a default value of '' (empty string, not NULL)


DECLARE D_SYMP VARCHAR(2000) DEFAULT '' ;
Post #9189
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.


All times are GMT -5:00, Time now is 12:48am

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.063. 11 queries. Compression Disabled.