That is right, Amit.
So it is: use two single quotes within a string. At a first glance, it seemed like 'use the double quote' which will not work, of course.
-----Oorspronkelijk bericht-----
Van: Amit Singal [mailto:db2udbdba-ezmlmshield-x46004833.[Email address protected]
Verzonden: vr 26-8-2005 12:15
Aan: LazyDBA Discussion
Onderwerp: Re: Escape Sequence!
Try This..
SET temp_sql = 'SELECT temp FROM temp_tab WHERE temp_fn(t, ''a'') = 2';
Regards
Amit Singal
----- Original Message -----
From: "Ashish Kumar Aggarwal "
<db2udbdba-ezmlmshield-x5051413.[Email address protected]
To: "LazyDBA Discussion" <[Email address protected]
Sent: Friday, August 26, 2005 3:40 PM
Subject: Escape Sequence!
> LeavesHi All
>
> I'm putting my SQL in a String through which I'll PREPARE the Statement
and create a Cursor for that. The problem I'm facing is the my SQL contains
' (Single Quotes) in between which causes the unmatched quotes.
>
> Sample SQL :
>
> DECLARE temp_sql VARCHAR(100);
> DECLARE stmt STATEMENT;
> DECLARE temp_cur CURSOR WITH RETURN TO CALLER FOR stmt
>
> BEGIN
> SET temp_sql = 'SELECT temp FROM temp_tab WHERE temp_fn(t, 'a') = 2';
> END
>
> PREPARE stmt FROM temp_sql;
> OPEN temp_cur;
>
> It gives error the "a is not a recognised procedure of function". Note in
the SELECT Statement there are four ' which are matched as 1-2 and 3-4 with
"a" left stranded in between. How can I overcome this.
>
> Kindly Guide
>
> Ashish
>
>
> ---------------------------------------------------------------------
> PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
> website: http://www.LazyDBA.com
> To unsubscribe: http://www.lazydba.com/unsubscribe.html
>
>
DB2 & UDB email list listserv db2-l LazyDBA home page