Tuesday, June 8, 2010

Postgresql Single quotes!

Dear All,

Just wanted to share how we can incorporate single quote in postgresql plpgsql.

Say i want dynamic query like select id from emp where empname ilike 'Rahul Teni' and age > 25

name:='Rahul Teni'

query:= 'select id from emp where empname ilike' ||''''||name||''''||'and age >25'

I hope this helps and saves your lot's of time.

No comments:

Post a Comment

Pages

About Me

My photo
- A competent M.S. Software Engineer and B.E. (Comp) with 6 years of rich experience in Java/ C / C++ / Oracle/PHP/Postgresql/Mysql in IT industry.
- Resourceful in developing Applications with various platforms and different domains.
A strategic planner with expertise in designing internal control systems towards the accomplishment of corporate business goals.
- A keen analyst with exceptional relationship management skills and abilities in liaising with different clients.
- Team player with excellent analytical and communications skills.
Worked with development projects with software brands like Cognizant and Infosys
Specialties
- Master in struts
- Good hands on in core Java
- Understanding of other building blocks of Enterprise applications like middle ware technologies.
- Knowledge of database like Oracle,postgresql,mysql