Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic sql

Status
Not open for further replies.

mgl70

Programmer
Sep 10, 2003
105
US
Hello,
In dynamic sql. Where do we use single quotes and doulble quotes for queries. Really I did not understand. I got confused. How do we follow. I went through some docs but did not get it. Doed any body explain me or give me simple example.


Thanks,
 
You very rarly have to use double quotes for anything in dynamic SQL. Dont get confused between double quotes and two single quotes together.
 
Thank you. But I saw 3 quotes and 4 quotes also. I donot know weather they are 2 double quotes or 4 single quotes.
Could you give me any example?
 
i find the best way to figure out what is going on with quotes is just use easy sql statements and look at what is returned. E.G
select '''test''' from dual; will return: 'test'
select '''' from dual; will return: '
4 qoutes would be used if you wanted the value of a db field to be surrounded by quotes
select ''''||EMP_NO||'''' FROM EMPLOYEE;
if empno 1234 will return: '1234'.
hope this explains some bit.
 
Actually it doesn't relate to dynamic sql itself, but rather to denoting string literals. If you need single quote within string literal it should be doubled. E.g. string literal don't may be produced as 'don''t'. Double quotes don't need any additional care.

Regards, Dima
 
ok . I will try like that.
Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top