dbTalk Databases Forums  

Passing quoted string ?

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss Passing quoted string ? in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jayvee Vibar
 
Posts: n/a

Default Passing quoted string ? - 12-11-2003 , 06:13 PM







Hello,

This is my declaration of a stored function in ASA:

function DBA.f_TitlePageResult(in a_start integer,in a_limit integer,in
a_target char(40),in a_sql long varchar)

My problem is on parameter *a_sql* which accepts an sql statement. Since
this is a string, it should be enclosed with a quote ('). If my sql
statement has a quote (') ASA will complain. (I have tried replacing it
with 2 quote but it doesn't work)

This is my actual statement:

select dba.f_TitlePageResult(1,10,'search.php','select number(*) as num,
b.book_id, title, author_name, Year(copyright_date) as copyright,
dba.BookCopies(b.book_id) as entries from books b key join book_word key
join word_index where soundex(root_word) = soundex('java')')

The error is near soundex('java').

Is there any escape character for this? I think I'm running out of
quote'?

Thanks for any help.




Reply With Quote
  #2  
Old   
Jayvee Vibar
 
Posts: n/a

Default Re: Passing quoted string ? - 12-11-2003 , 07:04 PM






Sorry..
I've tried again the 2 single quote for the second time and it WORKED JUST
FINE...




Reply With Quote
  #3  
Old   
Breck Carter [TeamSybase]
 
Posts: n/a

Default Re: Passing quoted string ? - 12-12-2003 , 05:26 AM



You can embed a single ' quote in a 'quoted' literal string by
representing it as two single quotes; e.g., 'Fred''s Not Here' will be
interpreted as Fred's Not Here.

select dba.f_TitlePageResult(1,10,'search.php','select number(*) as
num, b.book_id, title, author_name, Year(copyright_date) as copyright,
dba.BookCopies(b.book_id) as entries from books b key join book_word
key join word_index where soundex(root_word) = soundex(''java'')')

You can also put line breaks in the string to make it more readable if
you want.

Breck


On 11 Dec 2003 16:13:13 -0800, Jayvee Vibar <jayvee (AT) digitelone (DOT) com>
wrote:

Quote:
Hello,

This is my declaration of a stored function in ASA:

function DBA.f_TitlePageResult(in a_start integer,in a_limit integer,in
a_target char(40),in a_sql long varchar)

My problem is on parameter *a_sql* which accepts an sql statement. Since
this is a string, it should be enclosed with a quote ('). If my sql
statement has a quote (') ASA will complain. (I have tried replacing it
with 2 quote but it doesn't work)

This is my actual statement:

select dba.f_TitlePageResult(1,10,'search.php','select number(*) as num,
b.book_id, title, author_name, Year(copyright_date) as copyright,
dba.BookCopies(b.book_id) as entries from books b key join book_word key
join word_index where soundex(root_word) = soundex('java')')

The error is near soundex('java').

Is there any escape character for this? I think I'm running out of
quote'?

Thanks for any help.


--
bcarter (AT) risingroad (DOT) com
Mobile and Distributed Enterprise Database Applications
www.risingroad.com


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.