Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


write sql by ExpressionBuilder

Posted on 2006-11-21
Medium Priority
Last Modified: 2010-03-31
hi experts,

     -I wanna perform a select task in toplink (an ORM framework of oracle) using ExpressionBuilder
              but i don't know how to write this sql statement in ExpressionBuilder syntax.  

  here is my sql syntax :
                                "select * from "Information" where ("LastName" || "MiddleName" || "FirstName") = 'MrJohnSmith' " 

 please help me how to write this

 thanks so much

Question by:trkg
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 23

Expert Comment

ID: 17993951
try this:

ExpressionBuilder builder = new ExpressionBuilder();
Expression expression = builder.get("LastName").equal("MrJohnSmith").or(builder.get("MiddleName").equal("MrJohnSmith")).or(builder.get("FirstName").equal("MrJohnSmith"));

Vector list = uow.readAllObjects(Information.class, expression);

Author Comment

ID: 17994714
oh sorry sir !  

my Table         Information                  

         column                    LastName        MiddleName      FirstName  
row1                                     Mr                    John              Smith
row2                                    Mrs                  Jonh              Smith

my sql syntax
        "select * from "Information" where ("LastName" || "MiddleName" || "FirstName") = 'MrJohnSmith' " 

and my result  is  row1

sry bc my english 's too bad....  

LVL 23

Expert Comment

ID: 17994730
In that case it would be

ExpressionBuilder builder = new ExpressionBuilder();
Expression expression = builder.get("LastName").equal("Mr").and(builder.get("MiddleName").equal("John")).and(builder.get("FirstName").equal("Smith"));

Vector list = uow.readAllObjects(Information.class, expression);
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


Author Comment

ID: 17994770
ok , but i don't want to cut String MrJohnSmith  ,  i want to add 3 column  then equal that with String .

the same my sql.  i add 3 column   ("LastName" || "MiddleName" || "FirstName")   then  equal  with  "MrJohnSmith"

thanks sir very much about your answers.  
LVL 23

Accepted Solution

Ajay-Singh earned 2000 total points
ID: 17994901
I believe both are same

Author Comment

ID: 17995234
yes , i know both are same result , but i NEED to that in my way .

thanks very much

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This video teaches viewers about errors in exception handling.
Suggested Courses

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question